Pagination
All endpoints that list objects provide support for pagination.
We utilize a 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, such that the most recently created object will be returned first on the list and the oldest 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 a 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 the maximum limit is 100. Lastly, a response will include a has_more
field set to true
or false
depending on whether there are more pages to iterate through or if a page is 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 are 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 will not provide consistent results.
Example
Let's say that we want to iterate through a whole list of transfers created on our platform. For simplicity let's assume that we have created 5 book transfer objects and we want to iterate through these and return two objects per page.
In the code below we first query book transfers with limit=2
and get back two transfers along with the indication in the response - has_more: true
- indicating there are 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 are 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,
}