Broker API HubMenu

IG demo API key: how to get one and what it allows

IG does not hand out API keys from a standalone demo account. You need a live account, a demo account opened with the same email, and a separate key for demo. Here is the route, the two base URLs and the allowances you cannot raise.

Independent and unofficialChecked For: First time IG API users

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

  1. Start from a live account

    IG says API accounts cannot be created from a standalone demo account unless that demo is linked to a live account. Keys are generated under My IG, then Settings, then API.

    ig.comchecked

  2. Open a demo with the same email

    IG Labs answers the question directly: to get a demo API key, apply for another demo account and use the same email address as your live account. IG's API page repeats the same rule.

    labs.ig.comchecked

  3. Generate a separate demo key

    Demo needs its own key. A demo key sent to the live host, or the reverse, fails with error.security.api-key-invalid (HTTP 403), according to a trading-ig issue thread.

    github.comchecked

  4. Use the demo base URL

    Demo is https://demo-api.ig.com/gateway/deal and live is https://api.ig.com/gateway/deal. We read these from the community trading-ig client source because the IG Labs REST reference page blocks our fetcher.

    raw.githubusercontent.comchecked

  5. Know the allowances

    IG Labs publishes 60 non-trading requests per minute per app, 100 trading and 30 non-trading requests per minute per account, 10,000 historical price data points per week and 40 concurrent streaming subscriptions. IG says the limits cannot be increased.

    labs.ig.comchecked

  6. Expect lower limits on demo

    The trading-ig FAQ says demo limits are lower than live and have changed without notice. IG does not publish the demo numbers, so throttle below the live figures.

    trading-ig.readthedocs.iochecked

  7. Recognise the allowance errors

    trading-ig treats error.public-api.exceeded-api-key-allowance, exceeded-account-allowance and exceeded-account-trading-allowance as rate limit hits. The historical data allowance only resets once a week.

    raw.githubusercontent.comchecked

  8. Tokens die at the weekend

    IG Labs, the official source, says v2 session tokens stay valid for 12 hour intervals between calls, and all tokens are invalidated during weekend maintenance. v3 OAuth tokens are different: about a minute, community sourced. Log in again on a 401 rather than on a timer.

    labs.ig.comchecked

Sources

Sections