Pagination
All endpoints that list objects provide support for pagination.
We utilize cursor based pagination mechanism via the starting_after
and ending_before
fields. Both fields accept IDs of a given object (eg.: ACH transfer) and return objects in inverse chronological order meaning that most recently created object will be returned first on the list and the oldest object will be returned last.
The starting_after
parameter returns objects listed after the provided object and ending_before
parameter returns objects listed before the provided object. Fields starting_after
and ending_before
are mutually exclusive meaning that only one of them can be set at the time. Additionally, you can specify limit
in a request parameter that determines the number of records to be returned per page. The default limit is 10 and maximum limit is 100. Lastly, in the responses will include has_more
field set true
or false
whether there is more pages to iterate or was that the last one.
Listing Transfers
It is important to note that using list endpoints on any kind of transfers - ach, book, or wire - should not be used to re-create ledger order or calculate ledger balances that are maintained internally at Column.
Because there's a lot of other factors that contribute to and change ledger balances internally that are not just movements triggered by transfers, simply listing all transfers and summing them up won't provide a consistent results and should not be used to do so.
Example
Let's say that we want to iterate through whole list of transfers created on our platform. For simplicity let's assume that we have 5 book transfer objects created and we want to iterate through and return 2 objects per page.
In the code below we first query book transfers with just limit=2
and get back 2 transfers along with the indication in the response -has_more: true
- that there's more records after this page. We then grab the ID of the last returned object - book_1zMiUDiWjf2OnSR99FjNLJmr1aD
- and set it to starting_after
parameter for the second call to fetch next page of records. We get two more objects and repeat the previous step. Now the response for the third API call returned only one record and tells us that there's no more pages to iterate through (has_more: false
).
curl https://api.column.com/transfers/book?limit=2
{
"transfers": [
{
"id": "book_1zMiU9lhaxANNH5HxbBp519ZCVL",
"created_at": "2021-10-11T14:59:57Z",
// ...
},
{
"id": "book_1zMiUDiWjf2OnSR99FjNLJmr1aD",
"created_at": "2021-10-11T13:12:23Z",
// ...
}
],
"has_more": true,
}
curl https://api.column.com/transfers/book?limit=2&starting_after=book_1zMiUDiWjf2OnSR99FjNLJmr1aD
{
"transfers": [
{
"id": "book_1zMiU8YTDUcVaGZseV1AdzKYtJD",
"created_at": "2021-10-11T12:30:30Z",
// ...
},
{
"id": "book_1zMiUBwMwk8l9FSJOu6v8eoLFPe",
"created_at": "2021-10-11T11:00:02Z",
// ...
}
],
"has_more": true,
}
curl https://api.column.com/transfers/book?limit=2&starting_after=book_1zMiUBwMwk8l9FSJOu6v8eoLFPe
{
"transfers": [
{
"id": "book_1zMiU44UKEylj6KayD89eqfklTg",
"created_at": "2021-10-11T10:29:33Z",
// ...
}
],
"has_more": false,
}