Skip to main content
All list endpoints in the Gcore API return paginated results using limit and offset query parameters. Without explicit pagination, a single response returns up to 1000 items — the default for most endpoints. For accounts with many resources, iterating pages is required to retrieve all results.

Response structure

Every list response includes count and results:
{
  "count": 35,        // total number of matching items across all pages
  "results": [...]    // items on this page (up to `limit`)
}
count is the total across all pages, not the current page alone — use it to calculate how many pages remain.

Parameters

Both parameters are optional and can be combined on any list endpoint:
ParameterDefaultMaximumDescription
limit10001000Items per page
offset0Skip the first N items
# Page 1: items 1–5
curl "https://api.gcore.com/cloud/v1/regions?limit=5&offset=0" \
  -H "Authorization: APIKey $GCORE_API_KEY"

# Page 2: items 6–10
curl "https://api.gcore.com/cloud/v1/regions?limit=5&offset=5" \
  -H "Authorization: APIKey $GCORE_API_KEY"
Page 1 response (limit=5, count=35):
{
  "count": 35,
  "results": [
    {"id": 196, "display_name": "London-2"},
    {"id": 184, "display_name": "Chester"},
    {"id": 180, "display_name": "Frankfurt-2"},
    {"id": 176, "display_name": "Sines-3"},
    {"id": 172, "display_name": "San Jose"}
  ]
}
Page 2 response (limit=5, offset=5):
{
  "count": 35,
  "results": [
    {"id": 164, "display_name": "Sines-2"},
    {"id": 160, "display_name": "Paris-3"},
    ...
  ]
}

Iterate all pages

LIMIT=100
OFFSET=0

while true; do
  RESPONSE=$(curl -s \
    "https://api.gcore.com/cloud/v1/instances/$PROJECT_ID/$REGION_ID?limit=$LIMIT&offset=$OFFSET" \
    -H "Authorization: APIKey $GCORE_API_KEY")

  COUNT=$(echo "$RESPONSE" | grep -o '"count":[0-9]*' | grep -o '[0-9]*')
  echo "Page offset=$OFFSET, total=$COUNT"

  # Process results here...

  OFFSET=$((OFFSET + LIMIT))
  if [ "$OFFSET" -ge "$COUNT" ]; then break; fi
done

Pagination in practice

Most API responses return all results in a single page when the total is under 1000. Pagination becomes important when:
  • An account has hundreds or thousands of instances, volumes, or other resources
  • Filtering is applied server-side and the filtered set still exceeds the default limit
  • Building inventory tooling or cost reporting across all resources
For most individual workflow operations (create VM, attach volume, configure network), pagination is not needed — those operations work on a single resource at a time.