> AI agents: this is one page from Mammoth Analytics documentation. The index of all pages as Markdown is https://docs.mammoth.io/llms.txt. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get Markdown.

# Mammoth API pagination

> Most Mammoth list endpoints page with limit and offset. Cursor pagination exists on exactly two of 471 operations. Measured against the v2 spec.

Most list endpoints page with `limit` and `offset`. Two use a cursor. Assuming otherwise gives you a loop that never advances.

## Which endpoints page, and how

| Parameter | Operations carrying it |
| --- | --- |
| `limit` | 37 |
| `offset` | 34 |
| `cursor` | **2** |

Not every endpoint pages at all. Those that do overwhelmingly use `limit` and `offset`, with a `total` in the body so you know when to stop.

## Offset pagination

```bash
LIMIT=100
OFFSET=0
while : ; do
  BODY=$(curl -sS "https://app.mammoth.io/api/v2/workspaces/$WS/projects/$P/datasets?limit=$LIMIT&offset=$OFFSET" \
    -H "Authorization: Bearer $MAMMOTH_API_TOKEN")
  TOTAL=$(echo "$BODY" | jq -r '.total')
  echo "$BODY" | jq -c '.datasets[]?'
  OFFSET=$((OFFSET + LIMIT))
  [ "$OFFSET" -ge "$TOTAL" ] && break
done
```

Through the SDK and the CLI this is handled for you in most cases. Going direct to HTTP, read `total` and advance `offset` by your `limit` until you have them all.

## Paging through the CLI

`mammoth view data get`, `mammoth view export list` and `mammoth view pipeline items` page with `offset` and `limit` in `--input`. The offset is 0-based and counts the rows to skip: `offset: 0` is the first page. The response reports the `limit` and `offset` it used in a `paging` block with `next_command` and `previous_command`, ready to run. Each is null when there is no such page.

```bash
mammoth view data get 1039 --project 180 --input '{"offset": 0, "limit": 50}'
```

Follow `paging.next_command` until it is null. A script that passed `1` for the first page must now pass `0`.

## The two cursor exceptions

Cursor pagination is the exception, not the rule. It appears on the Resources v2 surface only:

```
GET /workspaces/{workspace_id}/resources
GET /workspaces/{workspace_id}/projects/{project_id}/resources
```

These return a cursor to pass back on the next request. Do not write a cursor loop against anything else; the parameter is not there.

> **Only two endpoints take a cursor**
>
> Cursor pagination is on **2 of 471** operations, the two Resources endpoints above. A cursor loop against any other list endpoint never advances; page those with `limit` and `offset`.

## Next up

- [Errors and exit codes](https://docs.mammoth.io/build/errors)—how failures are reported, and what is worth retrying.
- [Command contract](https://docs.mammoth.io/build/)—every capability with its CLI, SDK and API forms.

---
Source: https://docs.mammoth.io/build/pagination.md · Updated: 2026-10-15