Answers

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.

Flex Web ServiceFitsStatements: positions, cash, tradesNeedsA token and a saved query
TWS APIFitsQuotes and orders from your codeNeedsTWS or IB Gateway logged in
Web API, Client Portal GatewayFitsREST from your codeNeedsA local gateway, a browser login daily
Web API, OAuthFitsServers with no browserNeedsAn advisor, broker, prop, fund or developer account
Excel RTDFitsMarket data in ExcelNeedsTWS or IB Gateway running
AI integrationFitsAssistants such as ClaudeNeedsIBKR's connector
FIXFitsInstitutional order routingNeedsA 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
One session per usernameA login on Client Portal, TWS or IBKR Mobile competes with the Web API's; log out there first
A second usernameFree to add for parallel use; market data is billed per username
No headless loginTWS and IB Gateway need their login window; GUI-less operation is not supported
Client Portal Gateway loginIn a browser on the same machine, daily; IBKR does not support automating it
TWS API orders50 orders a second; up to 32 client apps on one TWS or Gateway
Flex pacingOne request a second, 10 a minute per token
Ports and Python libraries5 rows
TWS7496
TWS, paper account7497
IB Gateway4001
IB Gateway, paper account4002
Client Portal Gateway5000, 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).

Connecting Interactive Brokers in Gloom's Brokers pane: Sign in, which is recommended, or On this device.
Captured in the Gloom terminal app, version 0.20.1.

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.