flex_get_statement
Retrieves a completed Flex report from Interactive Brokers using its reference code, automatically polling until ready, and returns the XML content.
Instructions
Download a completed Flex report using its reference code.
Polls automatically until the report is ready or the timeout is reached.
Args: reference_code: Reference code returned by flex_send_request. token: Flex API token (overrides IBKR_FLEX_TOKEN env var). poll_interval_seconds: Seconds between polling attempts (default 5). max_wait_seconds: Maximum seconds to wait for the report (default 120).
Returns JSON: {"xml_content": "<FlexQueryResponse...>..."}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | No | ||
| reference_code | Yes | ||
| max_wait_seconds | No | ||
| poll_interval_seconds | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |