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, and listing connections across the platform) require only client-id and client-secret. User-scoped 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 (HTTP 201). 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 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/connectionsList 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}/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 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

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

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 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.

ActionDirectionDescription
authenticateClient → ServerSend client_id and client_secret within 30 seconds of connecting.
subscribeClient → ServerSubscribe to topics: orders, positions, or balances.
subscribe_userClient → ServerSubscribe this session to one platform user's updates. Required in addition to topic subscription.
user_subscribedServer → ClientPer-user subscription confirmation.
unsubscribe_userClient → ServerRelease this session's subscription to one platform user.
user_unsubscribedServer → ClientPer-user unsubscription confirmation.
ordersServer → ClientPushed when an order changes for a subscribed user.
positionsServer → ClientPushed when positions change for a subscribed user.
balancesServer → ClientPushed 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.

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. 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

CodeMeaning
200Success.
201Connection or order created.
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 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.
422Validation Error — invalid status, cursor, or limit query parameter; next_cursor and prev_cursor are mutually exclusive.
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)