Pagination .

GET routes that return multiple records are paginated. By default, all records will be in descending order based on an incrementing ID of the resource.

For example, you add 2 trading accounts. The second account will have a higher ID, as it is added last. If you were to request all accounts the second account will be the first record.

Meta data

The response data key will have a meta object.

"meta": {
    "count": 48,
    "limit": 1000,
    "order": "desc",
    "last_id": 37298688
Key Value Description
count integer The total records in the data array
limit integer Record limit per response
order asc or desc The order of the records
last_id integer The last id of the record set

Each key can be passed in the query string to change the behaviour. For example:


This will order the resources in ascending order, limited to 50 per response and using the last ID of 15 as the starting point.

Last ID

As results are limited to 1000 records, getting all data requires the last ID to move the starting point. For example, you want to store the trade history for an account with ID 123 and look for new records every hour via on a cron job.

You can achieve this either using ascending or descending. For an example, we will use ascending. In the example we will assume there are more than 1000 records, therefore requires multiple requests.

Initially to get the current trade list you want to request the trade history in ascending order and no last ID set.

"meta": {
    "count": 1000,
    "limit": 1000,
    "order": "asc",
    "last_id": 9999

The response has a count 1000 and last_id 9999. As the count is 1000 we can't be sure we have all records. So we request again with last ID 9999.


The response will ignore the previous 1000 results and give you the next set.

"meta": {
    "count": 102,
    "limit": 1000,
    "order": "asc",
    "last_id": 10235

This response has a count of 102, so we now know that is the last of the records, at the time of request. We can now store the last ID of 10235 for future use.

Hourly cron

When the hourly cron runs it will send the last ID stored previously and repeat the process above until it has got all results. Again the last ID will be stored for the next cron job.


Stay in the loop..

Sign up to our newsletter to keep up-to-date.