Back to Blog

IBKR TWS API Ports — 7497 Paper vs 7496 Live

Reference for Interactive Brokers TWS API socket ports—7497 paper, 7496 live, IB Gateway 4002/4001—and how to match them in NeonChainX.

Published: May 16, 2026

Third-party apps like NeonChainX connect to Interactive Brokers over the TWS API on localhost. If connection fails, the most common issue is a port mismatch between TWS/IB Gateway and your app.

TWS default API ports

Account modeTWS port
Paper trading7497
Live trading7496

Search queries like interactive brokers tws api port 7497 paper 7496 live refer to these defaults.

IB Gateway default API ports

Account modeIB Gateway port
Paper4002
Live4001

Enable API access in TWS

  1. File → Global Configuration → API → Settings
  2. Check Enable ActiveX and Socket Clients
  3. Uncheck Read-Only API (required to place orders)
  4. Set the socket port to 7497 (paper) or 7496 (live)
  5. Add 127.0.0.1 to Trusted IP Addresses
  6. Apply, OK, and restart TWS

Full walkthrough with screenshots: Getting Started.

Match ports in NeonChainX

In NeonChainX Configuration:

  • Host: 127.0.0.1
  • Port: same as TWS or Gateway (see tables above)
  • Client ID: 1 (or any unused ID)

Log in to TWS/Gateway with the same account type (paper vs live) you intend to trade.

Troubleshooting

  • Connection refused: TWS/Gateway not running or wrong port
  • Read-only errors: Enable trading API (not read-only)
  • Wrong account: Paper port with live login (or vice versa)

Related guides