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 mode | TWS port |
|---|---|
| Paper trading | 7497 |
| Live trading | 7496 |
Search queries like interactive brokers tws api port 7497 paper 7496 live refer to these defaults.
IB Gateway default API ports
| Account mode | IB Gateway port |
|---|---|
| Paper | 4002 |
| Live | 4001 |
Enable API access in TWS
- File → Global Configuration → API → Settings
- Check Enable ActiveX and Socket Clients
- Uncheck Read-Only API (required to place orders)
- Set the socket port to
7497(paper) or7496(live) - Add
127.0.0.1to Trusted IP Addresses - 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)