Browse documentation

API Reference

This page is for developers writing code against BrokerBridge's local API. If you just want to trade, you do not need it; see Help instead.

The local desktop service exposes JSON endpoints on http://127.0.0.1:8400. Use them to inspect health, setup, plans, positions, and activity without bypassing the product's protected execution path. Swagger UI is available at /docs.

These endpoints require the authenticated desktop app session when auth is enabled. Use the in-app Setup Wizard, Settings, and proposal controls for normal work. This public page does not provide bearer tokens or unauthenticated mutation commands.

Health

GET/api/health

System health check with service status.

response
{
  "status": "ok",
  "version": "0.1.0",
  "trading_loop_active": true,
  "services": {
    "api": "healthy",
    "ibkr": { "connected": true, "message": "" },
    "anthropic": { "connected": true, "message": "" }
  }
}

Setup

GET/api/setup/status

Check whether initial setup is complete.

POST/api/setup/config

Save configuration from the authenticated setup wizard session.

AI provider selection

BrokerBridge creates and manages the AI provider connection for you. There is no API key to create or manage. Pick a model and buy AI credits.

POST/api/credentials/test

Test connectivity to a selected AI provider through the authenticated desktop session.

POST/api/setup/provider

Save the selected AI provider configuration through the authenticated setup route. Managed-credit customers do not need to supply a provider API key.

GET/api/credentials/status

Get connection status for all providers.

response
{
  "providers": {
    "claude": "connected",
    "openai": "disconnected",
    "openrouter": "disconnected",
    "google": "disconnected",
    "xai": "disconnected",
    "ibkr": "connected"
  }
}
POST/api/credentials/ibkr/test

Test IB Gateway/TWS reachability through the authenticated desktop session. A reachable port is not an authenticated account; use the Setup Wizard or Settings diagnostics for identity verification.

Trade plans (proposals)

GET/api/proposals

List trade plans through the authenticated desktop session. Filter by status and date.

GET/api/proposals/{proposal_id}

Get a single trade plan with full details.

POST/api/proposals/{id}/approve

Approve with optional modifications through the authenticated in-app approval flow.

POST/api/proposals/{id}/reject

Reject with optional reason through the authenticated in-app proposal controls.

Positions

GET/api/positions

Get current open positions with unrealized P&L.

GET/api/positions/history

Get closed positions. Optional date filter.

Activity

GET/api/activity

Recent activity items (newest first, max 50).

GET/api/activity/stream

SSE stream for real-time updates. Heartbeats every 30s. Use the authenticated desktop session or a developer token when API auth is enabled.

python (authenticated developer session)
import os
import httpx

headers = {"Authorization": f"Bearer {os.environ['BB_API_BRIDGE_TOKEN']}"}
with httpx.stream("GET", "http://127.0.0.1:8400/api/activity/stream", headers=headers, timeout=None) as r:
    for line in r.iter_lines():
        if line.startswith("data: "):
            print(line[6:])

Webhooks

POST/api/webhooks/stripe

Stripe webhook for subscription events. Requires Stripe-Signature header.