FxSocket Accounts API
Link MT4/MT5 accounts with a password and cTrader accounts with a cTrader sign-in; list and manage MT4, MT5 and cTrader accounts.
Link MT4/MT5 accounts with a password and cTrader accounts with a cTrader sign-in; list and manage MT4, MT5 and cTrader accounts.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/fxsocket-com:fxsocket-com-accounts-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Fxsocket Com Accounts API
x-refined-note:
- x-authored-by differs across the merged source definitions and was not carried
- x-engine differs across the merged source definitions and was not carried
- x-evidence-tiers differs across the merged source definitions and was not carried
- x-generated differs across the merged source definitions and was not carried
- x-generated-from differs across the merged source definitions and was not carried
- x-generator differs across the merged source definitions and was not carried
- x-provenance differs across the merged source definitions and was not carried
- x-sources differs across the merged source definitions and was not carried
version: '1.0'
description: 'Operations tagged Accounts across 3 of this provider''s published API definitions: fxsocket-com-openapi-original.yml, fxsocket-com-openapi-generated.yml, fxsocket-com-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.fxsocket.com/v1
- url: https://api.fxsocket.com
tags:
- name: Accounts
description: Link MT4/MT5 accounts with a password and cTrader accounts with a cTrader sign-in; list and manage MT4, MT5 and cTrader accounts.
paths:
/accounts:
get:
operationId: accounts_list
description: Every account this key may see. A named read-only key scoped to specific accounts lists only those; every other key lists all of them.
summary: List your linked accounts
tags:
- Accounts
security:
- ApiKeyAuth: []
responses:
'200':
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/V1Account'
description: ''
'401':
description: Missing or invalid API key.
post:
operationId: accounts_create
description: Links a trading account and provisions its terminal pod. `platform` is optional and defaults to `mt5` when omitted — pass `mt4` to link an MT4 account. The response `status` starts at `connecting`; poll `GET /accounts/{id}` until it reaches `connected`.
summary: Link a new account
tags:
- Accounts
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/V1CreateAccount'
required: true
security:
- ApiKeyAuth: []
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/V1Account'
description: ''
'400':
description: 'The broker refused the login or password while the call waited for the terminal (`invalid_credentials`), or the supplied outbound proxy was unreachable (`proxy_unreachable`). A refusal the terminal reports later shows up as `status: error` on `GET /accounts/{id}`.'
'401':
description: Missing or invalid API key.
'402':
description: Plan limit reached (`account_cap_reached`), balance too low to buy the next seat (`insufficient_balance`), seats lapsed so existing accounts are unseated (`seat_lapsed`), or no plan that permits linking (`no_subscription`).
'409':
description: This account is already linked.
servers:
- url: https://api.fxsocket.com/v1
/accounts/{id}:
get:
operationId: accounts_retrieve
description: 'Shared auth/permission/throttle config for the v1 surface.
API-key auth is wired EXPLICITLY here, never via
``DEFAULT_AUTHENTICATION_CLASSES`` — so the cookie-only dashboard and
admin APIs never start accepting API keys, and no CSRF is triggered
(only ``SessionAuthentication`` runs DRF''s CSRF check).'
summary: Get one account (poll for readiness)
parameters:
- in: path
name: id
schema:
type: string
format: uuid
required: true
tags:
- Accounts
security:
- ApiKeyAuth: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/V1Account'
description: ''
'401':
description: Missing or invalid API key.
'404':
description: No such account for this key.
patch:
operationId: accounts_partial_update
description: 'Changes the trade-EA host symbol (`trade_ea_symbol`) and/or the outbound proxy (`proxy_address`, `proxy_type`, `proxy_auth`; an empty `proxy_address` removes the proxy). A new proxy is verified first and refused with `proxy_unreachable` when it doesn''t work. The terminal restarts on the change right away. After a proxy change the request waits up to about 50 s for it to log in again and answers `connected`; if it takes longer it answers `connecting` — poll `GET /accounts/{id}` until `status` returns to `connected`. Other fields are immutable: different credentials or server mean a different broker account (unlink and relink instead).'
summary: Update an account
parameters:
- in: path
name: id
schema:
type: string
format: uuid
required: true
tags:
- Accounts
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PatchedV1UpdateAccount'
security:
- ApiKeyAuth: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/V1Account'
description: ''
'401':
description: Missing or invalid API key.
'404':
description: No such account for this key.
delete:
operationId: accounts_destroy
description: Disconnects the bridge, tears down the terminal pod, and deletes the account.
summary: Unlink an account
parameters:
- in: path
name: id
schema:
type: string
format: uuid
required: true
tags:
- Accounts
security:
- ApiKeyAuth: []
responses:
'204':
description: Deleted.
'401':
description: Missing or invalid API key.
'404':
description: No such account for this key.
servers:
- url: https://api.fxsocket.com/v1
/ctrader/sign-ins:
post:
operationId: ctrader_sign_ins_create
description: 'Starts a cTrader sign-in on FxSocket''s own cTrader application, for linking your users'' cTrader accounts without the FxSocket dashboard. Send the user''s browser to `authorize_url` (Spotware''s consent page, which names "FX Socket"). After they choose Allow or No, thanks, the browser goes to your `return_url` with `fxsocket_sign_in=&status=` added, or to an FxSocket page asking them to return to your app. Then read the result with `GET /ctrader/sign-ins/{id}` and link accounts with `POST /ctrader/sign-ins/{id}/accounts`.
The user has 10 minutes to finish the consent page. At most 20 sign-ins may wait at once, and 60 may be started per hour. Requires the full key.
Whoever holds your API key and gets someone to click Allow gets trading access to their cTrader accounts, so keep the key on your server.'
summary: Start a cTrader sign-in
tags:
- Accounts
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/V1CtraderSignInCreate'
examples:
WithAReturnURL:
value:
return_url: https://app.example.com/ctrader/done?user=812
summary: With a return URL
security:
- ApiKeyAuth: []
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/V1CtraderSignInCreated'
examples:
Created:
value:
id: 6f1c2b9e-4d3a-4f6e-9a51-2c7d8e0b1a34
authorize_url: https://id.ctrader.com/my/settings/openapi/grantingaccess/?client_id=26448_Xk3...&redirect_uri=https%3A%2F%2Fapp.fxsocket.com%2Fapi%2Fmt-accounts%2Fctrader%2Fcallback&scope=trading&product=web&state=fxs_si_...
status: pending
expires_at: '2026-11-22T14:10:00Z'
description: ''
'400':
description: '`return_url` is not https, carries user info or a fragment, is too long, or its origin is not allowed for you (`return_url_not_allowed`).'
'401':
description: Missing or invalid API key.
'403':
description: A read-only key (`fxs_ro_*`); these routes need the full key.
'404':
description: cTrader is not available to your account (`ctrader_unavailable`).
'429':
description: 20 sign-ins are already waiting (`sign_in_pending_limit`), or 60 were started in the last hour (`sign_in_hourly_limit`). `Retry-After` says when to try again.
servers:
- url: https://api.fxsocket.com/v1
/ctrader/sign-ins/{id}:
get:
operationId: ctrader_sign_ins_retrieve
description: How the sign-in went and, once `completed`, the trading accounts the user granted. Poll it after the browser came back to your `return_url`, or every few seconds while `pending`. A finished sign-in stays readable for 60 minutes; a day after it expired it answers 404. Requires the full key.
summary: Get a cTrader sign-in
parameters:
- in: path
name: id
schema:
type: string
format: uuid
required: true
tags:
- Accounts
security:
- ApiKeyAuth: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/V1CtraderSignIn'
examples:
Completed:
value:
id: 6f1c2b9e-4d3a-4f6e-9a51-2c7d8e0b1a34
status: completed
error: null
created_at: '2026-11-22T14:00:00Z'
expires_at: '2026-11-22T15:01:12Z'
accounts:
- ctrader_account_id: 49471004
login: 5958067
broker: IC Markets
live: false
account_type: hedged
currency: EUR
active: true
unavailable_reason: null
linked_account_id: null
- ctrader_account_id: 49471011
login: 5958070
broker: IC Markets
live: false
account_type: netted
currency: USD
active: true
unavailable_reason: null
linked_account_id: 0b8f3c52-7a1e-4c9d-8e2f-5d6a7b8c9d0e
Declined:
value:
id: 6f1c2b9e-4d3a-4f6e-9a51-2c7d8e0b1a34
status: denied
error: access_denied
created_at: '2026-11-22T14:00:00Z'
expires_at: '2026-11-22T15:00:40Z'
accounts: []
description: ''
'401':
description: Missing or invalid API key.
'403':
description: A read-only key (`fxs_ro_*`); these routes need the full key.
'404':
description: No sign-in with this id belongs to this key (`sign_in_not_found`), or cTrader is not available to your account (`ctrader_unavailable`).
servers:
- url: https://api.fxsocket.com/v1
/ctrader/sign-ins/{id}/accounts:
post:
operationId: ctrader_sign_ins_accounts_create
description: 'Links some or all of the accounts a completed sign-in granted, up to 50 per request, each at most once. Answers 200 with one result per account, in the order asked: `account` (status `connecting` or `connected`; poll `GET /accounts/{id}`) or `error` and `detail`, with the same plan, seat and duplicate rules as `POST /accounts`. An account already linked through this sign-in comes back as linked, so a request whose answer you lost can be sent again. Linking works for 60 minutes after the user came back. Requires the full key.'
summary: Link accounts of a cTrader sign-in
parameters:
- in: path
name: id
schema:
type: string
format: uuid
required: true
tags:
- Accounts
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/V1CtraderSignInLink'
examples:
TwoAccounts:
value:
accounts:
- ctrader_account_id: 49471004
nickname: Main
- ctrader_account_id: 49471011
summary: Two accounts
required: true
security:
- ApiKeyAuth: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/V1CtraderLinkResponse'
examples:
OneLinked,OneRefused:
value:
accounts:
- ctrader_account_id: 49471004
account:
id: 3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f
nickname: Main
platform: ctrader
server: IC Markets (demo)
login: 5958067
status: connected
error: ''
suspended: false
reauth_required: false
rest_url: https://api.fxsocket.com/ctrader/3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f
ws_url: wss://api.fxsocket.com/ctrader/3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f/ws
proxy_address: ''
proxy_type: ''
proxy_local_port: null
trade_ea_symbol: ''
created_at: '2026-11-22T14:02:03Z'
- ctrader_account_id: 49471011
error: account_cap_reached
detail: You have reached your plan limit of 5 accounts.
cap: 5
current: 5
summary: One linked, one refused
description: ''
'400':
description: An account id the sign-in did not grant (`ctrader_account_not_in_sign_in`, listed in `ctrader_account_ids`; nothing is linked), or an invalid body.
'401':
description: Missing or invalid API key.
'403':
description: A read-only key (`fxs_ro_*`); these routes need the full key.
'404':
description: No sign-in with this id belongs to this key (`sign_in_not_found`), or cTrader is not available to your account (`ctrader_unavailable`).
'409':
description: The sign-in is not completed (`sign_in_not_completed`, with its `status`), or Spotware no longer accepts it (`ctrader_reauth_required`). Start a new sign-in.
'410':
description: The sign-in has expired (`sign_in_expired`).
servers:
- url: https://api.fxsocket.com/v1
/v1/accounts:
get:
operationId: get_v1_accounts
tags:
- Accounts
summary: List accounts
description: 'Base URL: https://api.fxsocket.com'
x-source: https://fxsocket.com/docs/mt4
responses:
'200':
description: Success (status as documented)
x-evidence:
kind: documentation
security:
- apiKey: []
servers:
- url: https://api.fxsocket.com
components:
schemas:
V1CreateAccount:
type: object
description: 'Input payload for ``POST /v1/accounts``.
``platform`` is optional and defaults to ``mt5`` when omitted, so
integrations written before MT4 support keep linking MT5 accounts
unchanged. Pass ``"mt4"`` to link an MT4 account.
The optional ``proxy_*`` fields (from :class:`ProxyFieldsMixin`) route
this account''s terminal through an outbound proxy; the proxy is
verified before the account is created.'
properties:
proxy_address:
type: string
default: ''
maxLength: 255
proxy_type:
type: string
default: ''
maxLength: 8
proxy_auth:
type: string
writeOnly: true
default: ''
maxLength: 255
proxy_local_port:
type:
- integer
- 'null'
maximum: 65535
minimum: 1
platform:
allOf:
- $ref: '#/components/schemas/PlatformEnum'
default: mt5
description: 'Trading platform: ''mt4'' or ''mt5'' (default ''mt5''). cTrader accounts are linked with a cTrader sign-in instead: POST /ctrader/sign-ins.
* `mt4` - MT4
* `mt5` - MT5
* `ctrader` - cTrader'
server:
type: string
maxLength: 64
minLength: 1
login:
type: integer
minimum: 1
password:
type: string
writeOnly: true
maxLength: 128
minLength: 1
nickname:
type: string
default: ''
maxLength: 64
trade_ea_symbol:
type: string
default: ''
description: Chart symbol the terminal hosts its trade expert on, exactly as your broker names it (e.g. 'EURUSDm' on suffixed brokers). Leave empty to let the terminal pick one automatically.
maxLength: 32
required:
- login
- password
- server
V1CtraderLinkResult:
type: object
properties:
ctrader_account_id:
type: integer
account:
allOf:
- $ref: '#/components/schemas/V1Account'
description: The linked account (status `connecting` or `connected`). Absent on error.
error:
type: string
description: Absent when linked. Else `account_cap_reached`, `seat_lapsed`, `insufficient_balance`, `no_subscription`, `duplicate`, `ctrader_inactive`, `ctrader_live_not_allowed` or `ctrader_netting_not_allowed`.
detail:
type: string
required:
- ctrader_account_id
V1CtraderSignInCreated:
type: object
properties:
id:
type: string
format: uuid
description: Sign-in id. Read the result with GET /ctrader/sign-ins/{id}.
authorize_url:
type: string
format: uri
description: Spotware's consent page for FxSocket's cTrader application. Open it in your user's browser (a redirect or a new tab, not an iframe).
status:
$ref: '#/components/schemas/CtraderSignInStatusEnum'
expires_at:
type: string
format: date-time
description: The user has until then to finish the consent page.
required:
- authorize_url
- expires_at
- id
- status
V1Account:
type: object
description: 'Public representation of a linked trading account.
``status`` is the unified pod+bridge status
(``MtAccount.trading_status``) — connected / connecting /
disconnected / error — and ``error`` is the matching message.
``suspended`` tells an unpaid account apart from a dropped one: both
report ``disconnected``, but a suspended account stays down until it
is paid for and reconnected, and ``error`` then says why.
``rest_url`` / ``ws_url`` are where this account''s per-account terminal
API lives — the base URL for trading, market-data and account calls
(REST) and the streaming endpoint (WebSocket). Both are empty until the
account has a reachable terminal (shared pod or private droplet); a
bridge-only account never exposes one. Authenticate to both with the
same API key (``X-API-Key`` header for REST, ``?api_key=`` for WS).'
properties:
id:
type: string
format: uuid
readOnly: true
nickname:
type: string
readOnly: true
platform:
allOf:
- $ref: '#/components/schemas/PlatformEnum'
readOnly: true
server:
type: string
readOnly: true
login:
type: integer
readOnly: true
status:
type: string
readOnly: true
error:
type: string
readOnly: true
suspended:
type: boolean
readOnly: true
description: True while billing has suspended this account.
reauth_required:
type: boolean
readOnly: true
description: 'cTrader only: true when Spotware no longer accepts the account''s cTrader sign-in (access revoked in the cTrader ID settings). It stays down until the owner signs in again. Always false on MetaTrader accounts.'
rest_url:
type: string
readOnly: true
ws_url:
type: string
readOnly: true
proxy_address:
type: string
readOnly: true
proxy_type:
type: string
readOnly: true
proxy_local_port:
type:
- integer
- 'null'
readOnly: true
trade_ea_symbol:
type: string
readOnly: true
created_at:
type: string
format: date-time
readOnly: true
required:
- created_at
- error
- id
- login
- nickname
- platform
- proxy_address
- proxy_local_port
- proxy_type
- reauth_required
- rest_url
- server
- status
- suspended
- trade_ea_symbol
- ws_url
CtraderSignInStatusEnum:
enum:
- pending
- completed
- denied
- expired
- failed
type: string
description: '* `pending` - pending
* `completed` - completed
* `denied` - denied
* `expired` - expired
* `failed` - failed'
V1CtraderLinkItem:
type: object
properties:
ctrader_account_id:
type: integer
minimum: 1
description: Spotware's ctidTraderAccountId (accountId in /connect/tradingaccounts).
nickname:
type: string
default: ''
maxLength: 64
required:
- ctrader_account_id
V1CtraderSignInLink:
type: object
description: Input of ``POST /v1/ctrader/sign-ins/<id>/accounts``.
properties:
accounts:
type: array
items:
$ref: '#/components/schemas/V1CtraderLinkItem'
required:
- accounts
V1CtraderSignInAccount:
type: object
properties:
ctrader_account_id:
type: integer
description: Spotware's ctidTraderAccountId. Send it to POST /ctrader/sign-ins/{id}/accounts.
login:
type: integer
description: The account number the user knows.
broker:
type: string
live:
type: boolean
account_type:
type:
- string
- 'null'
description: '`hedged`, `netted`, or null when Spotware does not say.'
currency:
type:
- string
- 'null'
description: Deposit currency, null when unknown.
active:
type: boolean
description: False for an account the broker closed or deleted.
unavailable_reason:
type:
- string
- 'null'
description: 'Null when the account can be linked, else the error linking it would answer: `ctrader_inactive`, `ctrader_live_not_allowed` or `ctrader_netting_not_allowed`.'
linked_account_id:
type:
- string
- 'null'
format: uuid
description: Your FxSocket account id when this cTrader account is linked already, else null.
required:
- account_type
- active
- broker
- ctrader_account_id
- currency
- linked_account_id
- live
- login
- unavailable_reason
PlatformEnum:
enum:
- mt4
- mt5
- ctrader
type: string
description: '* `mt4` - MT4
* `mt5` - MT5
* `ctrader` - cTrader'
V1CtraderSignIn:
type: object
properties:
id:
type: string
format: uuid
status:
allOf:
- $ref: '#/components/schemas/CtraderSignInStatusEnum'
description: '`pending` until the user comes back from Spotware, then `completed`, `denied` (the user declined) or `failed`. A pending or completed sign-in past `expires_at` reads `expired`.
* `pending` - pending
* `completed` - completed
* `denied` - denied
* `expired` - expired
* `failed` - failed'
error:
type:
- string
- 'null'
description: 'Null, or why the sign-in did not complete: `access_denied`, `code_refused`, `token_refused`, `ctrader_unreachable`, `ctrader_refused`, `missing_code`, `ctrader_unavailable` or `internal_error`.'
created_at:
type: string
format: date-time
expires_at:
type: string
format: date-time
description: 'Pending: the deadline for the consent page (10 minutes). After the callback: how long the result stays readable and linkable (60 minutes).'
accounts:
type: array
items:
$ref: '#/components/schemas/V1CtraderSignInAccount'
description: The trading accounts the user granted. Empty unless `completed`.
required:
- accounts
- created_at
- error
- expires_at
- id
- status
V1CtraderLinkResponse:
type: object
properties:
accounts:
type: array
items:
$ref: '#/components/schemas/V1CtraderLinkResult'
required:
- accounts
V1CtraderSignInCreate:
type: object
description: Input of ``POST /v1/ctrader/sign-ins``.
properties:
return_url:
type: string
default: ''
description: Optional. Where the browser goes after the cTrader consent page, with `fxsocket_sign_in=<id>` and `status=<status>` added to the query. Must be https (http only for localhost), without user info or fragment, at most 2048 characters, on an origin FxSocket has allowed for you (localhost always works). Ask support to add your origin. Leave it out and the browser shows an FxSocket page that tells the user to go back to your app.
PatchedV1UpdateAccount:
type: object
description: 'Input payload for ``PATCH /v1/accounts/{id}``.
The trade-EA host symbol and the outbound proxy are mutable; send
either or both. Changing credentials or the server means a different
broker account (unlink + relink).'
properties:
proxy_address:
type: string
description: New outbound proxy as host:port, verified before it is used; an empty string removes the proxy (direct connection). The terminal restarts on the change.
maxLength: 255
proxy_type:
type: string
maxLength: 8
proxy_auth:
type: string
writeOnly: true
maxLength: 255
trade_ea_symbol:
type: string
description: New chart symbol for the terminal's trade expert, exactly as your broker names it. The terminal restarts on the new symbol within a few seconds; pass an empty string to revert to automatic selection.
maxLength: 32
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
description: 'Your fxsocket API key, e.g. `fxs_live_…`. `Authorization: Bearer <key>` is also accepted. A read-only key (`fxs_ro_…`) authenticates too, but only for GET endpoints — mutating requests return 403. Read-only keys you created with a name can additionally be scoped to specific accounts: everything outside the scope is invisible to them (absent from lists, `404` by id), including the private servers those accounts sit on.'
apiKey:
type: apiKey
in: header
name: X-API-Key
x-refined-from:
- fxsocket-com-openapi-original.yml
- fxsocket-com-openapi-generated.yml
- fxsocket-com-openapi.yml