> For the complete documentation index, see [llms.txt](https://docs.enlyze.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.enlyze.com/en/enlyze-api/pagination.md).

# Pagination

List endpoints in the ENLYZE API return results one page at a time. Instead of returning every record at once, the API returns a single page along with a cursor you use to fetch the next page.

## How pagination works

The ENLYZE API uses cursor-based pagination. The flow is always the same:

1. Call a list endpoint without a `cursor` to get the first page.
2. Read the `metadata.next_cursor` value from the response.
3. Call the same endpoint again, passing that value as the `cursor` parameter, to get the next page.
4. Repeat steps 2 and 3 until `metadata.next_cursor` is `null`. At that point there is no more data.

Keep all other parameters (such as filters) unchanged across follow-up requests. Otherwise the cursor is no longer valid.

## Response structure

Every paginated response has the same structure:

| Field                  | Type             | Description                                                                  |
| ---------------------- | ---------------- | ---------------------------------------------------------------------------- |
| `data`                 | Array            | The records on the current page.                                             |
| `metadata.next_cursor` | String or `null` | The continuation point for the next page. `null` when there is no more data. |

On the request side, you control pagination with a single parameter:

| Parameter | Location | Description                                                                                                                                            |
| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `cursor`  | Query    | The starting point of the page to fetch. Pass the `metadata.next_cursor` value from the previous response. Without a `cursor`, you get the first page. |

{% hint style="info" %}
For the `POST /v2/timeseries` endpoint, the `cursor` is passed in the request body rather than as a query parameter. The response structure with `data` and `metadata.next_cursor` stays the same.
{% endhint %}

## Example

Fetch the first page:

```http
GET https://app.enlyze.com/api/v2/production-runs
```

Response:

```json
{
  "data": [
    { "uuid": "3f2a…" },
    { "uuid": "8b1c…" }
  ],
  "metadata": {
    "next_cursor": "eyJpZCI6MTQ4fQ"
  }
}
```

Fetch the next page by passing `next_cursor` as `cursor`:

```http
GET https://app.enlyze.com/api/v2/production-runs?cursor=eyJpZCI6MTQ4fQ
```

On the last page, `next_cursor` is `null`:

```json
{
  "data": [
    { "uuid": "d90e…" }
  ],
  "metadata": {
    "next_cursor": null
  }
}
```

{% hint style="warning" %}
The cursor is an opaque token. Do not modify its contents or build it yourself. Only use the value from `metadata.next_cursor`.
{% endhint %}
