Skip to main content

Pagination

How to paginate through list endpoints in the Anton Payments API using cursor-based pagination.

Written by Ryan O
Updated today

Overview

All list endpoints in the Anton API return paginated results using cursor-based pagination. This approach provides stable, efficient pagination even when new records are being created while you iterate.

Request Parameters

Parameter

Type

Default

Max

Description

limit

integer

20

100

Number of items to return per page

cursor

string

--

--

Opaque cursor from a previous response. Omit to start from the beginning.

Response Format

Every list response includes a has_more boolean. When has_more is true, a next_cursor string is also present:

{
  "data": [
    { "id": "pay_abc123", "status": "completed", "amount": "500.00" },
    { "id": "pay_def456", "status": "processing", "amount": "1200.00" }
  ],
  "has_more": true,
  "next_cursor": "pay_def456"
}

When you reach the last page, has_more is false and next_cursor is not included:

{
  "data": [
    { "id": "pay_xyz789", "status": "completed", "amount": "300.00" }
  ],
  "has_more": false
}

Iterating Through Pages

Pass the next_cursor value from each response as the cursor parameter in the next request:

# First page
curl "https://api.antonpayments.dev/v1/payouts?limit=20" \
  -H "Authorization: Bearer ak_test_..."# Next page (using next_cursor from previous response)
curl "https://api.antonpayments.dev/v1/payouts?limit=20&cursor=pay_def456" \
  -H "Authorization: Bearer ak_test_..."

Continue requesting pages until has_more is false.

Tips and Best Practices

  • Use the maximum page size -- Set limit=100 to minimize the number of API calls when fetching all items.

  • Stop when has_more is false -- The has_more field tells you whether another page exists. When it is false, you have reached the end of the result set.

  • Cursors are opaque -- Treat cursor values as opaque strings. Do not parse, modify, or construct them. Always use the exact next_cursor value returned by the API.

  • Cursors do not expire -- Cursor values remain valid indefinitely. You can store a cursor and resume pagination later.

  • Pagination applies everywhere -- All list endpoints use this pattern, including payouts, payees, batches, webhooks, and events.

Did this answer your question?