URL: /api/pagination

---
title: Pagination
description: Cursor-based pagination on list endpoints.
---

List endpoints return up to 100 items per page and a cursor for the next page.

## Request

```bash
curl "https://api.domaingenius.com.au/api/v1/orgs/org_x/domains?limit=50&cursor=eyJpZCI6..."
```

| Param | Default | Max |
| --- | --- | --- |
| `limit` | 25 | 100 |
| `cursor` | — | opaque string from a previous response |

## Response

```json
{
  "items": [ /* up to limit */ ],
  "next_cursor": "eyJpZCI6IjAxSDgyN1lWLi4uIn0=",
  "has_more": true
}
```

`next_cursor` is `null` on the last page; `has_more` mirrors that. Don't parse the cursor — it's a base64 envelope and the schema can change.

## Loop pattern

```ts
let cursor: string | null = null;
do {
  const url = new URL(`https://api.domaingenius.com.au/api/v1/orgs/${oid}/domains`);
  url.searchParams.set("limit", "100");
  if (cursor) url.searchParams.set("cursor", cursor);
  const res = await fetch(url, { headers: { Authorization: `Bearer ${key}` } });
  const page = await res.json();
  for (const domain of page.items) await handle(domain);
  cursor = page.next_cursor;
} while (cursor);
```

## Stable ordering

List endpoints sort by creation time descending unless documented otherwise. New rows landing during pagination shift the cursor — you may see a row twice or miss it. If you need exact-once iteration, take a snapshot via `Idempotency-Key` or filter by a fixed `created_before`.
