API Pagination
The Amberdata API uses cursor pagination to handle large datasets efficiently. The API automatically generates the URL for the next page of results when applicable.Pagination Response Structure
For a 200 - OK HTTP response, the URL for the next page is found under thepayload.metadata.next
property:
next
response will be null
.
Accessing Next Pages
To access the next page of results:- Retrieve the URL from
payload.metadata.next
- Copy your request headers from your initial API call (e.g.,
x-api-key
, etc.) - Make a HTTP GET request with the next page URL and the copied headers
Page Parameter
Some endpoints contain column names in the metadata instead of anext
field. For these endpoints, use the page
parameter to loop through all pages of data, beginning at page 0
.
Query parameter: page
Options: 0 - ∞
Querying Long Timeframes
API endpoints have a maximum supported range for the query parametersendDate
and startDate
.
Note: Amberdata reserves the right to increase the supported range forendDate
andstartDate
for any endpoint. An increase in the supported range is fully backwards compatible.
Example: Getting 1 Year of Data
The following example demonstrates how to get 1 year of data for the DEX - Trades endpoint, which has a maximum range of 30 days.Warning: The code below has been verified and tested for demonstration purposes only.