IG API endpoints: REST reference
49 documented IG API endpoints, grouped by what they do. Each has its method, path, parameters and the source it was read from.
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.
Accounts
- GET/accountsList every account under the login (spread bet, CFD and so on) with balance, deposit, profit and loss and available funds.
- GET/accounts/preferencesRead the preferences held on the account. The one preference documented is whether trailing stops are switched on.
- PUT/accounts/preferencesChange the account preferences. The documented body carries one field, which switches trailing stops on or off.
Applications
- GET/operations/applicationList the API applications you own, each with its key, status and the request allowances set on it.
- PUT/operations/applicationChange one of your API applications: its status and its per account request allowances.
- PUT/operations/application/disableDisable the API key the request is sent with, so it stops serving requests. IG says a disabled key can be switched back on from the account pages of its platform.
Client sentiment
- GET/client-sentimentThe share of IG clients holding long and short positions in each of a list of markets, as two percentages per market.
- GET/client-sentiment/{marketId}The share of IG clients holding long and short positions in one market, as two percentages.
- GET/client-sentiment/related/{marketId}Client sentiment for the markets IG relates to the one you name: the long and short percentages for each.
Costs and charges
- POST/indicativecostsandcharges/closeAsk for an indicative breakdown of the costs and charges of closing an open deal. Nothing is traded.
- GET/indicativecostsandcharges/durablemedium/{indicativeQuoteReference}Download an indicative costs and charges quote made earlier, as a PDF. The reference comes back from the open, close and edit quote calls.
- POST/indicativecostsandcharges/editAsk for an indicative breakdown of the costs and charges of editing an order, split into its stop and its limit. Nothing is traded.
- GET/indicativecostsandcharges/history/from/{from}/to/{to}The indicative costs and charges quotes made between two date times, paged. Each entry carries the reference needed to download its PDF.
- POST/indicativecostsandcharges/openAsk for an indicative breakdown of the costs and charges of opening a deal: spread, commission, funding and currency conversion. Nothing is traded.
Dealing
- GET/confirms/{dealReference}Deal confirmation for a dealReference. This is where you learn whether the deal was ACCEPTED or REJECTED, and why.
- GET/positionsAll open positions on the active account, each with its market snapshot.
- GET/positions/{dealId}A single open position by deal ID.
- DELETE/positions/otcClose one or more positions. IG's official Java sample sends a DELETE with a request body; trading-ig sends a POST with the header _method: DELETE for clients that cannot put a body on a DELETE.
- POST/positions/otcOpen an OTC position. Returns a dealReference only: the deal is not confirmed until you call GET /confirms/{dealReference}.
- PUT/positions/otc/{dealId}Amend the stop, limit or trailing stop on an open position.
- GET/working-ordersAll working (pending) orders on the active account.
- POST/working-orders/otcCreate a working order (LIMIT or STOP) that triggers at a level.
- DELETE/working-orders/otc/{dealId}Delete an OTC working order by its deal identifier. Returns a dealReference.
- PUT/working-orders/otc/{dealId}Amend an OTC working order that has not filled: its level, type, stop, limit and expiry. Returns a dealReference to confirm, as dealing calls do.
History
- GET/history/activityAccount activity (deals, amendments, order changes) over a date range, with optional detail.
- GET/history/activity/{fromDate}/{toDate}Account activity between two dates, both given in the path. This is the version 1 form: every value in the reply is a string.
- GET/history/activity/{lastPeriod}Account activity for a period counted back from now, given in milliseconds. This is the version 1 form: every value in the reply is a string.
- GET/history/transactionsCash transactions (realised profit and loss, funding, deposits). This is the one you want for a trade journal or tax spreadsheet.
- GET/history/transactions/{transactionType}/{fromDate}/{toDate}Transaction history of one type between two dates, all three given in the path. The version 1 form of the transactions call.
- GET/history/transactions/{transactionType}/{lastPeriod}Transaction history of one type for a period counted back from now, given in milliseconds. The version 1 form of the transactions call.
Markets
- GET/categoriesThe categories of instrument switched on for the account, each with a code and a flag saying whether it can be traded.
- GET/categories/{categoryId}/instrumentsEvery instrument in one category, paged, with its epic, name, status and current bid and offer.
- GET/marketsSearch markets by free text. Returns epics you then feed into every other call.
- GET/markets/{epic}Full market details for one epic: instrument, dealing rules (minimum size, stop distances) and snapshot.
Prices
- GET/prices/{epic}Historical OHLC prices for an epic, paged. Each call eats into your weekly historical data allowance, so cache aggressively.
- GET/prices/{epic}/{resolution}/{numPoints}The most recent historical prices for an epic at one resolution, as a fixed number of data points. Each point counts against the historical data allowance.
- GET/prices/{epic}/{resolution}/{startDate}/{endDate}Historical prices for an epic at one resolution between two date times given in the path. Each point counts against the historical data allowance.
Session
- DELETE/sessionLog out and end the current session. The page documents no parameters and no response body.
- GET/sessionRead the current session: client ID, active account and streaming endpoint. Optional fetchSessionTokens=true returns fresh CST headers.
- POST/sessionLog in with username and password. Returns CST and X-SECURITY-TOKEN in the response headers; send both on every later call.
- PUT/sessionSwitch the session to another of your accounts, and optionally make that account the default one.
- GET/session/encryptionKeyFetch the key and timestamp used to send a password in encrypted form when logging in. Only some logins need it.
- POST/session/refresh-tokenExchange a refresh token from a version 3 login for a new access token and a new refresh token.
Watchlists
- GET/watchlistsAll watchlists on the account, including the built in ones.
- POST/watchlistsCreate a watchlist with a name and, if you wish, a first set of markets. The reply says whether every market was added.
- DELETE/watchlists/{watchlistId}Delete a watchlist. The list itself is removed, not the markets or any position in them.
- GET/watchlists/{watchlistId}The markets in one watchlist, each with its epic, name, status and current bid and offer.
- PUT/watchlists/{watchlistId}Add one market to an existing watchlist, by its epic.
- DELETE/watchlists/{watchlistId}/{epic}Take one market out of a watchlist. The watchlist and its other markets stay as they are.