> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.lemmy.be/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.lemmy.be/_mcp/server.

# Pagination

Every `GET` endpoint in the Lemmy API is paginated. You control which slice of records you
receive using two **required** request headers, and the response tells you whether more
records are available.

## Request headers

| Header          | Type    | Description                                                                                                                                                                                                                  |
| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `x-page-offset` | integer | The **record offset** to start from, beginning at `0`. To fetch the next page, increase it by `x-page-limit` — for example `0`, then `50`, then `100`. The `x-page-next` response header gives you this value automatically. |
| `x-page-limit`  | integer | How many records to return per page. The **maximum is 50**; you cannot retrieve more than 50 records in a single request.                                                                                                    |

Both headers are required on every `GET` request. If you omit them, the request returns an
error. Always send `x-page-offset` and `x-page-limit` together.

## Requesting a page

This requests the first 50 records, starting at offset `0`:

```bash
curl https://app.inmotionsoftware.be/Lemmy_API_IS/rest/v1/GetCustomers \
  -H "x-api-key: your-api-key" \
  -H "x-company-id: 1234" \
  -H "x-page-offset: 0" \
  -H "x-page-limit: 50"
```

## Response headers

Each paginated response includes two headers that tell you whether to keep going:

| Header        | Description                                                                             |
| ------------- | --------------------------------------------------------------------------------------- |
| `x-page-more` | A flag indicating whether more records are available beyond the page you just received. |
| `x-page-next` | The `x-page-offset` value to send on your next request to fetch the following page.     |

To read an entire dataset, keep requesting pages — using `x-page-next` as your next
`x-page-offset` — until `x-page-more` reports that there are no more records.

## Reading every page

```python
import requests

url = "https://app.inmotionsoftware.be/Lemmy_API_IS/rest/v1/GetCustomers"
headers = {
    "x-api-key": "your-api-key",
    "x-company-id": "1234",
    "x-page-limit": "50",
}

records = []
offset = 0

while True:
    response = requests.get(url, headers={**headers, "x-page-offset": str(offset)})
    response.raise_for_status()

    records.extend(response.json()["Payload"])

    # Stop when the API reports there are no more records.
    if response.headers.get("x-page-more", "false").lower() != "true":
        break

    offset = int(response.headers["x-page-next"])

print(f"Retrieved {len(records)} records")
```