GuidesAPI Reference
DocumentationLog In

Pagination

How to handle paginated requests and responses

Pagination

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 parameter.

Cursor pagination allows for fetching 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. Your requests should use the next_cursor value when making requests for pages after the initial request.

Parameters

ParameterDescriptionDefault
next_cursorCursor to navigate to next page
sort_directionThe page sorting direction, either ASC (ascending) or DESC (descending)DESC
result_countThe total number of returned items

Example

GET /v1/entities/BTC-USD/assets?next_cursor=1234&sort_direction=ASC

Cursor pagination can be unintuitive at first. The after 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 pages after the initial page, using the unique cursor identifier.