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.
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:
| cTrader | MetaTrader 5 | |
|---|---|---|
| Linking an account | cTrader sign-in on the dashboard; no password, not through POST /v1/accounts | Server, login and password, on the dashboard or through POST /v1/accounts |
| Where it runs | FxSocket's cTrader bridge on Spotware's Open API, connected within seconds | A dedicated MT5 terminal per account, 1–3 minutes to start |
| Order types | 6: market, limit, stop | 8: adds BuyStopLimit and SellStopLimit |
| Stops on market orders | Placed from the fill price; a slipped fill gets its exact levels a moment later | Sent with the order |
| Pending orders | Expiry gtc or specified | Expiry gtc, day, specified or specifiedDay |
| Times | Real UTC everywhere | Broker server time, usually UTC+2 or UTC+3 |
| Symbols | All available at once, no Market Watch | Added to Market Watch on first use |
| Error codes | cTrader errors mapped to MT5 retcodes | MT5's native retcodes |
| Margin calculator | cTrader's own, moved to the price you pass | MT5's built-in function, at the price you pass |
| Volume data | Tick volume only | Real 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"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.
Explore the cTrader API
Authentication
API keys: header or query parameter.
Managing accounts
Link with cTrader sign-in, list and remove via /v1.
Account data
Balances, positions, history, and connection status.
Market data
Symbols, quotes, price history, and contract specs.
Trading
Place, modify, and close orders.
WebSocket streams
Live ticks, bars, positions, trades, and pending orders.
Errors & rate limits
Error codes, safe retries, and rate limits.
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.