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

> ## Agent Instructions
> Authenticate every request with `Authorization: ApiKey {jwt}`: an ES256 JWT signed with the user's private API key, whose header carries `kid` (the API key ID) and whose payload carries `iat` (Unix time in seconds) and `message`, the hex SHA-256 of `{iat}\n{METHOD}\n{PATH}\n{BODY}`. METHOD is uppercase, PATH includes the query string, BODY is the exact JSON sent or an empty string. Full steps: https://developer.bron.org/api-reference/authentication
> Prefer the official SDKs or the CLI, which sign every request: TypeScript `npm install @bronlabs/bron-sdk`, Go `go get github.com/bronlabs/bron-sdk-go`, Python `pip install git+https://github.com/bronlabs/bron-sdk-python.git`, CLI `brew install bronlabs/apps/bron`. Hand-write JWT signing only for a language without an SDK.
> The base URL is https://api.bron.org. Workspace data lives under `/workspaces/{workspaceId}/...`, and `/dictionary/...` serves reference data such as assets, networks and prices. Timestamps are milliseconds since the Unix epoch. Numeric values, amounts included, are strings: never parse them as floats.
> Never ask the user to paste their API key (the private JWK) into a chat and never hard-code it: read it from an environment variable or a secret store.

# Python SDK

> [card] GitHub
>
> [https://github.com/bronlabs/bron-sdk-python](https://github.com/bronlabs/bron-sdk-python)

## Install

Install directly from the GitHub repository:

```bash theme={"system"}
pip install git+https://github.com/bronlabs/bron-sdk-python.git
```

Or pin to a tag in `requirements.txt`:

```
bron-sdk-python @ git+https://github.com/bronlabs/bron-sdk-python.git@v0.2.4
```

## Authenticate

> [!NOTE]
>
> Need a JWK keypair? Install the [Bron CLI](https://developer.bron.org/sdk/cli.md) and run `bron config init --name default --workspace <workspaceId> --key-file ~/.config/bron/keys/me.jwk --generate-key` — it generates the JWK, stores it at `0600`, prints the public half to paste into the Bron UI, and registers the profile. Same key file works directly with the SDK via `BRON_API_KEY_FILE`.

```sh theme={"system"}
export BRON_API_KEY='{"kty":"EC","x":"VqW0Rzw4At***ADF2iFCzxc","y":"9AylQ7HHI0vRT0C***PqWuf2yT8","crv":"P-256","d":"DCQ0jrmYw8***9i64igNKuP0","kid":"cmdos3lj50000sayo6pl45zly"}'
export BRON_WORKSPACE_ID='htotobpkg7xqjfxenjid3n1o'
```

The SDK generates an ES256 JWT per request from your private JWK and sends it in `Authorization: ApiKey <jwt>`. No token caching, no revocation flow.

## Quickstart

All public API methods are async — use `await` (or `asyncio.run(...)`) and close with `await client.aclose()`.

```python theme={"system"}
import asyncio
import os
import uuid

from bron_sdk_python import BronClient
from bron_sdk_python.types.create_transaction import CreateTransaction
from bron_sdk_python.types.transaction_type import TransactionType


async def main() -> None:
    client = BronClient(
        api_key=os.environ["BRON_API_KEY"],
        workspace_id=os.environ["BRON_WORKSPACE_ID"],
    )

    ws = await client.workspaces.get_workspace_by_id()
    print(f"your workspace: {ws}")

    accounts = await client.accounts.get_accounts()
    print("accounts:")
    for a in accounts.get("accounts", []):
        print(f" - {a.get('accountId')} {a.get('accountName')}")
    if not accounts.get("accounts"):
        await client.aclose()
        return

    account_id = accounts["accounts"][0]["accountId"]

    balances = await client.balances.get_balances({"accountIds": [account_id], "limit": 5})
    print("balances (limit 5):")
    for b in balances.get("balances", []):
        print(f" - {b.get('assetId')} {b.get('symbol')} {b.get('totalBalance')}")

    # Create a USDC withdrawal on Ethereum to a saved address-book record.
    tx_body: CreateTransaction = {
        "accountId": account_id,
        "externalId": str(uuid.uuid4()),
        "transactionType": TransactionType.WITHDRAWAL.value,
        "params": {
            "amount": "100",
            "assetId": "5000",
            "networkId": "ETH",
            "toAddressBookRecordId": "<recordId>",
        },
    }
    tx = await client.transactions.create_transaction(tx_body)
    print(f"created tx: {tx.get('transactionId')}")

    await client.aclose()


if __name__ == "__main__":
    asyncio.run(main())
```

## Subscriptions (WebSocket)

Live subscriptions are not yet exposed in the Python SDK; they are available today in the [Golang SDK](https://developer.bron.org/sdk/golang.md#subscriptions-websocket) and will land here in a subsequent release. The wire protocol is identical (a subscription is "GET extended" — same query, server replays the historical match then streams live updates of the same response shape).

## Errors

Non-2xx responses raise a `BronAPIError` whose attributes mirror the API envelope (`code`, `trace`, `details`):

```python theme={"system"}
from bron_sdk_python import BronAPIError

try:
    await client.accounts.get_accounts()
except BronAPIError as e:
    print(f"api error code={e.code} trace={e.trace}")
```

Branch on `e.code` (stable identifier) — never on the human message. Quote `e.trace` in any user-facing report.

## Configuration

The `BronClient` constructor accepts:

* `api_key` — private JWK as a JSON string (required).
* `workspace_id` — workspace ID (required).
* `base_url` — API base URL (defaults to `https://api.bron.org`).
* `proxy` — `http://[user:pass@]host:port` for outbound requests through a corporate proxy. Standard `HTTPS_PROXY` / `HTTP_PROXY` env vars are honored too.

Methods accept typed query objects or compatible dicts.

## Where to next

> [card] [API reference](https://developer.bron.org/api-reference/getting-started.md)
>
> Endpoints, request/response shapes, OpenAPI spec.

> [card] [CLI overview](https://developer.bron.org/sdk/cli.md)
>
> `bron` binary — same auth, same data path, no client code.

> [card] [Errors & exit codes](https://developer.bron.org/sdk/cli/errors.md)
>
> Error envelope shape, stable codes, retry strategy.

> [card] [Authentication & profiles](https://developer.bron.org/sdk/cli/auth.md)
>
> Keypair lifecycle, env-var overrides, proxy setup, rotation.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.