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) require only client-id and client-secret. All other 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. 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 a user. Each connection includes connection_id, broker, type, and status. |
| 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 symbols (comma-separated). Each position includes symbol, quantity, average_price, last_price, unrealized_pl, daily_pl, and total_pl. |
Orders
| Method | Endpoint | Description |
| POST | /orders | Place an order. Required: account_id, cl_order_id (unique per day), broker, side, order_type, order_tif, instrument, symbol. For limit orders: order_limit_price. For stop orders: stop_price. For multi-leg options: instrument = MLEG_OPT, legs array. |
| GET | /orders | List orders. Filter by status (all, open, closed, filled, cancelled, partially_filled, working, rejected, pending, expired, replaced), symbols, side, start_time, end_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. |
| DELETE | /accounts/{account_id}/orders/{order_id} | Cancel an open order. |
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 Brokerage Data API (WebSocket)
Base URL: wss://stream.connecttrade.com. Authenticated using client_id and client_secret in the authenticate message. One active session per credential pair. Supports up to the platform's user limit per connection.
| 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, balances. Optionally filter by account_id or connection_id. |
order_update | Server → Client | Pushed when an order status changes. Contains the full normalized order object with current status, filled quantity, and fills array. |
position_update | Server → Client | Pushed when a position changes. Contains symbol, quantity, P&L fields. |
balance_update | Server → Client | Pushed when an account balance changes. Contains cash, buying power, and equity values. |
Updates are incremental. Fetch initial data snapshots via the REST API, then apply streaming updates. Implement reconnection logic: on disconnect, reconnect, re-authenticate, and resubscribe.
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. |
list_subscriptions | — | List all active subscriptions for the current connection. |
unsubscribe | — | Cancel one or more active subscriptions by channel and symbol. |
HTTP Status Codes
| Code | Meaning |
| 200 | Success. |
| 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 resource with the given identifier already exists (e.g. duplicate user_id or cl_order_id). |
| 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)