IBKR Flex Query import: connect Interactive Brokers read-only
6 min read · Updated October 20, 2026
An IBKR Flex Query import lets Alphanta read your Interactive Brokers positions and trades through IBKR's own reporting service. You never share your password, and nothing in this setup can place an order or move money.
How the IBKR Flex Query import works
Flex Queries are Interactive Brokers' reporting tool. You define a report inside your IBKR account, and the Flex Web Service returns it to whoever holds the matching token and Query ID. Alphanta uses that pair to request the report, waits while IBKR builds it and then reads three sections: open positions, trades and net asset value.
It is a one-way, read-only channel. A Flex token cannot sign in to your account, place or cancel orders, or request a withdrawal. Alphanta never asks for your IBKR username or password, and you can cut access from the IBKR side at any time. IBKR import is part of the Pro plan.
Step 1: create an Activity Flex Query in IBKR
The query decides what IBKR puts in the report. Alphanta expects an Activity Flex Query in XML format.
- Sign in to IBKR Client Portal and open Performance & Reports → Flex Queries.
- Next to Activity Flex Query, click the plus icon to create a new query and give it a name you will recognise.
- In Sections, add Open Positions, Trades and Net Asset Value (NAV) in Base. In each section, Select All is the simplest choice.
- Under Delivery Configuration, set Format to XML and Period to Last 365 Calendar Days.
- Under General Configuration, keep the default date format (yyyyMMdd), time format (HHmmss) and the semicolon date/time separator. Alphanta also reads dd/MM/yyyy dates.
- Save the query. IBKR shows a numeric Query ID next to it; copy that number.
Step 2: generate a Flex Web Service token
The token is what allows a report to be fetched without your password.
- On the same Flex Queries page, open Flex Web Service Configuration and make sure the service is enabled.
- Generate a new token and choose how long it stays valid. Note the expiry date; after it you will need a new token.
- Leave the IP address restriction empty. Alphanta requests reports from its own servers, so a token limited to your home IP address will be refused.
- Copy the token and keep it like a key: anyone who has both the token and the Query ID can read that report.
Step 3: connect the query in Alphanta
With the two values copied, the rest takes a minute.
- Open Settings → Integrations. On mobile, go to More → Connections → IBKR integration.
- Paste the token into Flex Web Service Token and the number into Query ID. Account ID is optional.
- Click Save. After saving, Alphanta shows only the last four characters of the token.
- Click Test connection. Alphanta sends a request to IBKR and shows either a success message or IBKR's own error text.
- Turn on Enable IBKR portfolio to add your IBKR account to the portfolio selector, then click Sync to run the first import.
What Alphanta reads from the report
Alphanta reads only the fields it needs to build your record:
Nothing is ever sent back to IBKR. The data feeds your totals, your allocation and the Trades view.
- Open Positions: symbol, description, asset category, quantity, side, currency, mark price, position value, cost basis, unrealized P/L, and for options the strike, expiry and put/call flag.
- Trades: trade ID, date and time, symbol, buy or sell, quantity, trade price, proceeds, commission, taxes, net cash, currency, realized P/L and the open/close indicator.
- Net Asset Value (NAV) in Base: daily cash, stock, options and total values, used for the cash line and the account total.
Sync timing and troubleshooting
Alphanta asks for a fresh report when you click Sync or refresh the Trades view. IBKR builds the report on its side, so a sync can take a minute or two. Activity reports follow IBKR's daily statement cycle: syncing the morning after a trading day picks up the latest statement, while pressing Sync again and again brings no newer data and can run into IBKR's request limit.
If something goes wrong, the message usually points to one of these:
- Token expired or invalid: generate a new token in IBKR, paste it in Settings → Integrations and save again.
- Request refused even with a new token: check whether the token is restricted to certain IP addresses.
- Query is invalid: make sure you copied the Query ID of an Activity Flex Query. A Trade Confirmation query lacks the sections Alphanta needs, and the ID must contain digits only.
- Statement not ready: IBKR is still building the report. Wait a few minutes and sync again.
- Positions or cash missing: confirm that Open Positions, Trades and Net Asset Value (NAV) in Base are all in the query and that Format is XML.
- Trades missing although positions arrive: check the date format in General Configuration. A changed format such as yyyy-MM-dd cannot be read; switch back to the default.
- Too many requests: IBKR limits how often a report can be fetched. Wait a while and try again.
Questions
Can Alphanta place trades in my IBKR account?
No. A Flex token can only return reports. It cannot place or cancel orders, change settings or move money, and Alphanta has no other connection to your account.
Does Alphanta need my IBKR password?
No. You only paste a Flex Web Service token and a Query ID. Alphanta never asks for your IBKR username, password or two-factor codes.
How do I revoke access?
In IBKR Client Portal, disable the Flex Web Service or delete the Flex Query. Without them, the token and Query ID saved in Alphanta can no longer return a report.
How often does Alphanta import?
Whenever you click Sync in Settings → Integrations or refresh the Trades view. Once a day, after IBKR has prepared its daily statement, is enough to keep the record current.
More guides
- Multi-currency portfolio tracker: USD, EUR and TRY in one total
- Target allocation drift: see how far your mix has moved
- Dividend income calendar: dividends, coupons and rent by month
Educational content about using the software. Examples use sample numbers. Not investment advice.