Broker API
FOREX.com and City Index API
StoneX (formerly GAIN Capital) REST trading API shared by FOREX.com and StoneX Trading, the new UK name for City Index since 9 Sep 2026.
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.
FOREX.com API rate limits and allowances
One record per limit. The scope is part of the limit: a figure without its scope is not a figure you can pace against.
| Limit | Value | Scope | Source |
|---|---|---|---|
| Request throttle | 500 requests per 5 s, HTTP 429 above it | Requests from one client application. The page does not say whether the count is per session, per AppKey or per IP address | docs.labs.gaincapital.comchecked |
FOREX.com API rate limits in full, with pacing advice and the related error codes.
Access, authentication and streaming
API types listed in the record: REST, Streaming.
- How you get a key
Open and fund a standard account, then request API access from support; an AppKey is emailed if accepted.
FOREX.com API Tradingchecked
- Who can use it
By application: you must describe your expertise, language, goal and expected volume, and sign API terms.
StoneX API Getting Startedchecked
- Demo
Partial: the StoneX API documentation describes two environments, Live and Pre-Production, each with its own API and streaming address. It says most users work on Live and that only some users, depending on user type and circumstances, are given Pre-Production access. An account in one environment is not recognised in the other. The documentation does not say that a retail demo account can use the API.
- Authentication
A session token. POST your user name, password and the AppKey you were issued to /v2/Session, then send the returned session token and your user name with every request as the request headers Session and UserName. Passing them in the query string is marked obsolete. The documentation says a token is valid for at least 20 minutes, and an expired one is signalled by HTTP 401. Subscribing to the streams uses the user name and the session token as its credentials.
StoneX API documentation, API basicschecked StoneX API documentation, LogOn v2checked
- Streaming
Lightstreamer, a third party streaming protocol, over long lived HTTP connections and not WebSocket as documented. Streams cover prices, news headlines, client account margin, orders and quotes, grouped into adapters. Each adapter needs one HTTP connection plus one control connection. The documentation says the servers still run Lightstreamer 7.4.1 and that clients should use that version of the Lightstreamer SDK.
- History depth
Price bars: max 4,000 per request (default 1,000). Trade history: max 200 results per call, filter by from date.
- Rate limits, as worded
The StoneX API documentation says the servers throttle a client application that sends more than 500 requests in a 5 second window. A throttled request gets HTTP 429, and the client must then wait 1 second before sending more. It names requests for market information and for price history as the usual causes. FOREX.com's own API page answered 403 Forbidden on 12 Oct 2026 and was not re-read.
Platform APIs an account here can reach
| Platform API | Offered | Note | Source |
|---|---|---|---|
| MetaTrader 4 (MQL4) | Yes | MT4 on desktop, web and mobile. Expert Advisors allowed ('Expert Advisors (EAs) are programs that can be used to automate trading'); only one EA per chart; EA hosting/VPS for qualifying clients. | FOREX.com UK trading platformschecked |
| MetaTrader 4 (MQL4) | Yes | City Index UK pages now redirect to stonex.com/en-gb. MT4 offered with Expert Advisors from FX Blue (nine EAs). | StoneX Trading MetaTrader 4checked |
| MetaTrader 5 (Python package and MQL5) | Not verified | MT5 not listed on FOREX.com UK or StoneX Trading UK platforms pages; the FOREX.com UK MT5 URL returned HTTP 429 so could not be checked. | UnverifiedStoneX Trading UK platformschecked |
| cTrader Open API | No | cTrader not listed on the broker's UK platforms page; absence from an overview page is not proof, so unverified. | UnverifiedFOREX.com UK trading platformschecked |
| TradeLocker API | No | TradeLocker not listed on the broker's UK platforms page; absence from an overview page is not proof, so unverified. | UnverifiedFOREX.com UK trading platformschecked |
| Match-Trader Platform API | No | Match-Trader not listed on the broker's UK platforms page; absence from an overview page is not proof, so unverified. | UnverifiedFOREX.com UK trading platformschecked |
| DXtrade APIs | No | DXtrade not listed on the broker's UK platforms page; absence from an overview page is not proof, so unverified. | UnverifiedFOREX.com UK trading platformschecked |
FOREX.com API SDKs and wrappers
| Library | Language | Official | Note | Source |
|---|---|---|---|---|
| pygcapi | Python | Community | Not recorded | Unverifiedgithub.com |
| forexcom | Python | Community | Community package, last release 1.2.0 in June 2022. | pypi.orgchecked |
FOREX.com API: questions and answers
Each answer is read from the record on this page, not written separately. Where the record is unverified, the answer says so.
Does FOREX.com have an API?
This register records FOREX.com as having its own API (REST and Streaming), with availability marked as restricted. StoneX (formerly GAIN Capital) REST trading API shared by FOREX.com and StoneX Trading, the new UK name for City Index since 9 Sep 2026.
FOREX.com API key: how do I get one?
Open and fund a standard account, then request API access from support; an AppKey is emailed if accepted.
FOREX.com API Tradingchecked
Who can use the FOREX.com API?
By application: you must describe your expertise, language, goal and expected volume, and sign API terms.
StoneX API Getting Startedchecked
FOREX.com API demo: is there a demo or sandbox?
Partial: the StoneX API documentation describes two environments, Live and Pre-Production, each with its own API and streaming address.
What are the FOREX.com API rate limits?
Request throttle: 500 requests per 5 s, HTTP 429 above it. Scope: Requests from one client application. The page does not say whether the count is per session, per AppKey or per IP address. As the record words it: The StoneX API documentation says the servers throttle a client application that sends more than 500 requests in a 5 second window. A throttled request gets HTTP 429, and the client must then wait 1 second before sending more.
docs.labs.gaincapital.comchecked
How does FOREX.com API authentication work?
A session token. POST your user name, password and the AppKey you were issued to /v2/Session, then send the returned session token and your user name with every request as the request headers Session and UserName.
StoneX API documentation, API basicschecked StoneX API documentation, LogOn v2checked
Does the FOREX.com API support streaming?
Lightstreamer, a third party streaming protocol, over long lived HTTP connections and not WebSocket as documented. Streams cover prices, news headlines, client account margin, orders and quotes, grouped into adapters.
How much history does the FOREX.com API return?
Price bars: max 4,000 per request (default 1,000). Trade history: max 200 results per call, filter by from date.
Is there a Python library for the FOREX.com API?
This register lists these Python libraries for the FOREX.com API. pygcapi (community, Python). forexcom (community, Python): Community package, last release 1.2.0 in June 2022.
forexcomchecked
Which platform APIs work with an account at FOREX.com?
Recorded as offered, with a source: MetaTrader 4. Not verified either way: MetaTrader 5, cTrader, TradeLocker, Match-Trader and DXtrade.
FOREX.com API questions, each answered in a sentence or two.
The capability tables read one feature at a time across every broker and platform record, FOREX.com included.
Everything this site records for FOREX.com / StoneX Trading (City Index), as one JSON file. Each section of the file states its own licence. About the files. This page as Markdown.
FOREX.com API compared
The same fields from two records, side by side. No winner is picked.
What changed recently for the FOREX.com API
Documentation
The StoneX API documentation was read directly for the first time: session token authentication, Lightstreamer streaming and a throttle of 500 requests in 5 seconds are now verified where this site held them as unverified.
Documentation
Re-read today. The API trading page states live streaming prices across 80 markets and that access runs through applying for an account and then asking customer service, with spread only accounts told to contact support. Rate limits, authentication, demo and SDKs are still not stated anywhere on it.
FOREX.com: API tradingchecked
Ecosystem
City Index relaunched as StoneX Trading in the UK. The City Index brand retired on 12 Sep 2026 and cityindex.com pages now redirect to stonex.com. StoneX says clients keep the same platforms and accounts; no API change was announced.
StoneX press release: Launch of StoneX Trading marks a new era for City Indexchecked
Every dated change, all brokers and platforms. Follow FOREX.com changes by RSS
Partner programme
Published figure, as the page words it: $300 for each account you referred to us that has deposited a minimum of >$300. The StoneX (FOREX.com and City Index) partner programme record. The programme register holds every record. This site carries no affiliate links.
How to cite this
FOREX.com and City Index API. Broker API Hub, https://openbrokerapi.com/brokers/forex-com-city-index, newest check .
Where you rely on a single figure, cite the source and the checked date printed beside it as well.