Broker API HubMenu

Broker API quickstarts: key to first API call

10 quickstarts. Each one walks from getting access to a first call, and each page says whether its steps have been run.

Independent and unofficialNewest check

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Every quickstart

In order of name. The order is not a ranking. The samples use placeholders only: no page on this site asks for a key, a username or a password.

QuickstartForStepsSample codeChecked
Capital.com: key to first call
Capital.com API quickstart: 2FA, API key, session, GET /accounts and a complete Python script for the demo host that keeps the session alive. Placeholder credentials only.
Capital.com
Broker API
7, of which 7 carry a sourcecurl, JavaScript, PythonCapital.com Public APIchecked
cTrader Open API Python quickstart
cTrader Open API in Python: register an app, get a token by OAuth or the Playground, install OpenApiPy and list your accounts on the demo host.
cTrader Open API
Platform API
7, of which 7 carry a sourcecurl, JavaScript, PythoncTrader Open APIchecked
Deriv API quickstart: token to first REST call
Make a first Deriv REST call: a health check with no credentials, then your Options accounts with a bearer token, in Python, JavaScript or curl. Deriv's trading and market data run over WebSocket and are not covered here. The samples were written from Deriv's documentation and have not been run against Deriv.
Deriv
Broker API
9, of which 9 carry a sourcecurl, JavaScript, PythonDeriv API: API overviewchecked
eToro API quickstart: user key to first call
eToro API quickstart: create a demo user key in Settings, send x-request-id, x-api-key and x-user-key, and call GET /api/v1/me. Sourced on eToro's own API portal, with the one step it does not document marked unverified.
eToro
Broker API
8, of which 7 carry a sourcecurl, PythonAuthentication, eToro API portalchecked
IG: key to first call
Make your first IG API call: demo host, session login and GET /accounts in Python, JavaScript and curl, using placeholder credentials only.
IG
Broker API
7, of which 6 carry a sourcecurl, JavaScript, Pythonig.comchecked
Interactive Brokers: paper account to first call
Connect to an IBKR paper account with ib_async or the Client Portal Web API: ports, API settings, account summary and free delayed data. Every step sourced.
Interactive Brokers
Broker API
6, of which 6 carry a sourcecurl, JavaScript, PythonIBKR TWS API documentation, TWS configuration for API usechecked
MetaTrader 5: Python to first call
Install MetaTrader5 on Windows, connect to a running terminal, pull ticks, bars and deal history, and send a demo order. Every step sourced.
MetaTrader 5 (Python package and MQL5)
Platform API
6, of which 5 carry a sourcePythonMQL5 docs: Python integrationchecked
OANDA v20: token to first call
Make your first OANDA v20 API call in Python, JavaScript or curl: personal token, practice host and account summary, using placeholder credentials only.
OANDA
Broker API
7, of which 7 carry a sourcecurl, JavaScript, Pythondeveloper.oanda.comchecked
Saxo OpenAPI quickstart: simulation account to first call
Saxo OpenAPI quickstart: a free simulation account, an app key, the 24 hour developer portal token, the SIM gateway URL and a first GET on /port/v1/users/me. Every step sourced on Saxo's own developer pages.
Saxo OpenAPI
Broker API
7, of which 7 carry a sourcecurl, PythonSaxo OpenAPI Learnchecked
Trading 212 API quickstart: practice key to first call
Make a first Trading 212 API call on the paper trading host: a key and secret, the Basic header and GET account summary in Python, JavaScript or curl. Each step is sourced on Trading 212's own pages. The samples were written from the documentation and have not been run against Trading 212.
Trading 212
Broker API
11, of which 11 carry a sourcecurl, JavaScript, PythonTrading 212 API docs: general information, environments and authenticationchecked

Before your first call

Start on a demo or paper account if the provider offers one, so that a mistake costs nothing. Keep keys and passwords out of your code and out of anything you share: read them from the environment or a secrets store.

A first call that fails is normal. The reply usually says why, and the error pages here decode the common ones.