Pagination
List endpoints use cursor-based pagination. Request a page, then pass the
next_cursor you received back as the starting_after query parameter.
The names differ: the response field is next_cursor, but the
query parameter is starting_after. There is no cursor query parameter;
sending ?cursor=... fails with a 400 because unknown query parameters are rejected.
Request parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 25 | Items per page, 1 to 100 |
starting_after | string | none | Return items after this ID. Pass the next_cursor from the previous response. Omit it to get the first page |
Response fields
| Field | Type | Description |
|---|---|---|
data | array | The items in this page |
has_more | boolean | true if more items exist after this page |
next_cursor | string | Pass this as starting_after to get the next page. Only present when has_more is true |
Fetching every page
Keep requesting pages until has_more is false.
let startingAfter;
const all = [];
do {
const url = new URL('https://api.araucaria.money/v1/accounts/acc_xxx/transactions');
url.searchParams.set('limit', '100');
if (startingAfter) url.searchParams.set('starting_after', startingAfter);
const res = await fetch(url, { headers: { Authorization: 'Bearer sk_live_xxx' } });
const { data, has_more, next_cursor } = await res.json();
all.push(...data);
startingAfter = has_more ? next_cursor : undefined;
} while (startingAfter);