IG API POST /session/refresh-token
Exchange a refresh token from a version 3 login for a new access token and a new refresh token.
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.
The method, path, version, body and response fields were read on IG's own reference page on 12 Oct 2026. The page lists no request headers, so only the API key and version headers from IG's REST trading API guide are recorded. The guide says a refresh returns a new refresh token as well, and that refresh tokens also expire.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| VERSIONrequired | header | string | Endpoint version. Send 1. |
| refresh_tokenrequired | body | string | The refresh token from POST /session version 3, or from the last call here. Placeholder only: never paste a real token into this site. |
Authentication headers
| Name | Type | Description |
|---|---|---|
| X-IG-API-KEYrequired | string | Your API key, from your IG account settings. Placeholder only here. |
Request
Written from the method, path and parameters recorded on this page, against the demo host. Not executed against a live or demo account. Credentials are read from environment variables on your own machine and are never entered on this site. The request builder writes these same snippets, from the same record.
This call takes a request body. The samples send it as JSON with a Content-Type of application/json (in Python, passing json= sets that header) and a placeholder for each of the 1 body field the record marks as required. Each placeholder has to be replaced with a real value before the request can succeed.
Python
# Set IG_API_KEY, IG_REFRESH_TOKEN as environment variables first. Never paste real values into code.
import os
import requests
BASE_URL = "https://demo-api.ig.com/gateway/deal" # the demo host
headers = {
"X-IG-API-KEY": os.environ["IG_API_KEY"],
"VERSION": "1",
}
body = {"refresh_token": os.environ["IG_REFRESH_TOKEN"]}
resp = requests.post(BASE_URL + "/session/refresh-token", headers=headers, json=body, timeout=10)
resp.raise_for_status()
print(resp.json())JavaScript
// Set IG_API_KEY, IG_REFRESH_TOKEN as environment variables first. Never paste real values into code.
// Run as a module, for example a .mjs file, on a Node version that has fetch built in.
const BASE_URL = "https://demo-api.ig.com/gateway/deal"; // the demo host
const res = await fetch(BASE_URL + "/session/refresh-token", {
method: "POST",
headers: {
"X-IG-API-KEY": process.env.IG_API_KEY,
"VERSION": "1",
"Content-Type": "application/json",
},
body: JSON.stringify({"refresh_token": process.env.IG_REFRESH_TOKEN}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());curl
# Set IG_API_KEY, IG_REFRESH_TOKEN as environment variables first. Never paste real values into code.
curl -X POST "https://demo-api.ig.com/gateway/deal/session/refresh-token" \
-H "X-IG-API-KEY: $IG_API_KEY" \
-H "VERSION: 1" \
-H "Content-Type: application/json" \
-d "{\"refresh_token\": \"$IG_REFRESH_TOKEN\"}"Response
A mock response. The values are invented, so check field names against the official reference.
{
"_mock": true,
"access_token": "MOCK-ACCESS",
"refresh_token": "MOCK-REFRESH",
"scope": "profile",
"token_type": "Bearer",
"expires_in": "60"
}Limits that apply at IG
| Limit | Value | Scope | Source |
|---|---|---|---|
| Historical price data points a week | 10,000 | Per account, price history endpoints only | labs.ig.comchecked |
| Non trading requests a minute | 30 | Per account, non trading calls only | labs.ig.comchecked |
| Non trading requests a minute | 60 | Per application, that is per API key, non trading calls only | labs.ig.comchecked |
| Concurrent streaming subscriptions | 40 | Per streaming connection | labs.ig.comchecked corroborated by labs.ig.com/streaming-api-guide.html |
| Trading requests a minute | 100Sources conflict ig.com states around 40, checked . IG's own pages disagree. The conflict is labelled, not resolved. Pace against 40. | Per account, trading calls only | labs.ig.comchecked |
IG API errors you may meet
- error.security.account-access-deniedHTTP 401. The account has been denied login privileges.
- error.security.account-migratedHTTP 401. The account has been migrated to IG's client and account model.
- ACCOUNT_NOT_ENABLED_TO_TRADINGThe account is not enabled to trade.
- error.security.account-not-yet-activatedHTTP 401. The account has not been activated yet.
- error.security.account-suspendedHTTP 401. The account has been suspended.
- error.security.account-token-invalidHTTP 401. The endpoint needs an account token and the one sent was not valid.
All IG API error codes, including 126 more not listed here.