# Interactive Brokers TWS API message code: 540 (request positions)

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/540-request-positions, 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:

```
540
```

- Kind: TWS API message code
- Where you meet it: In the TWS API, not in the Web API and not in an HTTP status
- API: [Interactive Brokers](https://openbrokerapi.com/brokers/ibkr)
- Status: verified. Source: [interactivebrokers.com](https://www.interactivebrokers.com/docs/tws-api/doc/error-handling/error-codes), checked 2026-10-12.

## What does 540 (request positions) mean on the Interactive Brokers API?

Listed by the vendor as "Request Positions Sending Error". The words in quotes are from Interactive Brokers' own list, and the page shows them ending in a dash with nothing after it. The vendor's page adds no notes for this code.

## No fix in the source

The vendor's page gives no remedy.

That is all the source says, so this page does not invent a fix. General guidance: [the other tWS API message codes recorded for Interactive Brokers](https://openbrokerapi.com/errors/ibkr#tws-message-code), the [error lookup](https://openbrokerapi.com/tools/error-lookup) for the exact text of the reply you received.

## 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 TWS API message code: 540 (request positions). Broker API Hub, https://openbrokerapi.com/errors/ibkr/540-request-positions, 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.
