> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eazecustoms.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> Learn how to retrieve large API result sets using cursor-based pagination.

## What you can do

List endpoints return one page of results at a time. Use `nextCursor` to retrieve the next page until `hasMore` is `false`.

This API uses cursor-based pagination and does not support page numbers or offsets.

## Before you start

Make sure you have valid API credentials. Client-specific requests also require the `X-Eaze-Client-Ref` header. The List Clients endpoint does not require this header.

## The fields

| Field | Meaning |
| - | - |
| `limit` | How many items to return. Use a whole number from 1 to 100. The default is 20. |
| `cursor` | The token from the previous page. Leave it out on the first request. |
| `hasMore` | `true` when another page exists. |
| `nextCursor` | The token for the next page. Send it back unchanged. It is null on the last page. |

A cursor is tied to the endpoint, the client, the sort order, and the filters. It expires. The default lifetime is one hour. If you change a filter, start again without a cursor.

## Steps

**1. Request the first page**

Send the list request with `limit` and no `cursor`.

**2. Read data and hasMore**

Process `data`. If `hasMore` is false, stop.

**3. Request the next page**

Repeat the same path, headers, and filters. Add `cursor` with the exact `nextCursor` value.

## Working example

First page:

```bash theme={null}
curl 'https://staging.api.eazecustoms.com/public/v1/shipments?limit=20' \
  --header 'Authorization: Bearer EZ_11111111-1111-4111-8111-111111111111_exampleSecretValueNotReal' \
  --header 'X-Eaze-Client-Ref: ACME-AMS'
```

```json theme={null}
{
  "data": [{ "id": "22222222-2222-4222-8222-222222222222", "shipmentNumber": "SHP-2026-0142" }],
  "pagination": {
    "limit": 20,
    "hasMore": true,
    "nextCursor": "eyJwYWdlIjoiZXhhbXBsZSJ9"
  }
}
```

Next page:

```bash theme={null}
curl 'https://staging.api.eazecustoms.com/public/v1/shipments?limit=20&cursor=eyJwYWdlIjoiZXhhbXBsZSJ9' \
  --header 'Authorization: Bearer EZ_11111111-1111-4111-8111-111111111111_exampleSecretValueNotReal' \
  --header 'X-Eaze-Client-Ref: ACME-AMS'
```

```javascript theme={null}
async function listAllShipments({ baseUrl, credential, clientRef }) {
  const shipments = [];
  let cursor;
  do {
    const url = new URL(`${baseUrl}/public/v1/shipments`);
    url.searchParams.set('limit', '100');
    if (cursor) url.searchParams.set('cursor', cursor);
    const response = await fetch(url, {
      headers: {
        Authorization: `Bearer ${credential}`,
        'X-Eaze-Client-Ref': clientRef,
      },
    });
    if (!response.ok) throw new Error(await response.text());
    const body = await response.json();
    shipments.push(...body.data);
    cursor = body.pagination.hasMore ? body.pagination.nextCursor : undefined;
  } while (cursor);
  return shipments;
}
```

## Statuses and errors

HTTP 400 with `errors[].code` of `invalid_cursor` means the cursor is malformed, expired, or no longer matches the filters. Start the list again without `cursor`. Do not try to edit the cursor.

See [Errors & Troubleshooting](https://docs.eazecustoms.com/implementation/errors.md).

Next: [File Uploads](https://docs.eazecustoms.com/implementation/file-uploads.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.