cTrader APIOverview

For AI agents: this page is also available as Markdown at /docs/ctrader.md. The index of every docs page is /docs/llms.txt.

cTrader REST & WebSocket API

FxSocket exposes each linked cTrader account through a REST API and a WebSocket stream, with the same routes and JSON as MetaTrader 5. You link the account once with cTrader sign-in; FxSocket's cTrader bridge then keeps it connected to Spotware's Open API and serves your requests. All endpoints return JSON. Any cTrader account you can sign in to can be linked: demo or live, hedging or netting.

Per-account base URL: https://api.fxsocket.com/ctrader/{account_id}

{account_id} is the UUID of your linked cTrader account. Copy it from the Accounts page or read it from GET https://api.fxsocket.com/v1/accounts. Your API key lives on the API Key page.

You link an account on the dashboard: on the Accounts page choose Add account, then cTrader, and sign in with your cTrader ID. Listing and removing accounts also works programmatically through the account-management API at https://api.fxsocket.com/v1. See Managing Accounts.

How cTrader Differs From MT5 in This API

The routes and JSON shapes are the ones MT5 accounts use, so one client serves cTrader, MT4 and MT5 accounts alike, and the batch endpoints, the MCP server and outbound webhooks treat them the same. What differs is what cTrader itself does, and the bridge maps it in a documented way:

cTraderMetaTrader 5
Linking an accountcTrader sign-in on the dashboard; no password, not through POST /v1/accountsServer, login and password, on the dashboard or through POST /v1/accounts
Where it runsFxSocket's cTrader bridge on Spotware's Open API, connected within secondsA dedicated MT5 terminal per account, 1–3 minutes to start
Order types6: market, limit, stop8: adds BuyStopLimit and SellStopLimit
Stops on market ordersPlaced from the fill price; a slipped fill gets its exact levels a moment laterSent with the order
Pending ordersExpiry gtc or specifiedExpiry gtc, day, specified or specifiedDay
TimesReal UTC everywhereBroker server time, usually UTC+2 or UTC+3
SymbolsAll available at once, no Market WatchAdded to Market Watch on first use
Error codescTrader errors mapped to MT5 retcodesMT5's native retcodes
Margin calculatorcTrader's own, moved to the price you passMT5's built-in function, at the price you pass
Volume dataTick volume onlyReal volume where the broker provides it

Each topic page has a section on what this means in practice, for example stops on market orders and the cTrader error to retcode table.

Spotware's own cTrader Open API is what the bridge talks to: Protocol Buffers over a TLS socket, with an app registration, an OAuth token per trader, rate limits per connection and its own message ids to correlate. This API puts plain REST and WebSocket in front of it, with one API key for all your accounts.

Request builder

Fill in your account ID and API key, pick an endpoint, and copy a ready-to-run command. The API serves no CORS headers, so requests run from your terminal or server, not from this page.

curl -H "X-API-Key: fxs_live_YOUR_API_KEY" \
  "https://api.fxsocket.com/ctrader/YOUR_ACCOUNT_ID/AccountSummary"
Open in Swagger UI →Open the WS tester →

Swagger needs your account ID, the WS tester your account ID and API key. Both carry the key in the URL: Swagger scrubs it from the address bar, the WS tester keeps it in your browser history.

SDKs & generated clients

The official FxSocket SDKs wrap this API (account management, trading, market data, and live WebSocket streams) with typed models for cTrader, MT4 and MT5:

  • Python: pip install fxsocket, sync and async clients. PyPI · GitHub
  • Node.js / TypeScript: npm install @fxsocket/sdk, ESM and CommonJS. npm · GitHub

Using another language? The API is plain HTTP and JSON, and every account serves its own live OpenAPI 3 spec, so you can generate a typed client for any language instead:

  • Swagger UI: https://api.fxsocket.com/ctrader/{account_id}/swagger-ui/: browsable, per-account interactive docs (keep the trailing slash). No API key needed. Open yours from the request builder above.
  • Raw spec: https://api.fxsocket.com/ctrader/{account_id}/api-doc/openapi.json: point any OpenAPI generator (openapi-generator, openapi-typescript, oapi-codegen, …) at this URL.

These two routes (plus /) are the only ones served without an API key.