# Interactive Brokers API error: 401 Unauthorized

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/errors/ibkr/web-api-401-unauthorized, written from the same records as that page.

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.

The error, as text you can copy:

```
401 Unauthorized
```

- Kind: API error code
- HTTP status: 401
- API: [Interactive Brokers](https://openbrokerapi.com/brokers/ibkr)
- Status: verified. Source: [interactivebrokers.com](https://www.interactivebrokers.com/docs/web-api/api-reference/trading/trading-orders/submit-new-order), checked 2026-10-12.

## 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.

## 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.

## More on the Interactive Brokers API

- [All Interactive Brokers API error codes](https://openbrokerapi.com/errors/ibkr)
- [Interactive Brokers API quickstart](https://openbrokerapi.com/brokers/ibkr/quickstart): From credentials to a first call on a demo account, step by step.
- [Interactive Brokers API error codes](https://openbrokerapi.com/errors/ibkr): 511 decoded, each with what it means, and the fix where the source gives one.
- [Interactive Brokers API endpoints](https://openbrokerapi.com/brokers/ibkr/endpoints): 23 documented, each with its method, path, parameters and source.
- [Interactive Brokers API page](https://openbrokerapi.com/brokers/ibkr): The full record: access, authentication, limits and the source for each.
- [Get your Interactive Brokers trade history into a spreadsheet](https://openbrokerapi.com/guides/ibkr-trade-history): Guide
- [IBKR API without TWS: headless IB Gateway options](https://openbrokerapi.com/guides/ibkr-headless-gateway): Guide
- [The three Interactive Brokers REST front doors compared](https://openbrokerapi.com/guides/ibkr-rest-front-doors): Guide
- [Interactive Brokers MCP servers, compared](https://openbrokerapi.com/guides/interactive-brokers-mcp-servers): Guide

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: Interactive Brokers API error: 401 Unauthorized. Broker API Hub, https://openbrokerapi.com/errors/ibkr/web-api-401-unauthorized, newest check 2026-10-12.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
