{"openapi":"3.1.0","info":{"title":"Flex Web Service","version":"1.0.0"},"paths":{"/SendRequest":{"get":{"operationId":"sendRequest","summary":"Trigger report generation","description":"Submits a request to generate an instance of a Flex Query report. On success, returns a `ReferenceCode` to be passed to `/GetStatement` to retrieve the generated report.\n\n**Rate limit:** 1 request per second; maximum 10 requests per minute per token.\n","parameters":[{"name":"t","in":"query","description":"The access token created for the Flex Web Service in Client Portal under Reporting -> Flex Queries.\n","required":true,"schema":{"type":"string"}},{"name":"q","in":"query","description":"The Query ID of the desired Flex Query report template, obtained from Client Portal under Reporting -> Flex Query.\n","required":true,"schema":{"type":"string"}},{"name":"v","in":"query","description":"Version of the Flex Web Service. Values `2` and `3` are supported; version `3` should always be used.\n","required":true,"schema":{"$ref":"#/components/schemas/SendRequestGetParametersV"}},{"name":"fd","in":"query","description":"Short for `fromDate`. Define the earliest date to retrieve.  If `fd` is used, the `td` parameter is required.\n","required":false,"schema":{"type":"string"}},{"name":"td","in":"query","description":"Short for `toDate`. Define the final date to retrieve. If `td` is used, the `fd` parameter is required.\n","required":false,"schema":{"type":"string"}},{"name":"p","in":"query","description":"Short for `Period`. Number of days from the current date to retrieve data for. A maximum of 365 days may be requested.\n","required":false,"schema":{"type":"integer","minimum":1,"maximum":365}}],"responses":{"200":{"description":"XML response indicating whether the report generation request succeeded or failed. Check the `Status` element to determine the outcome.\n","content":{"application/json":{"schema":{"type":"object","properties":{}}}}}}}},"/GetStatement":{"get":{"operationId":"getStatement","summary":"Retrieve generated report","description":"Retrieves the Flex Query report instance identified by the `ReferenceCode` returned by a prior successful `/SendRequest` call. Depending on the size of the report, you may need to wait before calling this endpoint to allow generation to complete.\n","parameters":[{"name":"t","in":"query","description":"The access token created for the Flex Web Service in Client Portal under Reporting -> Flex Queries.\n","required":true,"schema":{"type":"string"}},{"name":"q","in":"query","description":"The `ReferenceCode` returned by a prior successful `/SendRequest` call, identifying the specific report instance to retrieve.\n","required":true,"schema":{"type":"string"}},{"name":"v","in":"query","description":"Version of the Flex Web Service. Values `2` and `3` are supported; version `3` should always be used.\n","required":true,"schema":{"$ref":"#/components/schemas/GetStatementGetParametersV"}}],"responses":{"200":{"description":"The generated report file. The format (e.g. CSV, XML) depends on the configuration of the Flex Query template. On failure, an XML error response is returned instead.\n","content":{"application/json":{"schema":{"type":"object","properties":{}}}}}}}}},"servers":[{"url":"https://ndcdyn.interactivebrokers.com/AccountManagement/FlexWebService","description":"Flex Web Service"}],"components":{"schemas":{"SendRequestGetParametersV":{"type":"string","enum":["2","3"],"title":"SendRequestGetParametersV"},"GetStatementGetParametersV":{"type":"string","enum":["2","3"],"title":"GetStatementGetParametersV"}}}}