Interactive Brokers Client Portal API Gateway

The Interactive Brokers Client Portal API Gateway provides access to a REAST API for IBKR accounts. It makes it possible to retrieve account information, manage portfolios, execute trades, and access market data via standard HTTP requests.

Download & Unpack

Go here and choose to download the Standard Release of the Client Portal API Gateway. Unpack the downloaded archive.

The unpacked content should include a few folders:

  • bin
  • build
  • dist
  • doc and
  • root.

Run

Launch the API portal.

./bin/run.sh root/conf.yaml

Go to https://localhost:5000/ in a browser. Authenticate (probably with a paper trading account).

  • Accept the dire warning about certificates. You’re connecting to localhost using HTTPS. The certificate provided by Interactive Brokers is invalid.
  • You might find that authentication doesn’t work on Firefox. But it should work on Chrome.
  • I found the login process to be temperamental. After a restart I had to first visit https://localhost:5000/demo#/ and then go back to https://localhost:5000/ in order to successfully login.

You have successfully authenticated when you see Client login succeeds in the browser.

Check

Now check the API.

curl -k https://localhost:5000/v1/api/tickle | jq .
{
  "session": "9fe1c272dc44e023a3aefe52b71d42bd",
  "ssoExpires": 444936,
  "collission": false,
  "userId": 132329622,
  "hmds": {
    "error": "no bridge"
  },
  "iserver": {
    "authStatus": {
      "authenticated": true,
      "competing": false,
      "connected": true,
      "message": "",
      "MAC": "F4:03:43:DC:B4:60",
      "serverInfo": {
        "serverName": "JifZ34060",
        "serverVersion": "Build 10.33.1f, Feb 5, 2025 10:21:09 AM"
      },
      "hardware_info": "2486818e|F4:03:43:DC:B4:60"
    }
  }
}

Critically you need to see that both authenticated and connected are true.

To maintain your login session you should keep tickling the API. This will ensure that you remain connected even if you are not sending API requests.

while true; do curl -k https://localhost:5000//v1/api/tickle; sleep 30; done

I was expecting to hear it giggle but I was disappointed.