Broker API HubMenu

Interactive Brokers API error code

Interactive Brokers API error: 401 Unauthorized

The error, as text you can copy

401 Unauthorized
Kind
API error code
HTTP status
401
API
Interactive Brokers

What does 401 Unauthorized mean on the Interactive Brokers API?

On the Web API, the reference for submitting an order lists 401 Unauthorized and describes it as a missing, invalid or unparseable Authorization token. The vendor's quick start troubleshooting page covers a 401 through the Client Portal Gateway: you are not logged in to the gateway, no brokerage session has been initialised, or the session has expired.

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.

Independent and unofficialinteractivebrokers.comchecked

How do I fix 401 Unauthorized?

The vendor's troubleshooting page says to log in to the API gateway, then initialise a brokerage session if the error continues, and to ping the server periodically so the session does not expire.