IG API GET /positions
All open positions on the active account, each with its market snapshot.
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 and parameters were re-read on IG's own reference page on 12 Oct 2026. That page lists no request headers: the headers recorded here are the general ones in IG's REST trading API guide (labs.ig.com/rest-trading-api-guide.html), read the same day. The mock reply is carried over from an earlier reading and was not compared field by field with the page. IG's own Java sample (RestAPI.java on GitHub, read the same day and marked deprecated) uses the same path.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| VERSIONrequired | header | string | Endpoint version. Send 2. |
Authentication headers
| Name | Type | Description |
|---|---|---|
| X-IG-API-KEYrequired | string | Your API key, from your IG account settings. Placeholder only here. |
| CSTrequired | string | Client session token returned by POST /session. |
| X-SECURITY-TOKENrequired | string | Account security token returned by POST /session. |
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.
Python
# Set IG_API_KEY, IG_CST, IG_SECURITY_TOKEN as environment variables first. Never paste real values into code.
# IG_CST and IG_SECURITY_TOKEN hold the CST and X-SECURITY-TOKEN headers that POST /session returns: step 3 of the quickstart (/brokers/ig/quickstart#step-3) captures them and this sample reads them back.
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"],
"CST": os.environ["IG_CST"],
"X-SECURITY-TOKEN": os.environ["IG_SECURITY_TOKEN"],
"VERSION": "2",
}
resp = requests.get(BASE_URL + "/positions", headers=headers, timeout=10)
resp.raise_for_status()
print(resp.json())JavaScript
// Set IG_API_KEY, IG_CST, IG_SECURITY_TOKEN as environment variables first. Never paste real values into code.
// IG_CST and IG_SECURITY_TOKEN hold the CST and X-SECURITY-TOKEN headers that POST /session returns: step 3 of the quickstart (/brokers/ig/quickstart#step-3) captures them and this sample reads them back.
// 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 + "/positions", {
method: "GET",
headers: {
"X-IG-API-KEY": process.env.IG_API_KEY,
"CST": process.env.IG_CST,
"X-SECURITY-TOKEN": process.env.IG_SECURITY_TOKEN,
"VERSION": "2",
},
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());curl
# Set IG_API_KEY, IG_CST, IG_SECURITY_TOKEN as environment variables first. Never paste real values into code. # IG_CST and IG_SECURITY_TOKEN hold the CST and X-SECURITY-TOKEN headers that POST /session returns: step 3 of the quickstart (/brokers/ig/quickstart#step-3) captures them and this sample reads them back. curl -X GET "https://demo-api.ig.com/gateway/deal/positions" \ -H "X-IG-API-KEY: $IG_API_KEY" \ -H "CST: $IG_CST" \ -H "X-SECURITY-TOKEN: $IG_SECURITY_TOKEN" \ -H "VERSION: 2"
Response
A mock response. The values are invented, so check field names against the official reference.
{
"_mock": true,
"positions": [
{
"position": {
"dealId": "DIAAAAMOCK01",
"direction": "BUY",
"size": 1,
"level": 7650.2,
"currency": "GBP",
"stopLevel": 7600,
"limitLevel": null,
"createdDateUTC": "2026-09-18T08:01:12"
},
"market": {
"epic": "IX.D.FTSE.DAILY.IP",
"instrumentName": "FTSE 100 (mock)",
"bid": 7655.1,
"offer": 7656.1,
"marketStatus": "TRADEABLE"
}
}
]
}Response schema, HTTP 200
Every field this site's OpenAPI file for IG declares for this response.
| Field | Type | Description |
|---|---|---|
| positions | array of objects | One entry per open position on the active account. |
| position | object | The deal as opened, with its current stop and limit. |
| contractSize | number | Size of the contract |
| createdDate | string | Local date the position was opened |
| createdDateUTC | string | Date the position was opened |
| dealId | string | Deal identifier |
| size | number | Deal size |
| direction | string | Deal directionOne of: BUY, SELL |
| limitLevel | number, nullable | Limit level |
| level | number | Level at which the position was opened |
| currency | string | Position currency ISO code |
| controlledRisk | boolean | True if position is risk controlled |
| stopLevel | number, nullable | Stop level |
| trailingStep | number, nullable | Trailing step size |
| trailingStopDistance | number, nullable | Trailing stop distance |
| market | object | A snapshot of the position's market when the call was answered. |
| instrumentName | string | Instrument name |
| expiry | string | Instrument expiry period |
| epic | string | Instrument epic identifier |
| instrumentType | string | Instrument typeOne of: BINARY, BUNGEE_CAPPED, BUNGEE_COMMODITIES, BUNGEE_CURRENCIES, BUNGEE_INDICES, COMMODITIES, CURRENCIES, INDICES, OPT_COMMODITIES, OPT_CURRENCIES, OPT_INDICES, OPT_RATES, OPT_SHARES, RATES, SECTORS, SHARES, SPRINT_MARKET, TEST_MARKET, UNKNOWN |
| lotSize | number | Instrument lot size |
| high | number | High price |
| low | number | Low price |
| percentageChange | number | Price percentage change |
| netChange | number | Price net change |
| bid | number | Bid |
| offer | number | Offer |
| updateTime | string | Local time of last instrument price update |
| updateTimeUTC | string | Time of last instrument price update |
| delayTime | integer | Instrument price delay (minutes) |
| streamingPricesAvailable | boolean | True if streaming prices are available, i.e. the market is tradeable and the client has appropriate permissions |
| marketStatus | string | Market statusOne of: CLOSED, EDITS_ONLY, OFFLINE, ON_AUCTION, ON_AUCTION_NO_EDITS, SUSPENDED, TRADEABLE |
| scalingFactor | integer | Multiplying factor to determine actual pip value for the levels used by the instrument |
github.comchecked
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
- POSITION_NOT_AVAILABLE_TO_CLOSEThe position cannot be closed.
- POSITION_NOT_FOUNDThe position was not found.
- error.position.notfoundHTTP 404. The requested position was not found.
- 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.
All IG API error codes, including 126 more not listed here.