Demo vs live: the mix-up that breaks most first logins
Demo and live usually mean different hosts, and often different keys or usernames. Send one to the other and you get an authentication error that looks like a typo. Here is what to check, broker by broker.
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.
Steps
IG: two hosts
Demo is https://demo-api.ig.com/gateway/deal and live is https://api.ig.com/gateway/deal. Your code must point at the one your credentials belong to.
ig.comchecked
IG: two keys
Demo needs its own API key, and a demo account must use the same email as your live account. A demo key sent to live (or the reverse) fails with error.security.api-key-invalid, HTTP 403.
github.comchecked
IG: no mixing
Demo and live usernames and passwords cannot be mixed either, according to the trading-ig FAQ.
trading-ig.readthedocs.iochecked
OANDA: host must match token and account
Practice uses api-fxpractice.oanda.com and live uses api-fxtrade.oanda.com. "Insufficient authorization to perform request" usually means the host does not match your token or account.
help.oanda.comchecked
OANDA: check the account ID
OANDA account IDs look like xxx-xxx-xxxxxxx-xxx. A wrong or partial ID is worth ruling out before you regenerate anything.
help.oanda.comchecked
Capital.com: separate demo host
Demo calls go to https://demo-api-capital.backend-capital.com/ and live to https://api-capital.backend-capital.com/. Demo also caps POST /positions and /workingorders at 1000 per hour.
open-api.capital.comchecked
Capital.com: keys
We could not confirm whether one API key works on both demo and live. Capital.com's help centre has an article titled "Can I use Capital.com API on the Demo account?".
Unverifiedhelp.capital.com
IBKR: paper is a different login and port
Paper trading uses its own paper username. IBKR's older setup guide gives the TWS default ports as 7496 live and 7497 paper. This site also holds 4001 live and 4002 paper for IB Gateway, which were not found on the IBKR pages read on 12 October 2026.
interactivebrokers.github.iochecked
IBKR: demo data
IBKR says demo accounts cannot subscribe to market data, so an empty price feed on demo is expected, not a bug.
interactivebrokers.comchecked
Sources
- IG: how to use the IG APIchecked
- trading-ig issue 249: api-key-invalid after switching to livechecked
- trading-ig FAQ (community)checked
- OANDA help: REST v20 API troubleshooting guidechecked
- Capital.com Public APIchecked
- Capital.com help centre: API sectionchecked
- TWS API guide: initial setup (legacy docs)checked
- IBKR Web API v1.0 documentation, requirements and limitationschecked
- IBKR Web API documentation, using a paper accountchecked