---
title: Python
description: 'anyrow: every endpoint, with a sync client and an async one, for Python 3.10 and later.'
url: https://anyrow.ai/docs/sdks/python
canonical_url: https://anyrow.ai/docs/sdks/python
last_updated: '2026-10-16'
---

# Python

The `anyrow` package has two clients over the same methods: `SDK` for regular code and
`AsyncSDK` for `asyncio`. Request bodies and responses are typed dictionaries.

## Install

```bash title="pip"
pip install anyrow
```

```bash title="uv"
uv add anyrow
```

```bash title="Poetry"
poetry add anyrow
```

It needs Python 3.10 or later.

## Create a client

```python
import os

from anyrow import SDK, ClientConfig

anyrow = SDK(ClientConfig(
    base_url="https://api.anyrow.ai",
    bearer_token=os.environ["ANYROW_API_KEY"],
    auth_header_prefix="ApiKey ",
    timeout=30.0,  # seconds
))
```

`auth_header_prefix="ApiKey "` sends the key as `Authorization: ApiKey <key>`, the scheme API
keys use. For `asyncio`, build `AsyncSDK` from the same config and `await` each call.

## Make a call

An operation's id is its method, with the last part in snake case (`tableTemplate.projectList`
is `anyrow.tableTemplate.project_list`). Path parameters come first, in path order, then the
body as a dictionary; query parameters are keyword arguments:

```python
page = anyrow.row.list("proj_...", "tbl_...", limit=50)

row = anyrow.row.create("proj_...", "tbl_...", {"vendor": "Acme", "total": 120})
```

Every method also takes `timeout=` and `headers=` for that one call.

## Errors

A failed call raises. Every error is an `APIError` with `status`, `message` and the parsed
[error body](/docs/errors) in `data`; each status has its own class:

```python
from anyrow import APIError, ForbiddenError

try:
    table = anyrow.table.get("proj_...", "tbl_...")
except ForbiddenError:
    print("The key lacks tables:read")
except APIError as error:
    print(error.status, error.data["error_key"])
```

The classes are `BadRequestError` (400), `UnauthorizedError` (401), `ForbiddenError` (403),
`NotFoundError` (404), `ConflictError` (409), `UnprocessableEntityError` (422),
`RateLimitError` (429), `InternalServerError` (500), `BadGatewayError` (502),
`ServiceUnavailableError` (503) and `GatewayTimeoutError` (504); any other status raises
`APIStatusError`.

## Read every row

```python
rows, cursor = [], None
while True:
    page = anyrow.row.list("proj_...", "tbl_...", limit=100, **({"cursor": cursor} if cursor else {}))
    rows += page["rows"]
    cursor = page["nextCursor"]
    if not cursor:
        break
```

## Extract a document

```python
with open("./invoice.txt") as invoice:
    batch = anyrow.extract.table.once("proj_...", "tbl_...", {"text": invoice.read()})
print(batch["status"], batch["result"])
```

## Stream an extraction

`AsyncSDK` streams the server-sent events as they arrive:

```python
import asyncio
import os

from anyrow import AsyncSDK, ClientConfig


async def main():
    anyrow = AsyncSDK(ClientConfig(
        base_url="https://api.anyrow.ai",
        bearer_token=os.environ["ANYROW_API_KEY"],
        auth_header_prefix="ApiKey ",
    ))
    async for event in anyrow.extract.table.stream("proj_...", "tbl_...", {"text": "Invoice 42 from Acme"}):
        print(event["event"], event["data"])


asyncio.run(main())
```

## Verify webhooks

Deliveries follow Standard Webhooks; verify them with the `standardwebhooks` package as the
[Webhooks guide](/docs/webhooks) shows.
