Pagination
List endpoints use limit and offset with a pagination meta object.
All list endpoints return a meta.pagination object with total, limit, offset, and has_more. Use limit and offset query parameters to page through results.
| Parameter | Default | Maximum | Description |
|---|---|---|---|
limit | 20 | 100 | Number of records to return |
offset | 0 | — | Number of records to skip |
Iterating pages
Increment offset by limit on each request until has_more is false:
# Page 1
curl -G https://api-sandbox.thehalfin.com/v1/invoices \
-H "X-API-Key: $HALFIN_API_KEY" \
--data-urlencode "limit=20" \
--data-urlencode "offset=0"
# Page 2
curl -G https://api-sandbox.thehalfin.com/v1/invoices \
-H "X-API-Key: $HALFIN_API_KEY" \
--data-urlencode "limit=20" \
--data-urlencode "offset=20"import { createHalfin, listInvoices } from '@halfin/sdk-merchant';
const client = createHalfin({ apiKey: process.env.HALFIN_API_KEY! });
async function* allInvoices() {
let offset = 0;
const limit = 20;
while (true) {
const { data, meta } = await listInvoices({ client, query: { limit, offset } });
yield* data;
if (!meta.pagination.has_more) break;
offset += limit;
}
}Filtering
List endpoints accept filter query parameters — status, currency, network — where applicable. Keep filters stable while paginating; changing a filter mid-iteration can cause rows to appear or disappear between pages.
Troubleshooting
Missing rows between pages — filters or sort window changed during iteration. Restart the scan with consistent filters.