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:

HeaderDescription
client-idYour application's API client identifier, issued upon account approval.
client-secretYour application's API secret key, issued upon account approval.
user-idThe identifier for an end user, provided by your application at user creation.
user-secretThe 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

MethodEndpointDescription
POST/usersCreate a new user. Request body: user_id (string). Response: user_id, user-secret (shown once — store securely).
GET/usersList 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

MethodEndpointDescription
POST/connectionsCreate 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/connectionsList 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}/tokenGenerate 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

MethodEndpointDescription
GET/accountsList 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

MethodEndpointDescription
GET/balancesRetrieve 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

MethodEndpointDescription
GET/positionsRetrieve 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

MethodEndpointDescription
POST/ordersPlace 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/ordersList 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

CodeNameDescription
MKTMarketExecutes immediately at the current market price.
LMTLimitExecutes only at the specified price or better. Requires order_limit_price.
STPStopBecomes a market order when the stop price is reached. Requires stop_price.
STPLMTStop-LimitBecomes a limit order when the stop price is reached. Requires both stop_price and order_limit_price.

Time in Force Values

CodeNameDescription
DAYDayActive until end of the regular trading session.
GTCGood Till CancelActive until filled or manually cancelled.
IOCImmediate or CancelFill what is available immediately; cancel the remainder.
FOKFill or KillMust fill the entire quantity immediately or cancel the whole order.
OPENMarket on OpenExecutes at the opening auction price.
CLOSEMarket on CloseExecutes at the closing auction price.
DAY+Day + Extended HoursActive during both regular and extended trading hours for the session.
GTC+GTC + Extended HoursActive during regular and extended hours until filled or cancelled.

Normalized Order Status Values

StatusDescription
pendingSubmitted but not yet acknowledged by the broker.
workingActive and waiting to be filled.
partially_filledPart of the order has been filled; remainder is still working.
filledCompletely filled. Includes a fills array with per-execution quantity, price, and time.
cancelledCancelled by request or expired.
rejectedRejected by the broker. Check broker_message for the reason.
expiredExpired without being filled (e.g. DAY order past session close).
replacedReplaced by a modified version of the order.
pending_cancelCancel request submitted but not yet confirmed.
pending_replaceModify request submitted but not yet confirmed.

Transactions

MethodEndpointDescription
GET/transactionsRetrieve 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.

ActionDirectionDescription
authenticateClient → ServerSend client_id and client_secret within 30 seconds of connecting.
subscribeClient → ServerSubscribe to topics: orders, positions, balances. Optionally filter by account_id or connection_id.
order_updateServer → ClientPushed when an order status changes. Contains the full normalized order object with current status, filled quantity, and fills array.
position_updateServer → ClientPushed when a position changes. Contains symbol, quantity, P&L fields.
balance_updateServer → ClientPushed 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.

ActionChannelDescription
subscribequotesReal-time Level 1 bid/ask quotes and last trade price for specified symbols.
subscribetradesReal-time time and sales data. Optional session_filter for regular or extended hours.
subscribebarsReal-time OHLCV candlestick bars. Configurable interval (e.g. 1m, 5m, 1h, 1d). Optional historical backfill.
subscribedepthReal-time Level 2 order book. Configurable number of price levels.
subscribeoptions_chainReal-time options chain data. Optional Greeks (delta, gamma, theta, vega, rho).
snapshotbarsRequest a historical OHLCV snapshot without a persistent subscription.
list_subscriptionsList all active subscriptions for the current connection.
unsubscribeCancel one or more active subscriptions by channel and symbol.

HTTP Status Codes

CodeMeaning
200Success.
400Bad Request — malformed request body, missing required fields, or invalid field value.
401Unauthorized — invalid credentials, missing headers, or insufficient entitlements for the requested operation.
404Not Found — the specified resource (user, connection, account, or order) does not exist.
409Conflict — a resource with the given identifier already exists (e.g. duplicate user_id or cl_order_id).
500Internal 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)