Connect Trade API Reference
Complete reference for all Connect Trade REST and WebSocket endpoints. The interactive version is generated from the OpenAPI specification. The REST base URL is https://api.connecttrade.com. All requests must include client-id and client-secret headers; most also require user-id and user-secret.
Authentication
All REST API requests require four HTTP headers:
| Header | Description |
client-id | Your application's API client identifier, issued upon account approval. |
client-secret | Your application's API secret key, issued upon account approval. |
user-id | The identifier for an end user, provided by your application at user creation. |
user-secret | The secret token for the end user, returned by POST /users and stored by your application. |
Requests that operate at the platform level (user creation, listing users, and listing connections across the platform) require only client-id and client-secret. User-scoped requests require all four headers.
Users
| Method | Endpoint | Description |
| POST | /users | Create a new user. Request body: user_id (string). Response: user_id, user-secret (shown once — store securely). |
| GET | /users | List all users associated with your platform credentials. |
| DELETE | /users/{user_id} | Delete a user and all their connections. Requires client-id and client-secret only. |
Connections
| Method | Endpoint | Description |
| POST | /connections | Create a brokerage connection (HTTP 201). Required fields: user-id, user-secret, type (trade or market_data), redirect_url. Response: authorization_url to display to the user. |
| GET | /connections | List all brokerage connections for the authenticated user. Optional status filter accepts ACTIVE or BROKEN. Every returned connection requires a status field. A BROKEN connection has broker credentials the broker definitively rejected; recover by creating a new connection for the same broker and completing OAuth. |
| GET | /platform/connections | List connections for all platform users. Requires only client-id and client-secret. Optional status filter (ACTIVE/BROKEN); sorted newest first. Cursor pagination: limit 1–1000 (default 100), and either next_cursor or prev_cursor. Returns required data, next_cursor, and prev_cursor. |
| DELETE | /connections/{connection_id} | Delete a brokerage connection and revoke its associated tokens. |
| GET | /connections/{connection_id}/token | Generate a short-lived access token (24-hour TTL) for the Streaming Market Data API. Only one token is active per connection at a time. |
Accounts
| Method | Endpoint | Description |
| GET | /accounts | List all brokerage accounts for a user. Filter by connection_id or broker. Returns account_id, account_number, institution_name, and broker. The account_id is required for most trading and account endpoints. |
Balances
| Method | Endpoint | Description |
| GET | /balances | Retrieve cash, buying power, margin, and equity values for connected accounts. Filter by account_id or connection_id. All numeric fields are returned as strings. |
Positions
| Method | Endpoint | Description |
| GET | /positions | Retrieve current holdings for connected accounts. Filter by account_id, connection_id, or comma-separated symbols (equities, options, crypto pairs, and futures). URL-encode crypto slashes as %2F when necessary. Positions include symbol, quantity, position_average_price, last_price, unrealized_pl, daily_pl, and total_pl; futures positions use instrument: "FUT". |
Futures position example (with response field names matching the position schema):
{
"connection_id": "be573d69-eaad-4ed9-b864-645d43eccd24",
"account_id": "9a091a87-c499-466c-9793-786d6b71ec93",
"user_id": "newuse011",
"account_number": "CCC992771",
"broker_position_id": "6JZ26",
"symbol": "6JZ25",
"quantity": "1.000000000",
"last_price": "0.006389500",
"position_average_price": "0.006389500",
"unrealized_pl": "-79868.750000000",
"daily_pl": "0",
"total_pl": "-79868.750000000",
"instrument": "FUT",
"system_time": "2025-01-01T12:00:00.000000Z"
}
Orders
| Method | Endpoint | Description |
| POST | /orders | Place an order (HTTP 201). Required: account_id, cl_order_id (unique per day), broker, side, order_type, order_tif, and symbol; instrument is optional. For limit orders: order_limit_price. For stop orders: stop_price. For multi-leg options: instrument = MLEG_OPT, legs array. A broken connection returns 409 Conflict. |
| GET | /orders | List orders. Filter by connection_id, account_id, broker, status, comma-separated symbols (including futures and crypto; URL-encode crypto slashes as %2F when needed), side, start_time, and end_time. Sort via field:direction using entry_time, last_modified_time, or last_exec_time. Pagination: limit (1–500, default 50), next_cursor, prev_cursor. |
| PATCH | /accounts/{account_id}/orders/{order_id} | Modify an open order. Required: new_cl_order_id, broker. Optional: order_qty, order_notional, order_limit_price, stop_price. Broken connections return 409 Conflict. |
| DELETE | /accounts/{account_id}/orders/{order_id} | Cancel an open order. Broken connections return 409 Conflict. |
Order Types
| Code | Name | Description |
MKT | Market | Executes immediately at the current market price. |
LMT | Limit | Executes only at the specified price or better. Requires order_limit_price. |
STP | Stop | Becomes a market order when the stop price is reached. Requires stop_price. |
STPLMT | Stop-Limit | Becomes a limit order when the stop price is reached. Requires both stop_price and order_limit_price. |
Time in Force Values
| Code | Name | Description |
DAY | Day | Active until end of the regular trading session. |
GTC | Good Till Cancel | Active until filled or manually cancelled. |
IOC | Immediate or Cancel | Fill what is available immediately; cancel the remainder. |
FOK | Fill or Kill | Must fill the entire quantity immediately or cancel the whole order. |
OPEN | Market on Open | Executes at the opening auction price. |
CLOSE | Market on Close | Executes at the closing auction price. |
DAY+ | Day + Extended Hours | Active during both regular and extended trading hours for the session. |
GTC+ | GTC + Extended Hours | Active during regular and extended hours until filled or cancelled. |
Normalized Order Status Values
| Status | Description |
pending | Submitted but not yet acknowledged by the broker. |
working | Active and waiting to be filled. |
partially_filled | Part of the order has been filled; remainder is still working. |
filled | Completely filled. Includes a fills array with per-execution quantity, price, and time. |
cancelled | Cancelled by request or expired. |
rejected | Rejected by the broker. Check broker_message for the reason. |
expired | Expired without being filled (e.g. DAY order past session close). |
replaced | Replaced by a modified version of the order. |
pending_cancel | Cancel request submitted but not yet confirmed. |
pending_replace | Modify request submitted but not yet confirmed. |
Transactions
| Method | Endpoint | Description |
| GET | /transactions | Retrieve historical transaction activity. Filter by account_id, connection_id, start_date, and end_date. Returns transaction type, symbol, quantity, amount, and date. |
Streaming Broker API (WebSocket)
Base URL: wss://stream.connecttrade.com. Authenticate using client_id and client_secret within 30 seconds. Each client_id allows up to 10 concurrent sessions; each session can subscribe to up to 500 distinct platform users.
| Action | Direction | Description |
authenticate | Client → Server | Send client_id and client_secret within 30 seconds of connecting. |
subscribe | Client → Server | Subscribe to topics: orders, positions, or balances. |
subscribe_user | Client → Server | Subscribe this session to one platform user's updates. Required in addition to topic subscription. |
user_subscribed | Server → Client | Per-user subscription confirmation. |
unsubscribe_user | Client → Server | Release this session's subscription to one platform user. |
user_unsubscribed | Server → Client | Per-user unsubscription confirmation. |
orders | Server → Client | Pushed when an order changes for a subscribed user. |
positions | Server → Client | Pushed when positions change for a subscribed user. |
balances | Server → Client | Pushed when balances change for a subscribed user. |
Repeated subscribe_user or unsubscribe_user requests for the same session/user pair are no-ops. Exceeding 500 distinct users on a session returns subscription_failed. Disconnecting releases the session's per-user subscriptions; delivery continues until the last session subscribed to a user unsubscribes or disconnects. Updates are incremental: fetch initial data snapshots via the REST API, then apply streaming updates. On reconnect, re-authenticate, resubscribe to topics, and replay every desired subscribe_user request.
Streaming Market Data API (WebSocket)
Base URL: wss://mdstream.connecttrade.com. Authenticated using a short-lived access token generated via GET /connections/{connection_id}/token. Tokens are valid for 24 hours. One token active per connection at a time. Connect from the user's browser using the token. All subscriptions for a connection must originate from the same IP address.
| Action | Channel | Description |
subscribe | quotes | Real-time Level 1 bid/ask quotes and last trade price for specified symbols. |
subscribe | trades | Real-time time and sales data. Optional session_filter for regular or extended hours. |
subscribe | bars | Real-time OHLCV candlestick bars. Configurable interval (e.g. 1m, 5m, 1h, 1d). Optional historical backfill. |
subscribe | depth | Real-time Level 2 order book. Configurable number of price levels. |
subscribe | options_chain | Real-time options chain data. Optional Greeks (delta, gamma, theta, vega, rho). |
snapshot | bars | Request a historical OHLCV snapshot without a persistent subscription. The response type is snapshot_response; bar timestamps are Unix nanoseconds for bar start time, status is c (closed) or o (open), and each bar includes ev: "b" and sym. |
list_subscriptions | — | List all active subscriptions for the current connection. |
unsubscribe | — | Cancel one or more active subscriptions by channel and symbol. |
Market-data symbols include crypto in BASE/QUOTE form and futures in [ROOT][M][YY] form, for example BTC/USD and ESU26. Bars accept case-sensitive intervals with units m, h, d, w, M, and y; 4h and 240m are equivalent.
Example futures streaming subscription:
{
"action": "subscribe",
"channel": "bars",
"symbol": "ESU26",
"interval": "4h",
"request_id": "unique-request-id"
}
A historical bars snapshot request returns type snapshot_response. Each bar has ts (bar start in Unix nanoseconds), st (c closed or o open), ev: "b", and sym.
{
"type": "snapshot_response",
"request_id": "unique-request-id",
"symbol": "AAPL",
"data_type": "bars",
"interval": "1m",
"start_time": "2025-06-30T09:30:00Z",
"end_time": "2025-06-30T16:00:00Z",
"data": [
{
"o": "200",
"h": "201",
"l": "199.5",
"c": "200.37",
"v": "1500",
"ts": "1751275800000000000",
"st": "c",
"ev": "b",
"sym": "AAPL"
}
]
}
HTTP Status Codes
| Code | Meaning |
| 200 | Success. |
| 201 | Connection or order created. |
| 400 | Bad Request — malformed request body, missing required fields, or invalid field value. |
| 401 | Unauthorized — invalid credentials, missing headers, or insufficient entitlements for the requested operation. |
| 404 | Not Found — the specified resource (user, connection, account, or order) does not exist. |
| 409 | Conflict — a duplicate resource or an order create/replace/cancel request through a BROKEN connection. Create a new connection for the same broker and re-authenticate to recover. |
| 422 | Validation Error — invalid status, cursor, or limit query parameter; next_cursor and prev_cursor are mutually exclusive. |
| 500 | Internal Server Error — an unexpected error occurred on the Connect Trade platform side. |
All error responses return JSON with a message field describing the error.
API documentation |
Code cookbook (Python, JavaScript, Go, Rust) |
OpenAPI specification (JSON)