Broker API
Interactive Brokers API
TWS API (socket via TWS or IB Gateway), and a single IBKR Web API that IBKR is folding Client Portal Web API, Digital Account Management and the Flex Web Service into.
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.
Interactive Brokers 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 |
|---|---|---|---|
| Global requests a second (Web API) | 10 | Per authenticated username, that is per Web API session | ibkrcampus.comchecked corroborated by interactivebrokers.com/docs/web-api/trading/usage-and-availability/pacing-limitations |
| Historical market data requests | Either 10 req/s or 50 req/minute, as the page words it | GET /iserver/marketdata/history only | interactivebrokers.comchecked corroborated by ibkrcampus.com/campus/ibkr-api-page/webapi-doc/ |
| Market data snapshot requests a second | 10 | GET /iserver/marketdata/snapshot only | interactivebrokers.comchecked corroborated by ibkrcampus.com/campus/ibkr-api-page/webapi-doc/ |
| Order and trade list requests | 1 req/5 s | GET /iserver/orders and GET /iserver/trades, each counted on its own | interactivebrokers.comchecked corroborated by ibkrcampus.com/campus/ibkr-api-page/webapi-doc/ |
| Session validation requests a minute | 1 | GET /sso/validate only | interactivebrokers.comchecked corroborated by ibkrcampus.com/campus/ibkr-api-page/webapi-doc/ |
| Session keep alive requests a second | 1 | GET /tickle only | interactivebrokers.comchecked corroborated by ibkrcampus.com/campus/ibkr-api-page/webapi-doc/ |
Interactive Brokers API rate limits in full, with pacing advice and the related error codes.
Access, authentication and streaming
API types listed in the record: TWS API (TCP socket), REST (Client Portal Web API), WebSocket.
- How you get a key
No key: run TWS or IB Gateway (TWS API) or the Client Portal Gateway and log in via browser (Web API).
IBKR TWS API documentation, the IB Gatewaychecked IBKR Web API documentation, Client Portal Gateway installation and authenticationchecked
- Who can use it
Open, funded IBKR Pro account. The Web API supports only IBKR Pro accounts, and the TWS API lists a funded and opened IBKR Pro account among its requirements.
IBKR Web API v1.0 documentation, requirements and limitationschecked IBKR Web API v1.0 documentation, introductionchecked IBKR TWS API documentation, requirementschecked
- Demo
Partial: paper trading accounts are supported and the Web API is logged in to with a separate paper username; demo accounts cannot subscribe to data.
IBKR Web API documentation, using a paper accountchecked IBKR Web API v1.0 documentation, requirements and limitationschecked
- Authentication
TWS API: local socket to a TWS or IB Gateway the user has logged in to by hand. Web API: Client Portal Gateway with a browser login on the same machine; the Web API also lists OAuth 1.0a, OAuth 2.0 and SSO, and IBKR's older use cases page gives OAuth as the route for institutional clients.
IBKR TWS API documentation, the IB Gatewaychecked IBKR Web API documentation, limitations of the Client Portal Gatewaychecked IBKR Web API v1.0 documentation, introductionchecked Client Portal API documentation, use cases (IBKR GitHub pages)checked
- Streaming
TWS API is event driven over the socket. The Web API websocket is at /v1/api/ws (wss://localhost:5000/v1/api/ws through the gateway): the number of market data subscriptions depends on the account's market data lines, 100 by default, a market data stream ends after 15 minutes unless it is requested again, and at most 5 historical data requests run at once.
IBKR Web API v1.0 documentation, websockets introductionchecked IBKR Web API v1.0 documentation, websocket market data requestchecked IBKR Web API v1.0 documentation, websocket historical market data requestchecked IBKR Campus: Web API documentationchecked
- History depth
Bars of 30 seconds or less are not available beyond six months, and expired futures not beyond two years from expiry. IBKR's current TWS API documentation, read on 12 Oct 2026, counts three pacing violations for bars of 30 seconds or less: an identical historical data request within 15 seconds, six or more requests for the same contract, exchange and tick type within two seconds, and more than 60 requests in any ten minute period, with a BID_ASK request counted twice. The Web API endpoint /iserver/marketdata/history has its own published pacing of 10 requests a second or 50 a minute. Executions: since midnight by default, up to 7 days in TWS if its Trade Log setting is changed, and the current day only in IB Gateway.
IBKR TWS API documentation, unavailable historical datachecked IBKR TWS API documentation, pacing violations for small barschecked IBKR TWS API documentation, execution detailschecked IBKR Web API v1.0 documentation, pacing limitationschecked
- Rate limits, as worded
Web API: 10 requests a second for each authenticated username, which IBKR equates with each Web API session, and the same figure through the Client Portal Gateway. Some endpoints carry their own limit: /iserver/marketdata/snapshot 10 a second; /iserver/marketdata/history 10 a second or 50 a minute, with 5 concurrent requests; /iserver/orders and /iserver/trades 1 per 5 seconds; /iserver/scanner/params 1 per 15 minutes; /tickle 1 a second; /sso/validate 1 a minute. A breach returns HTTP 429. The two IBKR pages cited first, read on 12 Oct 2026, say a violating IP address may be put in a penalty box for 10 minutes and that repeat violators may be blocked permanently until the issue is resolved. IBKR's Web API v1.0 pacing page, read the same day, says 15 minutes. TWS API, read again on 12 Oct 2026: the maximum is market data lines divided by two, per second, so the default 100 lines gives 50 requests a second, and for more than that IBKR suggests its FIX API.
IBKR Web API, pacing limitationschecked IBKR Campus, Web API documentationchecked IBKR Web API v1.0 documentation, pacing limitationschecked IBKR TWS API: pacing limitationschecked
Interactive Brokers API endpoints
23 documented endpoints. Grouped by what they do
- DELETE/iserver/account/{accountId}/order/{orderId}Cancels an existing order that has not filled.
- POST/iserver/account/{accountId}/order/{orderId}Changes an existing order that has not filled. Send the whole ticket with the new values.
- POST/iserver/account/{accountId}/ordersSubmits an order ticket, a bracket or an OCA group. The reply is either the order ID or a question you must confirm with POST /iserver/reply/{replyId}.
- POST/iserver/account/{accountId}/orders/whatifProjects the effect of an order before you send it: cost, change to equity, initial and maintenance margin, and position.
- GET/iserver/account/order/status/{orderId}Status of one order from the current brokerage session: side, type, size, filled amount and account.
- GET/iserver/account/ordersOpen orders, plus orders filled or cancelled during the current brokerage session.
- GET/iserver/account/pnl/partitionedUpdated profit and loss for the selected account, keyed by account and segment. The first request returns an empty upnl object.
- GET/iserver/account/tradesExecutions from the last 7 days at most, with symbol, side, size, price, commission and time.
- GET/iserver/accountsThe accounts you can trade, their aliases and the currently selected account. IBKR says to call it before the market data snapshot.
- POST/iserver/auth/ssodh/initStarts the brokerage session. IBKR documents it for OAuth users after the access token and live session token steps.
- POST/iserver/auth/statusWhether your brokerage session is authenticated, fully established and free of a competing session. Call it after you log in through the gateway.
- GET/iserver/contract/{conid}/infoFull contract details for a conid: symbol, instrument type, currency, exchange, trading class and whether it can be smart routed.
- GET/iserver/marketdata/historyOHLC bars for a contract over a period, with bar size, start time, data source and outside hours option.
- GET/iserver/marketdata/snapshotTop of book values for one or more contracts, such as last (31), bid (84) and ask (86). The first request only starts the data.
- POST/iserver/reply/{replyId}Answers a warning that came back from an order submission and continues with the order. The answer can bring another question.
- GET/iserver/secdef/infoAttributes of an instrument, mainly for derivatives: ticker, exchanges, currency, maturity, right and strike.
- GET/iserver/secdef/searchFinds contracts for a symbol and returns their contract IDs (conid), which every market data and order call needs.
- POST/logoutLogs you out of the gateway session. Any further call needs a new login, and IBKR says to discard client side cookies.
- GET/portfolio/{accountId}/ledgerCash balance, net liquidation and profit and loss for each currency the account holds, plus a BASE total.
- GET/portfolio/{accountId}/positions/{pageId}All positions in an account, one page at a time, with size, market price, market value and unrealised profit and loss.
- GET/portfolio/{accountId}/summaryAccount values such as net liquidation, available funds, buying power and margin, by segment where it applies.
- GET/portfolio/accountsYour accounts with ID, title, base currency and type, for the portfolio endpoints.
- POST/ticklePings the server so the session does not time out. IBKR expects a call about every 60 seconds.
Interactive Brokers API error codes
511 decoded error codes. All Interactive Brokers errors
The list is too long to repeat on this page. By kind:
- API error codes: 45
- TWS API message codes: 466
Every Interactive Brokers error code, grouped by kind, with a filter
Platform APIs an account here can reach
| Platform API | Offered | Note | Source |
|---|---|---|---|
| MetaTrader 4 (MQL4) | No | IBKR docs warn 'MetaTrader 4 may be no longer supported'; BrokerChooser also says IBKR does not offer MT4. | MetaTrader 5, Interactive Brokers documentationchecked |
| MetaTrader 5 (Python package and MQL5) | Not verified | IBKR docs say 'You can connect your Interactive Brokers account to MetaTrader 5' but link out to a third-party guide; it reads as a third-party bridge, not a broker-hosted MT5 server. Entity and UK availability not stated. | UnverifiedMetaTrader 5, Interactive Brokers documentationchecked |
| cTrader Open API | No | cTrader not listed on the broker's UK platforms page; absence from an overview page is not proof, so unverified. | UnverifiedMetaTrader 5, Interactive Brokers documentationchecked |
| TradeLocker API | No | TradeLocker not listed on the broker's UK platforms page; absence from an overview page is not proof, so unverified. | UnverifiedMetaTrader 5, Interactive Brokers documentationchecked |
| 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. | UnverifiedMetaTrader 5, Interactive Brokers documentationchecked |
| DXtrade APIs | No | DXtrade not listed on the broker's UK platforms page; absence from an overview page is not proof, so unverified. | UnverifiedMetaTrader 5, Interactive Brokers documentationchecked |
Interactive Brokers API SDKs and wrappers
| Library | Language | Official | Note | Source |
|---|---|---|---|---|
| TWS API (ibapi) | Python, Java, C++, C#, VB | Official | Not recorded | interactivebrokers.comchecked |
| ib_async | Python | Community | Community successor to ib_insync; 2.1.0 released Dec 2025. Migration note. ib_insync has been archived since March 2024 and ib_async is its maintained successor, but the archived package is still the more installed of the two: 640,258 against 556,555 over the same rolling 30 days to 23 Sep 2026, both from the pypistats.org /recent last_month counter. The 755,366 reading this page carried was taken on 20 Sep 2026 and is superseded by the 23 Sep reading above, not by a correction to it. If a tutorial tells you to install ib_insync, install ib_async instead: pip uninstall ib_insync, pip install ib_async, then change the import from ib_insync to ib_async. The class and method names are kept, so most scripts run unchanged. | pypi.orgchecked |
| ibeam | Python (Docker) | Community | Community headless re-auth tool for the Client Portal Gateway; 155 forks, 10 open issues; release date not checked. | github.comchecked |
| IBKR MCP public endpoint | Any MCP client | Official | Hosted by IBKR at https://api.ibkr.com/v1/api/mcp-public and open to any MCP client. Connector 1.1.5 of 1 Sep 2026 is reported as the release that opened it. IBKR's AI integrations page carries no connector version and no such date, so that version and date are unverified, checked 19 Sep 2026. Read only: instructions never become orders automatically. Credentials are never passed to the AI application, and consent is revoked in Client Portal under Settings, Manage Third-Party Consents. Not available in India or Japan. | ibkrguides.comchecked |
Interactive Brokers 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 Interactive Brokers have an API?
Yes. This register records Interactive Brokers as having its own API (TWS API (TCP socket), REST (Client Portal Web API) and WebSocket), with availability marked as active. TWS API (socket via TWS or IB Gateway), and a single IBKR Web API that IBKR is folding Client Portal Web API, Digital Account Management and the Flex Web Service into.
Interactive Brokers API key: how do I get one?
No key: run TWS or IB Gateway (TWS API) or the Client Portal Gateway and log in via browser (Web API).
IBKR TWS API documentation, the IB Gatewaychecked IBKR Web API documentation, Client Portal Gateway installation and authenticationchecked
Who can use the Interactive Brokers API?
Open, funded IBKR Pro account. The Web API supports only IBKR Pro accounts, and the TWS API lists a funded and opened IBKR Pro account among its requirements.
IBKR Web API v1.0 documentation, requirements and limitationschecked IBKR Web API v1.0 documentation, introductionchecked IBKR TWS API documentation, requirementschecked
Interactive Brokers API demo: is there a demo or sandbox?
Partial: paper trading accounts are supported and the Web API is logged in to with a separate paper username; demo accounts cannot subscribe to data.
IBKR Web API documentation, using a paper accountchecked IBKR Web API v1.0 documentation, requirements and limitationschecked
What are the Interactive Brokers API rate limits?
Global requests a second (Web API): 10 requests per second. Scope: Per authenticated username, that is per Web API session. Historical market data requests: Either 10 req/s or 50 req/minute, as the page words it. Scope: GET /iserver/marketdata/history only. Market data snapshot requests a second: 10 requests per second. Scope: GET /iserver/marketdata/snapshot only. Order and trade list requests: 1 req/5 s. Scope: GET /iserver/orders and GET /iserver/trades, each counted on its own. Session validation requests a minute: 1 requests per minute. Scope: GET /sso/validate only. Session keep alive requests a second: 1 requests per second. Scope: GET /tickle only. As the record words it: Web API: 10 requests a second for each authenticated username, which IBKR equates with each Web API session, and the same figure through the Client Portal Gateway.
ibkrcampus.comchecked interactivebrokers.comchecked IBKR Web API v1.0 documentation, pacing limitationschecked IBKR TWS API: pacing limitationschecked
How does Interactive Brokers API authentication work?
TWS API: local socket to a TWS or IB Gateway the user has logged in to by hand.
IBKR TWS API documentation, the IB Gatewaychecked IBKR Web API documentation, limitations of the Client Portal Gatewaychecked IBKR Web API v1.0 documentation, introductionchecked Client Portal API documentation, use cases (IBKR GitHub pages)checked
Does the Interactive Brokers API support streaming?
TWS API is event driven over the socket.
IBKR Web API v1.0 documentation, websockets introductionchecked IBKR Web API v1.0 documentation, websocket market data requestchecked IBKR Web API v1.0 documentation, websocket historical market data requestchecked IBKR Campus: Web API documentationchecked
How much history does the Interactive Brokers API return?
Bars of 30 seconds or less are not available beyond six months, and expired futures not beyond two years from expiry.
IBKR TWS API documentation, unavailable historical datachecked IBKR TWS API documentation, pacing violations for small barschecked IBKR TWS API documentation, execution detailschecked IBKR Web API v1.0 documentation, pacing limitationschecked
Is there a Python library for the Interactive Brokers API?
This register lists these Python libraries for the Interactive Brokers API. TWS API (ibapi) (official, Python, Java, C++, C#, VB). ib_async (community, Python): Community successor to ib_insync; 2.1.0 released Dec 2025. Migration note. ib_insync has been archived since March 2024 and ib_async is its maintained successor, but the archived package is still the more installed of the two: 640,258 against 556,555 over the same rolling 30 days to 23 Sep 2026, both from the pypistats.org /recent last_month counter. The 755,366 reading this page carried was taken on 20 Sep 2026 and is superseded by the 23 Sep reading above, not by a correction to it. If a tutorial tells you to install ib_insync, install ib_async instead: pip uninstall ib_insync, pip install ib_async, then change the import from ib_insync to ib_async. The class and method names are kept, so most scripts run unchanged. ibeam (community, Python (Docker)): Community headless re-auth tool for the Client Portal Gateway; 155 forks, 10 open issues; release date not checked.
TWS API (ibapi)checked ib_asyncchecked ibeamchecked
Which platform APIs work with an account at Interactive Brokers?
Recorded as not offered, with a source: MetaTrader 4. Not verified either way: MetaTrader 5, cTrader, TradeLocker, Match-Trader and DXtrade.
Interactive Brokers API questions, each answered in a sentence or two.
The capability tables read one feature at a time across every broker and platform record, Interactive Brokers included.
Everything this site records for Interactive Brokers, as one JSON file. Each section of the file states its own licence. About the files. This page as Markdown.
Interactive Brokers API guides and reference
- Interactive Brokers API quickstart: key to first call
- Interactive Brokers API endpoints, grouped by what they do
- Interactive Brokers API error codes
- Get your Interactive Brokers trade history into a spreadsheetTwo routes in Client Portal: an Activity Statement for a quick CSV, or a Flex Query when you want only the trade columns you choose. Every desktop step is confirmed in IBKR's own guides; a mobile export is not.
- IBKR API without TWS: headless IB Gateway optionsYou cannot skip IBKR's gateway software as a retail user, but you can skip the full TWS window. IB Gateway, IBC and Docker images cover the socket API; the Client Portal Gateway covers the Web API. Daily restarts and 2FA are the constraints you design around.
- Interactive Brokers MCP servers, comparedSearch for an Interactive Brokers MCP server and you will find one official route from IBKR itself and a scatter of community repositories nobody has reviewed in one place. This page says plainly what we could confirm, and what we could not.
- The three Interactive Brokers REST front doors comparedInteractive Brokers publishes more than one REST front door and they do not point at each other. Here is what each one said on the day we opened it.
- IBKR API error: TimeoutError() in ib_async after login
Interactive Brokers API compared
The same fields from two records, side by side. No winner is picked.
What changed recently for the Interactive Brokers API
Documentation
IBKR's Web API pacing page and its Campus Web API documentation both now state a penalty box of 10 minutes for an IP address that breaks a rate limit. This site previously recorded 15 minutes, and that the two pages disagreed.
Ecosystem
TWS API pacing is stated as market data lines divided by two per second, not a flat 50 per second. The familiar 50 is what the formula returns at the default line count. Read 23 September 2026.
Addition
Web API OAuth 2.0 is in beta and now covers first and third party access including account management. OAuth 1.0a remains trading only. Read 23 September 2026.
The newest entries are shown. Every dated change, all brokers and platforms. Follow Interactive Brokers changes by RSS
Sample apps that use the Interactive Brokers API
- IBKR paper account position monitorConnects to IB Gateway on the paper port with readonly=True and prints positions and the account summary on a timer.
Open source repositories for Interactive Brokers
Read from GitHub's own records and ordered by stars as read. A listing is not a recommendation.
- ib-api-reloaded/ib_asyncPython
- gnzsnz/ib-gateway-dockerShell
- Voyz/ibeamPython
- rburkholder/trade-frameC++
- Voyz/ibindPython
- wboayue/rust-ibapiRust
- stoqey/ibTypeScript
- code-rabi/interactive-brokers-mcpJavaScript
Partner programme
No published figure. The Interactive Brokers partner programme record. The programme register holds every record. This site carries no affiliate links.
How to cite this
Interactive Brokers API. Broker API Hub, https://openbrokerapi.com/brokers/ibkr, newest check .
Where you rely on a single figure, cite the source and the checked date printed beside it as well.