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

# Pagination

> Cursor-based lists, limits, and walking every page.

List endpoints return a page of results plus a `cursor` for the next page. This
applies to markets, rounds, orders, fills, and trades.

## Parameters

| Param    | Default | Max  | Meaning                                 |
| -------- | ------- | ---- | --------------------------------------- |
| `limit`  | 100     | 1000 | Items per page                          |
| `cursor` | (omit)  | —    | Opaque token from the previous response |

Pass `cursor` back as `?cursor=` on the next request. An **empty cursor** (`""`)
means there are no more results — stop iterating.

<Warning>
  **Cursors are opaque.** Do not parse, construct, or persist them across long
  idle periods. They are tied to the current index state; re-start from no cursor
  if you are unsure.
</Warning>

## Example response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "rounds": [ { "round_number": "2963", "status": "trading", "...": "..." } ],
  "cursor": "2963.0",
  "as_of_seq": "3947"
}
```

When `cursor` is `""`, you have the last page.

## Walk every page

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
#!/usr/bin/env python3
"""Page through all resting orders."""
import base64, hashlib, hmac, time
import requests

BASE = "https://api.omnibook.xyz"
API_KEY = "<your alphanumeric API key>"
SECRET = bytes.fromhex("<your 64-char hex secret>")


def request(method, target, body=b""):
    ts = str(int(time.time() * 1000))
    canonical = f"{ts}\n{method}\n{target}\n".encode() + body
    sig = base64.b64encode(
        hmac.new(SECRET, canonical, hashlib.sha256).digest()
    ).decode()
    return requests.request(
        method, BASE + target, data=body,
        headers={
            "DX-ACCESS-KEY": API_KEY,
            "DX-ACCESS-TIMESTAMP": ts,
            "DX-ACCESS-SIGNATURE": sig,
            "Content-Type": "application/json",
        },
    )


def walk_orders(status="resting,partially_filled"):
    cursor = ""
    while True:
        target = f"/v1/portfolio/orders?status={status}&limit=1000"
        if cursor:
            target += f"&cursor={cursor}"
        page = request("GET", target).json()
        for order in page.get("orders", []):
            yield order
        cursor = page.get("cursor", "")
        if not cursor:
            break


for order in walk_orders():
    print(order["order_id"], order["status"], order.get("resting_qty"))
```

The same loop pattern works for any cursor-paginated list — swap the path and
the array key (`rounds`, `fills`, `trades`, etc.).

## `as_of_seq`

Every read response includes `as_of_seq` — the sequencer position the answer
was computed at. Two pages fetched at different times may have different
`as_of_seq` values even if the underlying data did not change.
