Asset Classes

Free investment financial education

Language

Multilingual content from IBKR

Close Navigation
Learn more about IBKR accounts

What is IBKR’s Client Portal API?

Lesson 1 of 11
Duration 2:53
Level Intermediate
Close Navigation

Hello, and welcome to this lesson the Interactive Brokers Client Portal API. In this lesson, we will be discussing what the Client Portal API is, why an individual may use it, and more.

To begin, the Client Portal API is a RESTful API which allows you to make requests to the Interactive Brokers’ systems using standard http requests over the internet as opposed to using a local TCP socket. This system allows for a lightweight application with minimal installation required. The only required prerequisites to run and operate the API is a modern Java installation to run the gateway along with a command prompt. However, in the case of this course’s examples, you will also need to have Python 3 installed, along with the ‘requests’ library. We will also make frequent references to the Python’s JSON standard library; however, this is not required other than general formatting.

I would like to note that we will be proceeding through this series using Python and the ‘requests’ module. Because these requests are referring to standard web requests like a URL, body, or other common fields, these calls are not unique to Python. The same calls can be performed using CURL requests directly, through Javascript, C#, or any other language that supports web requests. If you are more experienced with another, feel free to follow along in your preferred language.

With that said, I would like to provide a few details regarding the use of the Client Portal API rather than the Trader Workstation API. As stated previously, a particular benefit to the Client Portal API, or CPAPI, is the lightweight nature. Without the need to operate the Trader Workstation, we can run a range of code with less demanding hardware requirements. However, it is important to note that the system is much younger than the Trader Workstation API, and while it does have many of the same features, it may not have full parity quite yet. We are adding new data and endpoints all the time, so while something may not exist yet, that does not mean it will not be coming soon.

Thank you for watching this Introduction to the Interactive Brokers Client Portal API. If you found this lesson helpful, please check out our other lessons in the Client Portal API tutorial series. 

API Trading

https://www.interactivebrokers.com/en/trading/ib-api.php

Latest IB Gateway

https://download2.interactivebrokers.com/portal/clientportal.gw.zip

Client Portal API Documentation

https://interactivebrokers.github.io/cpwebapi/

Available Endpoints

https://www.interactivebrokers.com/api/doc.html

Release Notes

https://www.interactivebrokers.com/en/index.php?f=46915

Join The Conversation

If you have a general question, it may already be covered in our FAQs. If you have an account-specific question or concern, please reach out to Client Services.

22 thoughts on “What is IBKR’s Client Portal API?”

  • Vusumuzi Sikhakhane

    It help a lot. I understand the content

    • Interactive Brokers

      We’re glad to hear that, Vusumuzi.

  • Mohamed I Helal

    It help a lot. I understand the content

  • Mohamed I Helal

    This was helpful

  • Mohamed I Helal

    This was helpful and insightful to me

    • Interactive Brokers

      Thank you, Mohamed. We are glad you found the content helpful! Be sure to check out other lessons on IBKR Campus.

  • Walter Molefe

    I’m a rookie on this things. I hope I’ll come alright.

    • Interactive Brokers

      Hello Walter, thank you for reaching out. Feel free to review the IBKR Campus. Here you can learn about trading, financial markets and Interactive Brokers trading tools. This could be a great resource for you!
      https://www.ibkrcampusdev.wpengine.com/campus/

      Please reach back out if you have more questions. We are here to help!

  • Kewal

    The strikes endpoint does not return call and put values
    Running the following code:

    base_url = “https://localhost:5001/v1/api/”
    endpoint = “iserver/secdef/strikes”

    conid = “conid=44652000”
    # conid = “conid=669788897”
    secType = “secType=OPT”
    month = “month=JAN24”
    exchange = “exchange=NSE”

    params = “&”.join([conid, secType, month, exchange])
    request_url = “”.join([base_url, endpoint, “?”, params])

    strikes_req = requests.get(url=request_url, verify=False)
    print(strikes_req)

    Returns:
    {‘call’: [], ‘put’: []}

    For the conid I tried passing the underlying conid(44652000) as well as the options(669788897) conid but I got empty response for both.
    And on trying exchange as HK.NSE, I get a server error 503.

    • Interactive Brokers

      Hello, thank you for reaching out. Calls to the /iserver/secdef/strikes endpoints requires that users first call the /iserver/secdef/search endpoint for the underlying beforehand. This process is explained further in lesson 3, Contract Search, available here: https://www.ibkrcampusdev.wpengine.com/campus/trading-lessons/contract-search/ We hope this helps!

  • Tom

    Might be nice to mention that you can not place orders against a Lite account.

    • Interactive Brokers

      Hello Tom, we appreciate your feedback. At this time, APIs are not available for IBKR Lite accounts. Please view the link below to determine which plan is best for you:
      https://www.interactivebrokers.com/en/index.php?f=45500

      We hope this helps.

  • GV

    Is it possible to test the APIs on the client portal? Could you please provide the URL? Specifically looking to try out order APIs.

  • AQ

    Hi, do you have a regular REST API available without a gateway? That is, I would like to connect to your server, authenticate and perform requests – regular REST, without installing Java, gateways and similar. I assume this gateway connects somewhere anyway – is that endpoint publicly available? If not, is there some other API that can be used without installing additional software locally? (mainly interested in easier account management and asset monitoring, not placing trades). Thank you!

    • Interactive Brokers

      Hello, thank you for reaching out. Customers affiliated with an Institution can sign up for OAuth access with the REST API. While the endpoints are identical for both systems, the two differ in the authentication method of access tokens or the gateway. You can read more about this in our OAuth documentation on IBKR Campus.

      For individuals unaffiliated with an organization, users would need to use either the Trader Workstation API or Client Portal API for real-time position updates. If you are planning to calculate positions locally, and simply need to verify data at market open or close, you may be interested in the Flex Web Service, which utilizes our Flex Queries from the Client Portal as web requests. You can read more in our Flex Web Service documentation. If this does not answer your question, please create a web ticket for this inquiry; we have a category specifically for “API.” One of our API experts will be happy to guide you! https://ndcdyn.interactivebrokers.com/AccountManagement/AmAuthentication?loginType=1&action=CS_WEB_TICKET&loginType=1

  • AQ

    Hello, thank you for your response! Since I don’t want to install anything locally, I have in the end decided to work with CSV exports instead and just parse data from there. It’s not auomatic, unfortunately, but will suffice for my use case. Thank you!

  • Ivan

    Hello, I have a question i am trying to write named httpclient in c# but for all Session endpoints request i got 403 response even if i disable certificate validation in httphandler. (This question is not related to named client but generally to HttpClient). Now i really don’t know i can login i can send 200 request through Postman/Insomnia also in python but i can’t do that in .Net. Do you have any recommendation for .Net setup? I read that i should provide UserAgent header but even if i do it doesn’t solve issue. I really cannot find anything useful on web only python but i would like to avoid using python since most of other project libs are c# and c++ and using python would bring other issues later on in project. Thanks a lot

    • Interactive Brokers

      Hello, we appreciate your question. The cause of this error can vary. Given the 403 error, it could be connected to the request causing the issue. We recommend creating a web ticket for this inquiry; we have a category specifically for “API.” One of our API experts will be happy to guide you! https://www.interactivebrokers.com/sso/resolver?action=NEW_TICKET

  • Aritrya

    Does graphQL is required for creating this APIs for the client portal API??

    • Interactive Brokers

      Hello Aritrya, the Client Portal API does not require GraphQL. Please reach back out with any more questions. We are here to help!

  • Rahul

    Hii…iam new to api, but i need to fetch live streaming data through web api, kindly help me in authenticating and fetching real time data, thanku.

Leave a Reply

Disclosure: Interactive Brokers

The analysis in this material is provided for information only and is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad-based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation by IBKR to buy, sell or hold such investments. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

The views and opinions expressed herein are those of the author and do not necessarily reflect the views of Interactive Brokers, its affiliates, or its employees.

Disclosure: API Examples Discussed

Throughout the lesson, please keep in mind that the examples discussed are purely for technical demonstration purposes, and do not constitute trading advice. Also, it is important to remember that placing trades in a paper account is recommended before any live trading.

IBKR Campus Newsletters

This website uses cookies to collect usage information in order to offer a better browsing experience. By browsing this site or by clicking on the "ACCEPT COOKIES" button you accept our Cookie Policy.