Skip to main content

Prime REST API Pagination

The Coinbase Prime REST API uses cursor pagination for most requests that return arrays. Endpoints that support pagination have a cursor query parameter, such as List Portfolio Allocations.

For an end-to-end example of authoring pagination logic, see Locate Order By Client Order ID.

Cursor pagination lets you fetch additional results after the current page of results, and is well suited for realtime data. To retrieve more results, subsequent requests should specify which direction to paginate based on the data previously returned.

The JSON response for all relevant endpoints includes a pagination object with cursor information. If your initial request returns a pagination value with a non-null next_cursor, you can retrieve the next page of results by sending the same request with the cursor=<next_cursor> query parameter appended. Repeat until is next_cursor=''.

Pagination Object in Response

ObjectDescription
next_cursorCursor to navigate to next page
sort_directionThe page sorting direction, either ASC (ascending) or DESC (descending)
has_nextA boolean flag indicating whether there is more data available to page through

Pagination Query Parameters

ParameterDescriptionDefault if not specified
cursorCursor to navigate to next page using next_cursor from response
sort_directionThe page sorting direction, either ASC (ascending) or DESC (descending)DESC

Example

For an end-to-end example of authoring pagination logic, see Locate Order By Client Order ID.

Was this helpful?