Prefer automatic sync instead of manual CSV uploads? Connect your Interactive Brokers account with a read-only Flex Web Service token and Oitava will keep your portfolio up to date.
IBKR sync needs two things from the Client Portal: an Activity Flex Query that says which data to send, and a Flex Web Service token that lets Oitava request it. You set this up once, after that syncing is automatic and you never need to come back here.
1
Open the Flex Web Service settings
In Client Portal, go to Performance & Reports → Flex Queries. On the right, in the Flex Web Service Configuration panel: (1) click the gear icon.

2
Enable the service and generate your token
(1) Tick Flex Web Service Status. (2) Click Generate New Token, an "Expire after" dropdown appears, so choose 1 year, because the default of 6 hours would stop your sync working the same day. (3) Click Save. (4) Copy the Current Token.
Leave "Valid for IP Address" empty.

3
Start the AI query builder
Go back to Flex Queries. In the Configure with AI panel at the top: (1) click Configure with AI.

4
Paste this prompt
(1) Paste the following into the description box, then (2) click Generate Flex Query:
"Activity Flex Query, XML, period Last 365 Calendar Days. Sections: Trades, Cash Transactions, Financial Instrument Information, Include Currency Rates. Select every available field in each"
IBKR limits this box to 200 characters, so the prompt is written to fit.

5
Switch on Include Currency Rates
The AI ignores this one, so it needs setting by hand. On the Review Flex Query screen: (1) click Edit Manually, (2) find "Include Currency Rates?" under General Configuration and set it to Yes, (3) click Save.
This lets Oitava use IBKR's own exchange rates for your transactions instead of estimating them.

6
Copy the Query ID
At the top of Review Flex Query: (1) copy the Query ID, a 7-digit number. Don't confuse it with your account number, which starts with a U.

7
Paste both into Oitava
Enter the token and the Query ID in your portfolio's sync settings. Both are encrypted before storage and the token is read-only. It can retrieve statements but cannot trade or move money.
Note: Prefer to build the query yourself instead of using the AI? Click the + next to Activity Flex Query and tick four sections, Trades, Cash Transactions, Financial Instrument Information, and Include Currency Rates, hitting Select All inside each. You don't need to pick individual fields. Cash Transactions is the one people miss: it carries your dividends, deposits, withdrawals, fees and interest, and without it Oitava sees your trades but none of your cash.
A few limits worth knowing. IBKR only makes the last four calendar years plus the current year available through Flex, so if your account is older than that, sync what it can reach and import a CSV activity statement for the earlier years. Each request is capped at 365 days, so longer histories are fetched in batches. Flex data covers up to the previous business day, meaning today's trades appear tomorrow, and brand-new accounts awaiting their first funding can't produce statements at all yet, so give it a day after opening. Generating a new token invalidates the previous one, so if you re-generate it later, update it in Oitava too.