The Client Portal API is available for use with all IBKR PRO accounts.
The gateway session is expected to be restarted at least daily. An active session can be extended by pinging the /portal/sso/validate endpoint at regular intervals, such as once per minute. If the iserver endpoints used in a brokerage session are unavailable, it is possible to attempt to start a new brokerage session as long as /portal/sso/validate returns 200 by using the /reauthenticate endpoint.
Yes, though its necessary to use the paper account username/password to login. This can be found in Client Portal at:
Settings -> Account Settings -> Paper Trading Account -> Configure
and the password can also be reset there if needed.
No, for security reasons automated login to the CP gateway is not supported. It was designed to require the end user to manually enter their credentials into a web browser to login.
Currently it is not possible to connect directly to IBKR without running a local gateway. There are proposals under consideration to remove the gateway requirement for institutional accounts in the future.
Since the login process to the CP gateway is the same as to Client Portal, which has access to sensitive funds and banking functionality, it is not possible to remove the requirement for the second factor device. This is only possible in some situations for trading applications such as TWS.
Swagger reference: https://interactivebrokers.com/api/doc.html
The CP API is a RESTful interface which uses the industry standard OpenAPI 2.0 specification. Any third party tool can be used with the Swagger JSON API definition. For generating sample code, there is an open source tool called 'Swagger Editor' that was designed for this purpose: https://editor.swagger.io/
Unfortunately IBKR support cannot provide any programming assistance. Assistance is limited to a description of available functionalities within the API itself and expected responses.
The best way to contact the IB API Support Team is to create a ticket in the Client Portal Message Center and set Technical Assistance as the topic.
The HTTP 404 error indicates the specified endpoint is currently not found on the IBKR server.
With the release of the latest CP Gateway, we are beginning to migrate to the new host api.ibkr.com. With this change, the endpoint format has changed slightly to use /v1/api/ instead of /v1/portal/. You may receive error 404 if you are using the old format.
Note, with future Gateway releases we may add legacy compatibility with /v1/portal users and they will still be routed to the new host.
Since the gateway is running on your premises the certificate needs to be created/self-signed by you, or officially signed by a 3rd party. The gateway is similar to another webserver such as Tomcat which doesn’t provide a certificate along with the release.
Click here for an article from a third party site on creating self-signed certificates.
This will occur with an invalid JSON body, for instance if it has carriage returns/newlines. Please try first removing these.
Gateway is expected to require daily restart. During the day to maintain a session the endpoint /portal/sso/validate can be called at periodic intervals (e.g. 1 min). Common reasons why a CP gateway session might still become invalidated are if the gateway's external IP address changes, or if there is a competing login to another brokerage session with the same username.
If another trading application (TWS, IBKR mobile, Client Portal) is started with the same username it will disconnect the CP gateway session and the iserver brokerage endpoints will not be available. It is possible to attempt to start a brokerage session (and disconnect the competing session if there is one) by using the /reauthenticate?force=true endpoint.
You can find a list at:
To report an issue with an unexpected endpoint response its necessary to log the full request with the raw HTML header + body of the response and timestamp.
Unfortunately the API Support Team cannot examine or assist with programming language code directly.
IB API Support can then be contacted by creating a webtick with the raw HTML in the Client Portal Message Center.