Pagination
Cursor pagination on list endpoints.
List endpoints — GET /v1/transactions and GET /v1/webhook-endpoints/{id}/deliveries — return a page and a cursor:
{
"data": [ … ],
"nextCursor": "eyJjIjoiMjAyNi0wOS0wMlQxMDowNToxMVoiLCJyIjoidHhuXzhmM2ExYzllMDJiNCJ9"
}Pass nextCursor back as after to get the next page. nextCursor is null on the last page.
curl "https://api.omicloud.io/v1/transactions?state=settled&limit=100" -H "Authorization: Bearer …"
curl "https://api.omicloud.io/v1/transactions?state=settled&limit=100&after=eyJjIjo…" -H "Authorization: Bearer …"Rules
limitis 1–100, default 25.- Results are newest first.
- Cursors are keyset cursors, not offsets: a page is stable even while new transactions are being created, and you will never see a row twice or skip one. There is no
totalCount— counting a live ledger is expensive and always stale. - Keep every filter identical across pages. A cursor from one query is not valid for another and returns
400 VALIDATION_FAILEDwitherrors[0].field = "after". - Cursors are opaque. Do not parse or construct them.
Syncing your ledger
For a periodic reconciliation job, filter by since on createdAt and walk to the end:
since = last_run_started_at - 1h # overlap; transactions are deduped by reference
after = null
loop:
page = GET /v1/transactions?since={since}&limit=100&after={after}
upsert page.data by reference
if page.nextCursor is null: break
after = page.nextCursor
since/until filter on creation time. A transaction that was created before since but settled after it will not appear — use webhooks, or fetch by reference, for state changes on older transactions.
Updated about 2 months ago
Did this page help you?