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
Object | Description |
---|---|
next_cursor | Cursor to navigate to next page |
sort_direction | The page sorting direction, either ASC (ascending) or DESC (descending) |
has_next | A boolean flag indicating whether there is more data available to page through |
Pagination Query Parameters
Parameter | Description | Default if not specified |
---|---|---|
cursor | Cursor to navigate to next page using next_cursor from response | |
sort_direction | The 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.