Connect Interactive Brokers

Connect IBKR read-only with a Flex Query and a token, with the seven sections Karet reads. If one is missing, Karet tells you which and how to add it.

Updated 14 October 20263 minutes

Karet reads your Interactive Brokers account through a Flex Query: a report IBKR prepares for you every day. You create the query once, and Karet fetches it every night with a token. Access is read-only: Karet can never trade or move money.

Before you start

  • You have an IBKR account and log in on the Interactive Brokers website.
  • You are an owner, admin or editor in the workspace.
  • Connect IBKR in the workspace the account belongs to: your personal workspace for a personal account, your BV's workspace for an account in the BV's name.

Create the Flex Query

  1. Log in to Interactive Brokers and go to Performance & Reports › Flex Queries.
  2. Next to Activity Flex Query, click + and name the query, for example Karet.
  3. Under Sections, click each of these sections. In each, tick Select All and click Save.
    • Trades: your buys and sells
    • Cash Transactions: dividends, interest, fees, deposits and withdrawals
    • Corporate Actions: splits, mergers and other corporate actions
    • Open Positions: what you hold now
    • Net Asset Value (NAV) in Base: your total value per day
    • Open Dividend Accruals: announced dividends, for your Agenda
    • Prior Period Positions: prices per day, for the chart on a holding's page
  4. Set Format to XML, Period to Last 365 Calendar Days, Date Format to yyyy-MM-dd and Time Format to HH:mm:ss.
  5. Click Continue, then Save Changes. Copy the Query ID from the list.

Create the token

  1. On the same page, next to Flex Web Service Configuration, click the gear.
  2. Switch the Flex Web Service on and create a token.
  3. Copy the token right away: IBKR shows it only once.

Connect it in Karet

  1. Go to Settings › Connections and click Add connection.
  2. Choose Interactive Brokers.
  3. Paste the Flex Token and the Query ID and click Connect IBKR.

IBKR prepares your first report, which can take up to a minute. After that Karet fetches it every night. If you don't want to wait, open the connection and choose ··· › Sync now.

When Karet says a section is missing

After every sync Karet checks which of the seven sections your query has. If one is missing, the connection's page shows which section, what it is for, and the steps to add it.

  • A needed section (Trades, Cash Transactions, Corporate Actions, Open Positions or Net Asset Value (NAV) in Base): your figures are incomplete. You also see a notice on Overview, Net worth and Investments.
  • A recommended section (Open Dividend Accruals or Prior Period Positions): the connection works, but your Agenda shows no dividends from IBKR, or the price chart only starts at your first sync.

To add a section to an existing query:

  1. In IBKR, go to Performance & Reports › Flex Queries.
  2. Next to your Activity Flex Query, click the pencil. Not the cross: that deletes the query.
  3. Under Sections, click the missing section, tick Select All and click Save.
  4. At the bottom, click Continue, then Save Changes.

Your Query ID and token stay the same; nothing changes in Karet. The notice goes away after the next sync.

If it doesn't work

  • Error 1019 when connecting. IBKR is still preparing your report. Wait a minute and try again.
  • Error 1001. IBKR couldn't generate the report at that moment, often because it was requested shortly before. If you see it while connecting, wait a few minutes and click Connect IBKR again. During the nightly sync, Karet tries again the next night by itself.
  • Data looks wrong or dates are missing. Check that Date Format is yyyy-MM-dd. With IBKR's default, Karet can't read any date.
  • Fields are missing. Tick Select All in every section. The default selection leaves out fields Karet needs, such as the ISIN.
  • Your token stopped working. Create a new token under Flex Web Service Configuration and paste it into Karet again.

Note: the cross next to your query in IBKR deletes the query. Karet can't fetch anything until you create a new one and paste its Query ID into Karet.

Was this helpful?