Skip to main content

Commerce API Pagination

All GET endpoints returning object lists use cursor-based pagination, with details provided in a pagination object.

To get all objects, you need to paginate through the results by always using the ID of the last resource in the list as a starting_after parameter for the next call.

To make it easier, the API constructs the next call into next_uri together with all the currently used pagination parameters. You know that you have paginated all the results when the response’s next_uri is empty.

The default limit is set to 25 but values up to 100 are permitted.

Arguments

FieldDescription
orderoptional Order of the resources in the response: asc , desc (default)
limitoptional Number of results per call. Accepted values: 0 - 100. Default is 25
starting_afteroptional A cursor for pagination and a resource ID that defines your place in the list
ending_beforeoptional A cursor for pagination and a resource ID that defines your place in the list

Example request:

curl https://api.commerce.coinbase.com/checkouts?limit=20 \
-H "X-CC-Api-Key: <Your API Key>" \
-H "X-CC-Version: 2018-03-22"

Example response:

{
"pagination": {
"order": "desc",
"starting_after": null,
"ending_before": null,
"total": 25,
"yielded": 20,
"limit": 20,
"previous_uri": null,
"next_uri": "https://api.commerce.coinbase.com/checkouts?limit=20&starting_after=fb6721f2-1622-48f0-b713-aac6c819b67a",
"cursor_range": ["a76721f2-1611-48fb-a513-aac6c819a9d6", "fb6721f2-1622-48f0-b713-aac6c819b67a"]
},
"data": [
...
]
}

See Also:

Was this helpful?