API Reference
BrokerBridge exposes a REST API on http://localhost:8080. All endpoints return JSON. Swagger UI is available at /docs.
Health
/api/healthSystem health check with service status.
{
"status": "ok",
"version": "0.1.0",
"trading_loop_active": true,
"services": {
"api": "healthy",
"ibkr": { "connected": true, "message": "" },
"anthropic": { "connected": true, "message": "" }
}
}Setup
/api/setup/statusCheck whether initial setup is complete.
/api/setup/configSave configuration from setup wizard.
curl -X POST http://localhost:8080/api/setup/config \
-H "Content-Type: application/json" \
-d '{
"ai_provider": { "provider": "claude", "auth_type": "api_key" },
"broker": { "host": "127.0.0.1", "port": 4002, "client_id": 1 },
"risk": { "max_position_size_pct": 5.0, "max_open_trades": 5 },
"trading_mode": "paper"
}'Credentials
/api/credentials/testTest a credential without saving it.
curl -X POST http://localhost:8080/api/credentials/test \
-H "Content-Type: application/json" \
-d '{"provider": "claude", "auth_type": "api_key", "credential": "sk-ant-..."}'/api/credentials/saveSave credential to encrypted keyring storage.
/api/credentials/statusGet connection status for all providers.
{
"providers": {
"claude": "connected",
"openai": "disconnected",
"openrouter": "disconnected",
"google": "disconnected",
"ibkr": "connected"
}
}/api/credentials/{provider}Remove stored credential. Valid: claude, openai, openrouter, google, ibkr.
/api/credentials/ibkr/testTest IB Gateway/TWS connection.
curl -X POST http://localhost:8080/api/credentials/ibkr/test \
-H "Content-Type: application/json" \
-d '{"host": "127.0.0.1", "port": 4002, "client_id": 1}'Proposals
/api/proposalsList trade proposals. Filter by status and date.
curl "http://localhost:8080/api/proposals?status=pending"
/api/proposals/{proposal_id}Get a single proposal with full details.
/api/proposals/{id}/approveApprove with optional modifications.
curl -X POST http://localhost:8080/api/proposals/prp-abc123/approve \
-H "Content-Type: application/json" \
-d '{"final_size": 40, "final_stop": 184.00}'/api/proposals/{id}/rejectReject with optional reason.
curl -X POST http://localhost:8080/api/proposals/prp-abc123/reject \
-H "Content-Type: application/json" \
-d '{"reason": "Market too volatile"}'Positions
/api/positionsGet current open positions with unrealized P&L.
/api/positions/historyGet closed positions. Optional date filter.
Activity
/api/activityRecent activity items (newest first, max 50).
/api/activity/streamSSE stream for real-time updates. Heartbeats every 15s.
import httpx
with httpx.stream("GET", "http://localhost:8080/api/activity/stream") as r:
for line in r.iter_lines():
if line.startswith("data: "):
print(line[6:])Webhooks
/api/webhooks/stripeStripe webhook for subscription events. Requires Stripe-Signature header.