Interactive Brokers
IBKR Client Portal Web API Beta

Interactive Brokers offers the ability to trade, monitor and manage your IB account using a single RESTful API.

With the Client Portal Web API:

This Client Portal API is currently in beta testing with production release planned for mid-summer 2019.
A request for access to the beta testing program can be made through the Help Center in the IBKR Client Portal.


Getting Started

  1. Download and unzip the CP WebAPI gateway from the link provided in the invitation email.

  2. Navigate to the directory where the gateway has been unzipped in a command prompt.

  3. Launch the gateway with the command "bin\run.bat root\conf.yaml" (on Windows) or "bin/run.sh root/conf.yaml" (on Mac/Unix).

  4. To authenticate the gateway session with your account, go to https://localhost:5000/

  5. Authenticate with your username/password and second factor device (for production accounts).


  6. You should receive the message "Client login succeeds" after successful authentication. The tab can then be closed.

Next Steps


Important Notes

Brokerage Session

Sequence of Endpoints

Limitations on orders and trades queries

Contract ID (ConId) Lookup

Websocket Streaming Data

Third Party Tools:

The API uses a standard swagger format compliant with the OpenAPI 2.0 specification for RESTful APIs, so there are a wealth of third party tools available for automatically generating code meeting the API specifications.



Troubleshooting & Initial Endpoints

To troubleshoot an issue with an unexpected response, first try the endpoints in the below order and note the response.
That can be done directly from this site, or with a tool of your choice that logs the raw HTML header + body.


Base URL:

Keeping Session Alive

If left inactive a session will timeout within a few minutes. It can be kept alive by calling /portal/sso/validate can be called at regular intervals.

Interval: seconds

Keeping a brokerage session alive

This script calls /portal/iserver/auth/status every minute, and if authenticated : false is returned,
automatically calls /portal/iserver/reauthenticate to attempt to initiate a brokerage session.

Base URL

 

Last Request: {{ logs.request }}
Time: {{ logs.timestamp }}
Last Response: {{ logs.response }}
Reauthentication attempts: {{reauthAttempt}}



Current Beta issues under review



To report issues to customer service:



© Interactive Brokers 2019