Skip to main content

IBKR API Documentation

This site is a practical, code-level and operations-level reference for Interactive Brokers APIs. Current coverage focuses on the socket-based TWS API and ib_async 2.1.0, the package version used when this documentation was generated.

It answers three different questions without mixing them together:

  1. What does the Python library do? The generated ib_async reference inventories signatures, defaults, fields, events, and public methods from the installed package.
  2. What does TWS or IB Gateway do? The guides explain server-side subscriptions, order ownership, history boundaries, nightly resets, pacing, and permissions.
  3. What must a production application do? The operations chapters cover persistence, idempotency, recovery, observability, and safe reconciliation.

Start here

Four boundaries to remember

ib_async is not a database. Its live collections are an in-memory projection assembled from callbacks. TWS/IB Gateway is not the IBKR backend; it is the authenticated intermediary to which the Python socket connects. The API is not an entitlement bypass; market data and trading permissions still apply. Finally, no API call provides an unlimited audit trail: persist durable identifiers and events in your own store.

Terminology

TermMeaning
TWS APIIBKR's stateful socket protocol exposed by Trader Workstation and IB Gateway.
TWS/IBGEither Trader Workstation or IB Gateway. Their API behavior is mostly shared.
ib_asyncPython asyncio client that implements the IB wire protocol and maintains synchronized Python objects.
client IDInteger identity of one API connection. It scopes order IDs, ownership, and callback visibility.
order IDConnection/client-scoped mutable-order identifier. It is not a durable global key.
permanent ID (permId)Account-level order identifier assigned by IBKR; better for cross-session correlation.
execution ID (execId)Identifier for a fill/execution; use it for fill deduplication. Corrections may use related IDs.
request IDCorrelation identifier for a request/response stream. IB allocates these for you.

Source policy

Behavioral claims link to current IBKR Campus TWS API documentation or the official legacy reference where the Campus page does not expose a stable section URL. Exchange support, product eligibility, server versions, and order availability change; confirm them in TWS Contract Details and IBKR's current order matrix before trading.

This documentation is technical documentation, not investment advice. Always validate order behavior in a paper account and use whatIfOrder where supported.