# Rate limits and pagination

Stay under the rate limit and read lists longer than one page.

## Rate limits

When you go over a rate limit, Phi returns `429` with a `Retry-After` header that gives the number of seconds to wait. The client waits and retries reads on its own. Your code must wait before it retries a write.

Reading a large project one page at a time is the most common way to reach the limit. An export returns the same rows in one file, with one request.

[Errors and retries](https://dynophi.com/docs/reference/errors)

## Pagination

List endpoints return one page at a time. Over HTTP, pass the `X-Next-Cursor` header from each response as the `cursor` query parameter on the next request. Stop when a response has no cursor.

In Python, the `iter` methods page for you. Loop over one to read the whole list.

```python
for run in phi.runs.iter(project_id, page_size=50):
    print(run.run_id, run.status)
```

## Exports

An export writes every row to one file. Use it to take a finished project's results into another tool.

```bash
phi export sequences --project $PROJECT --out sequences.csv
```

[Export commands](https://dynophi.com/docs/cli/export)

---
Source: https://dynophi.com/docs/reference/limits
