Skip to main content

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.

Install

npm install @bronlabs/bron-sdk

Authenticate

Need a JWK keypair? Install the Bron CLI 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.
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

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 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):
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).
  • proxyhttp://[user:pass@]host:port for outbound requests through a corporate proxy. Standard HTTPS_PROXY / HTTP_PROXY env vars are honored too.

Where to next

API reference

Endpoints, request/response shapes, OpenAPI spec.

CLI overview

bron binary — same auth, same data path, no client code.

Errors & exit codes

Error envelope shape, stable codes, retry strategy.

Authentication & profiles

Keypair lifecycle, env-var overrides, proxy setup, rotation.