Skip to main content

Paginating results

List endpoints return results in pages using cursor-based pagination. A cursor is the id of an item in the result set, so paging is stable even as data changes.

Parameters

ParameterDescription
limitThe maximum number of items to return in one page.
starting_afterReturn the page of items after the item with this id (page forward).
ending_beforeReturn the page of items before the item with this id (page backward).

starting_after and ending_before are mutually exclusive.

Response

A list response is a collection envelope:

{
"data": [
{ "id": "3Xr8k2...", "name": "Production" },
{ "id": "7Yh1p9...", "name": "Staging" }
],
"has_more": true
}

has_more indicates whether more items exist beyond this page. To fetch the next page, take the id of the last item in data and pass it as starting_after:

# first page
curl "https://api.attlaz.com/1.13/environments?limit=50" \
-H "Authorization: Bearer <token>"

# next page, continuing after the last id you received
curl "https://api.attlaz.com/1.13/environments?limit=50&starting_after=7Yh1p9..." \
-H "Authorization: Bearer <token>"

Repeat until has_more is false. A malformed cursor returns 400 Bad Request. The client libraries can page through an entire result set for you.