Connect Trade API Documentation

The Connect Trade API connects fintech applications to retail brokerage accounts through a single unified platform. It provides a normalized REST API and two WebSocket streaming APIs covering trading, account management, and real-time market data across 21 brokers through one integration.

Getting Started

The Connect Trade API provides three core capability areas:

To obtain API credentials, request access at connecttrade.com/contact. Upon approval you will receive a client-id and client-secret.

Overview

API Protocols

The Connect Trade API is JSON over REST and WebSocket. REST request methods can be GET, POST, DELETE, or PATCH and return JSON. WebSocket connections exchange two-way JSON messages.

All REST endpoints require client-id and client-secret headers. Most endpoints also require user-id and user-secret.

API Field Formats

All fields returned by the API are strings or booleans. Prices may be returned with up to 9 digits of precision to support cryptocurrency trading.

Creating and Authenticating Your First User

Step 1: Create a new user by sending a POST request to https://api.connecttrade.com/users with a user_id in the request body. Save the returned user-secret securely.

Step 2: Retrieve an authentication URL by sending a POST request to https://api.connecttrade.com/connections with the user-id, user-secret, connection type, and redirect_url. Each connection is user-broker specific. Connections are long-lived and do not need to be re-created each time a user logs in.

Step 3: Display the authentication URL to the user. When the user opens it, they see a list of available brokers, log in, select their account, and are redirected to your redirect_url. Error details are passed as URL parameters when applicable.

Endpoints

Single Environment

Connect Trade provides a single production environment for all API access. There are no separate sandbox, staging, or QA environments. For development and testing, connect a paper trading account at a supported broker.

REST API

Base URL: https://api.connecttrade.com. Protocol: HTTPS (JSON over REST). Methods: GET, POST, PATCH, DELETE. Authentication: client-id and client-secret headers on all endpoints; most also require user-id and user-secret.

The REST API is used for all account management, trading, and data retrieval operations including user creation, connection management, order placement, and querying balances, positions, and transactions.

Streaming Brokerage Data API (WebSocket)

Base URL: wss://stream.connecttrade.com. Protocol: WebSocket (JSON messages). Authentication: client_id and client_secret sent via an authenticate message. One active session allowed per credential pair.

The Streaming Brokerage Data API provides real-time push updates for orders, positions, and account balances across all connected broker accounts.

Streaming Market Data API (WebSocket)

Base URL: wss://mdstream.connecttrade.com. Protocol: WebSocket (JSON messages). Authentication: per-user access token from GET /connections/{connection_id}/token, valid 24 hours.

The Streaming Market Data API provides real-time streaming market data sourced from the user's connected broker, including Level 1 quotes, trades, OHLCV bars, depth of book (Level 2), and options chains.

Paper Trading

Most brokers offer paper trading (simulated) accounts. Paper trading accounts behave identically to production accounts from the Connect Trade API perspective: same OAuth flow, request/response formats, headers, endpoints, and error handling. Executions are simulated and may not perfectly reflect live market behavior.

No special flag or parameter is required to indicate paper versus production. When the user opens the OAuth URL, both paper and production accounts appear side by side. The distinction is made entirely by the account the user selects during OAuth. Any code written and tested against a paper account works without modification when switching to production.

Trading

Prerequisites

Before placing orders: you need a client-id and client-secret; a user created via POST /users; a brokerage connection with connection type trade; and trading entitlement on your Connect Trade account.

Placing Orders

All orders are placed via POST /orders. Common parameters: account_id, cl_order_id (unique per order per day), broker (e.g. ALPACA, WEBULL), side, order_type, order_tif, symbol, and optionally instrument.

Order Types

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

Time in Force

CodeNameDescription
DAYDayActive until end of the regular trading day.
GTCGood Till CancelActive until filled or manually cancelled.
IOCImmediate or CancelExecutes immediately; any unfilled portion is cancelled.
FOKFill or KillMust fill the entire order immediately or it is cancelled.
OPENMarket on OpenExecutes at the market open.
CLOSEMarket on CloseExecutes at the market close.
DAY+Day + Extended HoursActive during regular and extended hours for the day.
GTC+GTC + Extended HoursActive during regular and extended hours until filled or cancelled.

Order Side

For equities: BUY, SELL, SELL_SHORT. TradeStation uses BUY_TO_COVER for equity buy orders that close a short position.

For options (single-leg and multi-leg): BUY_TO_OPEN, BUY_TO_CLOSE, SELL_TO_OPEN, SELL_TO_CLOSE.

Market Order Example

Buy 1 share of MSFT at the current market price: POST to https://api.connecttrade.com/orders with body: account_id, cl_order_id, broker "ALPACA", side "BUY", order_qty "1", order_type "MKT", order_tif "DAY", instrument "STK", symbol "MSFT".

Single-Leg Option Order

Options symbols use OCC OSI format. Example: buy 1 TSLA call contract (strike $437.50, expiring Oct 31 2025) at limit $13.50: broker "WEBULL", side "BUY_TO_OPEN", order_qty "1", order_type "LMT", order_limit_price "13.50", order_tif "GTC", instrument "OPT", symbol "TSLA251031C00437500".

Multi-Leg Options Orders

Multi-leg orders allow executing options strategies with 2 to 4 legs. Set instrument to MLEG_OPT and symbol to null. Each leg in the legs array specifies symbol (OCC format), action, and ratio. Supported strategies include bull call spreads, bear put spreads, long straddles, iron condors, and ratio spreads.

Modifying and Cancelling Orders

To modify an open order: PATCH /accounts/{account_id}/orders/{order_id} with a new new_cl_order_id, broker, and the fields to update (order_qty, order_notional, order_limit_price, stop_price).

To cancel an open order: DELETE /accounts/{account_id}/orders/{order_id}.

Order Status Reference

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.
cancelledCancelled.
rejectedRejected by the broker.
expiredExpired without being filled.
replacedReplaced by a modified order.
pending_cancelCancel request submitted, not yet confirmed.
pending_replaceModify request submitted, not yet confirmed.

These are normalized statuses. Connect Trade maps each broker's native statuses into this common set. The original broker status is also available in the broker_status field.

Account Details

Use GET /accounts to retrieve all brokerage accounts for a user (filter by connection_id or broker). The returned account_id is used to query balances, positions, orders, and transactions.

Use GET /balances to retrieve cash, buying power, and margin information. Filter by account_id or connection_id. All numeric values are returned as strings.

Use GET /positions to retrieve current holdings. Filter by account_id, connection_id, or symbols (comma-separated). Each position includes P&L fields: unrealized_pl, daily_pl, and total_pl.

Use GET /orders to retrieve order history. Filter by status (all, open, closed, filled, cancelled, and more), symbols, side, start_time/end_time, and sort. Limit is 1 to 500 (default 50); use next_cursor and prev_cursor for pagination. Defaults to open orders from midnight UTC of the current day when no parameters are specified.

Use GET /transactions to retrieve historical transaction activity. Filter by account_id, connection_id, and date range using start_date and end_date.

Streaming Overview

Connect Trade provides two separate WebSocket streaming APIs. The Streaming Market Data API (wss://mdstream.connecttrade.com) pushes live market data from the user's connected broker — designed to connect from the client side using a short-lived access token. The Streaming Brokerage Data API (wss://stream.connecttrade.com) pushes live account updates for all users on a single server-side connection authenticated with platform credentials.

Streaming Brokerage Data API

The Streaming Brokerage Data API delivers real-time order, position, and balance updates across all user accounts over a single WebSocket connection. Connection workflow: connect to wss://stream.connecttrade.com, receive a welcome message, send an authenticate message with client_id and client_secret within 30 seconds, then send a subscribe message for desired topics (orders, positions, balances).

Updates are incremental, not full snapshots. Each update contains only the changed order, position, or balance. Fetch initial snapshots via the REST API, then apply incremental updates from the WebSocket. Reconnection logic is required: if the connection drops, reconnect, re-authenticate, and resubscribe.

Streaming Market Data API

Market data is sourced directly from the user's connected broker with no additional licensing fees from Connect Trade, as long as the user is authorized for the data at their broker.

Important restrictions: (1) one broker connection at a time per user for market data, (2) all WebSocket subscriptions for a user's connection must originate from the same IP address due to market data licensing requirements. The recommended architecture is to connect directly from the user's browser using a short-lived access token generated on the server.

Generate an access token: GET https://api.connecttrade.com/connections/{connection_id}/token. Tokens are valid for 24 hours; only one token is active per connection at a time. Connect to wss://mdstream.connecttrade.com and authenticate within 30 seconds.

Available subscription channels: quotes (Level 1 real-time bid/ask), trades (time and sales with session filter), bars (OHLCV candlestick data with configurable interval and optional historical backfill), depth (Level 2 order book with configurable price levels), and options_chain (real-time options chain data with optional Greeks).

Manage subscriptions with list_subscriptions and unsubscribe actions. Request historical bar snapshots without a persistent subscription using the snapshot action.

Common Workflows

Calculate total unrealized P&L: fetch all positions with GET /positions and sum the unrealized_pl field, parsing values from strings to floats. Handle null values per broker.

List partially filled orders: use GET /orders?status=partially_filled. Each order includes a fills array with individual executions (time, quantity, price, fill_id).

Calculate average fill price: retrieve orders with GET /orders filtered by status and symbol. Compute the volume-weighted average fill price from the fills array.

Get a daily P&L summary: combine GET /balances for cash and buying power with GET /positions for per-symbol daily P&L via the daily_pl field.

Debugging OAuth Issues

Most OAuth issues during development are caused by the redirect_url not being reachable from the user's browser. Common causes: redirect URL points to localhost or an internal address, domain not yet deployed, HTTP instead of HTTPS, or firewall blocking inbound traffic.

To isolate OAuth from redirect issues: create a test user via POST /users, create a connection with redirect_url set to https://www.google.com, complete the OAuth flow in a browser, and inspect the resulting URL. A connection_id query parameter confirms OAuth succeeded. An error parameter with error_details identifies the OAuth failure. Clean up test users with DELETE /users/{user_id}.

Error Responses

All REST API errors return JSON with a message field. Status codes: 200 (success), 400 Bad Request (malformed request or invalid data), 401 Unauthorized (authentication issue or entitlement issue), 404 Not Found (resource does not exist), 409 Conflict (resource already exists), 500 Internal Server Error (Connect Trade side issue).

Broker Codes

Broker codes are case-insensitive values used in the broker field throughout the API.

BrokerCode
AlpacaALPACA
Bank of AmericaBANKOFAMERICA
Capital OneCAPITALONE
ChaseCHASE
CitiCITI
FidelityFIDELITY
LightspeedLIGHTSPEED
PNCPNC
PublicPUBLIC
TastytradeTASTYTRADE
TDTD
TradeStationTRADESTATION
TradeZeroTRADEZERO
US BankUSBANK
WebullWEBULL
Wells FargoWELLSFARGO

Symbology

Equities (CQS)

Connect Trade uses the NYSE Consolidated Quote System (CQS) symbology for US equities. Common stocks use standard ticker symbols (e.g. AAPL, MSFT, TSLA). Other equity classes use suffixes: preferred stock uses a "p" suffix (e.g. IBMp), class shares use a slash (e.g. IBM/B), rights use "r" (e.g. IBMr), warrants use "/WS" (e.g. IBM/WS), and when-issued shares use "w" (e.g. IBMw).

Options (OCC OSI)

Connect Trade uses the OCC Options Symbology Initiative (OSI) format for US options. The format encodes the underlying symbol, expiration date, put/call type, and strike price into a single string: {root}{YYMMDD}{C|P}{strike padded to 8 digits with 3 decimal places}.

Examples: TSLA251031C00437500 (TSLA call, Oct 31 2025, $437.50 strike), AAPL241018P00190000 (AAPL put, Oct 18 2024, $190.00 strike), SPY241018C00430000 (SPY call, Oct 18 2024, $430.00 strike).

Developer Resources

The Connect Trade API is a normalized REST and WebSocket API for trading, account connectivity, and streaming market data across 21 brokers. REST base URL is https://api.connecttrade.com. Streaming Brokerage Data API base URL is wss://stream.connecttrade.com. Streaming Market Data API base URL is wss://mdstream.connecttrade.com. Supported order types include market, limit, stop, and stop-limit. Supported time in force values include DAY, GTC, IOC, FOK, OPEN, CLOSE, DAY+, and GTC+. Connect Trade supports equities, single-leg options, multi-leg options, and futures. Multi-leg options strategies include bull call spreads, bear put spreads, long straddles, iron condors, and ratio spreads. Equities use CQS symbology. Options use OCC OSI format. The Connect Trade OpenAPI specification is available at https://connecttrade.com/openapi.json and is compatible with AI coding assistants including ChatGPT, Claude, Gemini, GitHub Copilot, and Cursor. LLMs.txt is available at https://connecttrade.com/llms.txt. LLMs-full.txt is available at https://connecttrade.com/llms-full.txt. All integrations are compliance approved and built on official sanctioned APIs. Connect Trade does not use screen scraping or reverse engineering.

Frequently asked questions about Connect Trade broker integrations and API capabilities | Full broker integration list and API capability matrix | Connect Trade case studies