IBKR TWS API vs Client Portal API vs Flex, Compared
Use Flex for statements, the TWS API for quotes and orders from your own machine, and the Web API for REST, which individual accounts reach through the Client Portal Gateway, per IBKR's authentication docs.
Checked Not affiliated with Interactive Brokers.
| Route | Fits | Needs |
|---|---|---|
| Flex Web Service | FitsStatements: positions, cash, trades | NeedsA token and a saved query |
| TWS API | FitsQuotes and orders from your code | NeedsTWS or IB Gateway logged in |
| Web API, Client Portal Gateway | FitsREST from your code | NeedsA local gateway, a browser login daily |
| Web API, OAuth | FitsServers with no browser | NeedsAn advisor, broker, prop, fund or developer account |
| Excel RTD | FitsMarket data in Excel | NeedsTWS or IB Gateway running |
| AI integration | FitsAssistants such as Claude | NeedsIBKR's connector |
| FIX | FitsInstitutional order routing | NeedsA VPN, leased line or cross-connect |
The TWS API, Web API and Excel RTD need a funded IBKR Pro account. One username holds one brokerage session at a time, on any platform.
Limits that bite6 rows
| Limit | What IBKR says |
|---|---|
| One session per username | A login on Client Portal, TWS or IBKR Mobile competes with the Web API's; log out there first |
| A second username | Free to add for parallel use; market data is billed per username |
| No headless login | TWS and IB Gateway need their login window; GUI-less operation is not supported |
| Client Portal Gateway login | In a browser on the same machine, daily; IBKR does not support automating it |
| TWS API orders | 50 orders a second; up to 32 client apps on one TWS or Gateway |
| Flex pacing | One request a second, 10 a minute per token |
Ports and Python libraries5 rows
| Program | Default port |
|---|---|
| TWS | 7496 |
| TWS, paper account | 7497 |
| IB Gateway | 4001 |
| IB Gateway, paper account | 4002 |
| Client Portal Gateway | 5000, at https://localhost:5000 |
ib_insync is archived on GitHub. ib_async, which describes itself as its replacement, is still updated (checked 5 November 2026).
Where Gloom fits
Gloom speaks three of these: Flex and the TWS API through its plugins (On this device), and the AI integration (Sign in), in Brokers (BR).

Gloom covers
- Flex positions, cash and account value.
- Gateway or TWS: quotes, an order console, a Trade tab.
- The AI integration, passed on by Gloom's MCP server.
Gloom does not cover
- The Web API, FIX or Excel RTD.
- Flex or Gateway in the browser version.
Sources5 sources
- IBKR's Web API docs, read 5 November 2026: authentication (account types per login), Client Portal Gateway limitations, Client Portal Gateway FAQ (daily login, no automation), sessions, multiple sessions and quick start (IBKR Pro, port 5000).
- IBKR's TWS API docs, read 5 November 2026: introduction, installation (IBKR Pro), connect_and_start (the four default ports), connectivity (32 clients).
- IBKR's third-party FAQ, API overview and Excel RTD introduction, read 5 November 2026: 50 orders a second, no headless login, IBKR Lite, extra usernames, FIX, RTD for IBKR Pro.
- GitHub, read 5 November 2026: erdewit/ib_insync archived, ib-api-reloaded/ib_async "replaces ib_insync", last updated 4 November 2026.
- Gloom's Interactive Brokers and IBKR Gateway plugins, v1.1.0 and v1.3.0, and its server source: the three routes.
Not verified2 claims
- Whether an individual account can get OAuth. In April 2026 a user wrote that IBKR's API team told them it is for non-individual clients only (r/interactivebrokers); in January 2026 another said they use OAuth 1.0a (r/algotrading). Ask IBKR's API support.
- How the Client Portal Gateway behaves when another login takes the session. Not tested here.