> ## 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.

# TypeScript SDK

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

## Install

```bash theme={"system"}
npm install @bronlabs/bron-sdk
```

## 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

```typescript theme={"system"}
import BronClient from '@bronlabs/bron-sdk';
import { randomUUID } from 'node:crypto';

const client = new BronClient({
  apiKey: process.env.BRON_API_KEY, // Your private JWK
  workspaceId: process.env.BRON_WORKSPACE_ID
});

// Get workspace
const workspace = await client.workspaces.getWorkspaceById();
console.log('Workspace:', workspace.name);

// Get accounts
const { accounts } = await client.accounts.getAccounts();

// Get balances for first account
if (accounts.length > 0) {
  const account = accounts[0];
  const { balances } = await client.balances.getBalances({
    accountIds: [account.accountId]
  });

  balances.forEach(balance => {
    console.log(`Balance ${balance.assetId} (${balance.symbol}):`, balance.totalBalance)
  });

  // Create a USDC withdrawal on Ethereum to a saved address-book record.
  const tx = await client.transactions.createTransaction({
    accountId: account.accountId,
    externalId: randomUUID(),
    transactionType: 'withdrawal',
    params: {
      amount: '100',
      assetId: '5000',
      networkId: 'ETH',
      toAddressBookRecordId: '<recordId>'
    }
  });

  console.log(`Created transaction '${tx.transactionId}': send ${tx.params.amount}`);
}
```

## Subscriptions (WebSocket)

Live subscriptions are not yet exposed in the TypeScript 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

All API methods return promises. The SDK throws on non-2xx responses with a structured error object that mirrors the API error envelope (`code`, `trace`, `details`):

```typescript theme={"system"}
try {
  const accounts = await client.accounts.getAccounts();
  console.log('Accounts:', accounts);
} catch (error) {
  console.error('API error:', error);
}
```

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

## Configuration

The `BronClient` constructor accepts:

* `apiKey` — private JWK as a JSON string (required).
* `workspaceId` — workspace ID (required).
* `baseUrl` — 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.

## 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.