Skip to main content


The Coinbase Prime REST API uses cursor pagination for most requests that return arrays. The API Reference documentation indicates which endpoints support pagination by noting the existence of a cursor query parameter.

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.

A pagination object containing cursor information is available in the JSON response for all relevant endpoints. If your initial request returns a pagination value with a non-null next_cursor you should repeat the identical request again while adding a cursor=<next_cursor> query parameter to get the next page of results. Repeat until is next_cursor=''

Pagination Object in Response

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


For example, if you make this request to get all orders in the month of January:

GET /v1/portfolios/85874114-c465-4df7-a1bd-e4b17b4d3ddf/orders?product_ids=BTC-USD&product_ids=ETH-USD&start_date=2022-01-01T00%3A00%3A00Z&end_date=2022-01-31T23%3A59%3A00Z

You might get a response such as:

{'orders': [...], 'pagination': {'next_cursor': '2022-01-08T20:26:28.122357Z', 'sort_direction': 'DESC', 'result_count': 324}}

In which case you should repeat your request adding the cursor=<next_cursor> such as:

GET /v1/portfolios/85874114-c465-4df7-a1bd-e4b17b4d3ddf/orders?product_ids=BTC-USD&product_ids=ETH-USD&start_date=2022-01-01T00%3A00%3A00Z&end_date=2022-01-31T23%3A59%3A00Z&cursor=2022-01-08T20:26:28.122357Z

Cursor pagination can be unintuitive at first. The cursor argument should not be confused with records ordered by chronology, using timestamps. Most paginated requests return the latest information (newest) as the first page sorted by newest (in chronological time) first. To get older information you would request next pages with cursor=<next_cursor>

Was this helpful?