🚀 VaultsPay API v1 is live. See what's new →
Set UpPagination

Pagination

All list endpoints use cursor-based pagination. Cursors are opaque strings — don’t try to parse them. They remain stable even if the underlying data changes.

Query parameters

FieldTypeDescription
limitinteger
default: 25
Number of items to return. Max 100.
cursorstringCursor returned from a previous response.
starting_afterstringAlternative to cursor — return records after this ID (exclusive).
ending_beforestringReturn records before this ID (exclusive). Useful for walking backwards.

Example

curl "https://api.vaultspay.ae/v1/accounts?limit=10" \
  -H "Authorization: Bearer sk_test_yourApiKeyHere"
200 OK
{
  "object": "list",
  "data": [ { "id": "acc_01...", ... }, { "id": "acc_02...", ... } ],
  "has_more": true,
  "next_cursor": "acc_02HZTPT..."
}

To fetch the next page:

curl "https://api.vaultspay.ae/v1/accounts?limit=10&cursor=acc_02HZTPT..." \
  -H "Authorization: Bearer sk_test_yourApiKeyHere"

Iterating all pages

async function listAllAccounts() {
  let cursor = undefined
  const all = []
  do {
    const url = new URL('https://api.vaultspay.ae/v1/accounts')
    url.searchParams.set('limit', '100')
    if (cursor) url.searchParams.set('cursor', cursor)
 
    const res = await fetch(url, {
      headers: { Authorization: `Bearer ${process.env.VAULTSPAY_KEY}` }
    })
    const page = await res.json()
    all.push(...page.data)
    cursor = page.has_more ? page.next_cursor : undefined
  } while (cursor)
  return all
}