Most endpoints that return lists of items support pagination. You can use pagination to retrieve results in smaller chunks, which is especially useful when working with large datasets.
The Coinranking API supports two pagination methods:
The traditional way to paginate using offset and limit parameters:
...coins?limit=50&offset=100
This method works well for small datasets but becomes inefficient for large offsets, as the database still needs to scan through all the skipped rows.
Cursor-based pagination uses an opaque cursor string to mark your position in the result set:
...coins?limit=50&cursor=eyJ0IjoxLCJyIjoxMjM0NTY3ODkwLC...
This method is more efficient and provides consistent results even when data changes between requests.
pagination object with a nextCursor valuenextCursor value as the cursor parameter for the next pagehasNextPage is false or nextCursor is nullYou can also navigate backward through results using the previousCursor:
hasPreviousPage and previousCursor fieldspreviousCursor value as the cursor parameter to return to the previous pagehasPreviousPage is false or previousCursor is nullFirst request:
GET /v2/coins?limit=10
Response:
json{
"status": "success",
"data": {
"coins": [...]
},
"pagination": {
"limit": 10,
"hasNextPage": true,
"hasPreviousPage": false,
"nextCursor": "eyJ0IjoxLCJyIjoxMjM0NTY3ODkwLC...",
"previousCursor": null
}
}
Second request (forward):
GET /v2/coins?limit=10&cursor=eyJ0IjoxLCJyIjoxMjM0NTY3ODkwLC...
Response:
json{
"status": "success",
"data": {
"coins": [...]
},
"pagination": {
"limit": 10,
"hasNextPage": true,
"hasPreviousPage": true,
"nextCursor": "eyJ0IjoyLCJyIjo5ODc2NTQzMjEwLC...",
"previousCursor": "eyJ0IjoxLCJyIjoxMjM0NTY3ODkwLC..."
}
}
Go back (backward):
GET /v2/coins?limit=10&cursor=eyJ0IjoxLCJyIjoxMjM0NTY3ODkwLC...
This returns you to the previous page of results.
All paginated endpoints return a pagination object in their response:
| Property | Type | Description |
|---|---|---|
limit | Number | The number of items per page (as requested) |
hasNextPage | Boolean | Whether there are more results available after the current page |
hasPreviousPage | Boolean | Whether there are results available before the current page |
nextCursor | String/null | The cursor to use for the next page, or null if there are no more results |
previousCursor | String/null | The cursor to use for the previous page, or null if on the first page |
orderBy and orderDirection parameters used in the original request. If you change these parameters, you must start pagination from the beginning without a cursor.
cursor and offset parameters together. If both are provided, you will receive a PAGINATION_CONFLICT error.
| Error | Description |
|---|---|
INVALID_CURSOR | The cursor string is malformed or could not be decoded. Start pagination from the beginning without a cursor. |
CURSOR_MISMATCH | The cursor was created with different orderBy or orderDirection parameters than the current request. Either match the original parameters or start pagination from the beginning. |
PAGINATION_CONFLICT | Both cursor and offset parameters were provided. Use only one pagination method per request. |
Cursor-based pagination is available on the following endpoints:
Coins:
Exchanges:
Markets:
Tags:
Other: