{"components":{"schemas":{"Bucket":{"description":"One grant of API units, and how much of it is left.\n\nBuckets are used up in the order they are listed: the API plan's units for\nthe current billing period first, then unit packs and trials, the soonest\nto expire first. A request is refused with a `402` when its worst-case cost\nis more than `remaining` summed across all of them.","properties":{"ends_at":{"format":"date-time","nullable":true,"readOnly":true,"type":"string"},"plan":{"readOnly":true,"type":"string"},"remaining":{"readOnly":true,"type":"integer"},"starts_at":{"format":"date-time","readOnly":true,"type":"string"},"units":{"readOnly":true,"type":"integer"},"used":{"readOnly":true,"type":"integer"},"via":{"readOnly":true,"type":"string"}},"type":"object"},"CoverageResponse":{"description":"What a client can ask for before it asks: how far back each series\nreaches, and the per-request ceilings.","properties":{"daily_earliest_available":{"format":"date","nullable":true,"readOnly":true,"type":"string"},"daily_max_units_per_request":{"readOnly":true,"type":"integer"},"earliest_available":{"format":"date","nullable":true,"readOnly":true,"type":"string"},"max_span_days":{"readOnly":true,"type":"integer"},"max_symbols":{"readOnly":true,"type":"integer"},"unit_days":{"readOnly":true,"type":"integer"}},"type":"object"},"DailyBar":{"description":"One trading day for one security, measure-major: each of `fee`, `rebate`\nand `available` carries its own open/high/low/close, so `bar.fee` hands you\nthat series whole.","properties":{"available":{"allOf":[{"$ref":"#/components/schemas/ShareCountOhlc"}],"readOnly":true},"date":{"format":"date","readOnly":true,"type":"string"},"fee":{"allOf":[{"$ref":"#/components/schemas/RateOhlc"}],"readOnly":true},"rebate":{"allOf":[{"$ref":"#/components/schemas/RateOhlc"}],"readOnly":true}},"type":"object"},"DailyBorrowMeta":{"description":"What the caller needs to interpret a daily payload and its cost.","properties":{"earliest_available":{"format":"date","nullable":true,"readOnly":true,"type":"string"},"end":{"format":"date","readOnly":true,"type":"string"},"start":{"format":"date","nullable":true,"readOnly":true,"type":"string"},"unit_days":{"readOnly":true,"type":"integer"},"units_billed":{"readOnly":true,"type":"integer"},"unresolved":{"items":{"type":"string"},"readOnly":true,"type":"array"}},"type":"object"},"DailyBorrowResponse":{"properties":{"data":{"additionalProperties":{"$ref":"#/components/schemas/DailySymbolSeries"},"readOnly":true,"type":"object"},"meta":{"allOf":[{"$ref":"#/components/schemas/DailyBorrowMeta"}],"readOnly":true}},"type":"object"},"DailySymbolSeries":{"description":"One symbol's daily answer, carrying its own cost: `units` is what this\nsymbol was billed, and `first_date`/`last_date` are the span that priced it.","properties":{"country":{"nullable":true,"readOnly":true,"type":"string"},"currency":{"nullable":true,"readOnly":true,"type":"string"},"figi":{"nullable":true,"readOnly":true,"type":"string"},"first_date":{"format":"date","nullable":true,"readOnly":true,"type":"string"},"last_date":{"format":"date","nullable":true,"readOnly":true,"type":"string"},"name":{"nullable":true,"readOnly":true,"type":"string"},"observations":{"items":{"$ref":"#/components/schemas/DailyBar"},"readOnly":true,"type":"array"},"previous_identities":{"items":{"$ref":"#/components/schemas/PriorIdentity"},"readOnly":true,"type":"array"},"units":{"readOnly":true,"type":"integer"}},"type":"object"},"DailyUsage":{"properties":{"date":{"format":"date","readOnly":true,"type":"string"},"requests":{"readOnly":true,"type":"integer"},"units":{"readOnly":true,"type":"integer"}},"type":"object"},"Error":{"description":"Every v2 error takes this shape.\n\nSwitch on `error`, not on the message. `details` is present only on\nvalidation failures, where it maps each bad field to what was wrong with it.","properties":{"details":{"readOnly":true,"type":"object"},"error":{"readOnly":true,"type":"string"},"message":{"readOnly":true,"type":"string"}},"type":"object"},"IntradayBorrowMeta":{"description":"What the caller needs to interpret the payload and the bill.","properties":{"archive_incomplete":{"readOnly":true,"type":"boolean"},"earliest_available":{"format":"date","nullable":true,"readOnly":true,"type":"string"},"end":{"format":"date","readOnly":true,"type":"string"},"start":{"format":"date","readOnly":true,"type":"string"},"units_billed":{"readOnly":true,"type":"integer"},"unresolved":{"items":{"type":"string"},"readOnly":true,"type":"array"}},"type":"object"},"IntradayBorrowResponse":{"properties":{"data":{"additionalProperties":{"$ref":"#/components/schemas/SymbolSeries"},"readOnly":true,"type":"object"},"meta":{"allOf":[{"$ref":"#/components/schemas/IntradayBorrowMeta"}],"readOnly":true}},"type":"object"},"IntradayObservation":{"description":"One 15-minute reading, identical in shape wherever in the window it falls.","properties":{"available":{"nullable":true,"readOnly":true,"type":"integer"},"datetime":{"format":"date-time","readOnly":true,"type":"string"},"fee":{"nullable":true,"readOnly":true,"type":"number"},"rebate":{"nullable":true,"readOnly":true,"type":"number"}},"type":"object"},"PriorIdentity":{"description":"A symbol and name this security carried before its current one, and the\nstretch it carried them for.\n\nBoth fields are echoed on every entry even when only one moved, so each\nentry reads as a complete identity rather than a diff to apply.\n`valid_from == valid_to` marks an identity we can attribute but cannot\ndate: the entry records that the security carried it, not when.","properties":{"name":{"nullable":true,"readOnly":true,"type":"string"},"symbol":{"nullable":true,"readOnly":true,"type":"string"},"valid_from":{"format":"date-time","readOnly":true,"type":"string"},"valid_to":{"format":"date-time","readOnly":true,"type":"string"}},"type":"object"},"RateOhlc":{"description":"One rate measure over one trading day: the 9:30-9:40 open, the session's\nextremes, and the close.\n\nEvery leg is nullable \u2014 IB reports fee and rebate for only some securities,\nand days from before we recorded intraday detail have no range, so `close`\nfalls back to `open` and `high`/`low` stay null rather than being invented.","properties":{"close":{"nullable":true,"readOnly":true,"type":"number"},"high":{"nullable":true,"readOnly":true,"type":"number"},"low":{"nullable":true,"readOnly":true,"type":"number"},"open":{"nullable":true,"readOnly":true,"type":"number"}},"type":"object"},"ShareCountOhlc":{"description":"The same open/high/low/close over availability, which is a share count\nrather than a rate and stays an integer.","properties":{"close":{"nullable":true,"readOnly":true,"type":"integer"},"high":{"nullable":true,"readOnly":true,"type":"integer"},"low":{"nullable":true,"readOnly":true,"type":"integer"},"open":{"nullable":true,"readOnly":true,"type":"integer"}},"type":"object"},"SymbolSeries":{"properties":{"country":{"nullable":true,"readOnly":true,"type":"string"},"currency":{"nullable":true,"readOnly":true,"type":"string"},"figi":{"nullable":true,"readOnly":true,"type":"string"},"name":{"nullable":true,"readOnly":true,"type":"string"},"observations":{"items":{"$ref":"#/components/schemas/IntradayObservation"},"readOnly":true,"type":"array"},"previous_identities":{"items":{"$ref":"#/components/schemas/PriorIdentity"},"readOnly":true,"type":"array"}},"type":"object"},"Usage":{"description":"Metered usage over the trailing window.","properties":{"daily":{"items":{"$ref":"#/components/schemas/DailyUsage"},"readOnly":true,"type":"array"},"requests":{"readOnly":true,"type":"integer"},"units":{"readOnly":true,"type":"integer"},"window_days":{"readOnly":true,"type":"integer"}},"type":"object"},"UsageResponse":{"properties":{"buckets":{"items":{"$ref":"#/components/schemas/Bucket"},"readOnly":true,"type":"array"},"usage":{"allOf":[{"$ref":"#/components/schemas/Usage"}],"readOnly":true}},"type":"object"}},"securitySchemes":{"ApiKeyAuth":{"description":"A key minted in the developer console, e.g. `ibd_...`.","scheme":"bearer","type":"http"}}},"info":{"contact":{"url":"https://www.iborrowdesk.com/developer"},"description":"Borrow fee, rebate and availability data from Interactive Brokers, as a JSON\nAPI. Two products share the surface:\n\n- **`/daily/borrow`** \u2014 one open/high/low/close bar per trading day per symbol,\n  back as far as we hold. Sold by history: one unit buys 365 days of one\n  symbol's series.\n- **`/intraday/borrow`** \u2014 the same measures at 15-minute granularity, back to a\n  fixed coverage floor. One unit per symbol that returns data.\n\n### Authentication\n\nEvery endpoint except `/coverage` takes a bearer token minted in the\n[developer console](https://www.iborrowdesk.com/developer):\n\n```\nAuthorization: Bearer ibd_...\n```\n\n### Units\n\nRequests draw units from your plan: its included units for the current billing\nperiod first, then any unit packs, the soonest to expire first. `/usage` lists\nthem. A request whose worst-case cost is more than the units you have left is\nrefused with a `402` before anything is read.\n\nA request that returns nothing is free: unknown symbols, market holidays and\ndays we hold no data for are never charged. Every response reports what it cost\nin `meta.units_billed`, and the daily payload breaks that down per symbol in\n`data.{symbol}.units` alongside the `first_date`/`last_date` that priced it.\n\n### Identifying a security\n\nPayloads are keyed by the symbol you asked for, but a ticker is not a stable\nidentity \u2014 companies rename, and a series here survives that silently. Join on\n**`figi`**, and read **`previous_identities`** for the symbols and names the\nsecurity carried earlier. An all-time daily series can easily outlive the\nticker it is keyed on.\n\n`name` is a label, not a key: it prefers the canonical company name where one\nhas been resolved and falls back to the wording of our upstream feed, and the\nnames in `previous_identities` resolve the same way. Neither is stable enough\nto join on \u2014 `figi` is.\n\n`currency` is the ISO 4217 code the line is quoted in, and so the currency\n`rebate` is a rate for: one market can list a security in several. It is null\nfor a line our feed has not quoted since we began recording it.\n\n### Using an AI agent\n\nAn [Agent Skill](https://www.iborrowdesk.com/api/v2/agent-skill/SKILL.md)\nteaches Claude, Codex and other agents to use this API: which series to\nchoose, how to plan requests around the limits below and price them before\nspending anything, and which errors are retryable. Download it as a\n[zip](https://www.iborrowdesk.com/api/v2/agent-skill.zip). A plain-text\noverview of the site and API is at\n[/llms.txt](https://www.iborrowdesk.com/llms.txt).","title":"IBorrowDesk API","version":"2.0.0"},"openapi":"3.0.3","paths":{"/api/v2/coverage":{"get":{"description":"How far back each series reaches and what a single request may ask for. **Free, unmetered and needs no key** \u2014 call it at startup instead of hardcoding the limits, which move.","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoverageResponse"}}},"description":"Current coverage and limits."},"429":{"content":{"application/json":{"example":{"error":"rate_limited","message":"Rate limit exceeded; retry later."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Per-key ceiling exceeded (60/minute, 2000/hour, 20000/day). Back off and retry."}},"summary":"Coverage floors and per-request ceilings","tags":["Account"]}},"/api/v2/daily/borrow":{"get":{"description":"One bar per trading day per symbol, with open/high/low/close for fee, rebate and availability. Omit `start` for every day we hold.\n\n**Units:** one unit per 365 days of history per symbol, measured on the span that symbol actually returned \u2014 so a recently-listed security costs one unit even on an all-time request. There is no span limit; the bound is cost, and a request whose worst case exceeds 150 units is rejected with advice to split it.\n\n**Clamping:** a `start` older than our earliest data is moved forward onto it rather than pricing history that does not exist. `meta.start` is the window actually served \u2014 `null` on an all-time request.\n\nNeeds a plan that includes the daily API.","parameters":[{"description":"Comma-separated tickers, up to 100 per request. Case and whitespace are normalised and duplicates collapsed. Anything that doesn't resolve is reported in `meta.unresolved` rather than failing the request.","example":"GME,AMC,TSLA","in":"query","name":"symbols","required":true,"schema":{"type":"string"}},{"description":"First day to return, inclusive. **Omit for all-time**, which is what this endpoint sells.","example":"2026-01-02","in":"query","name":"start","required":false,"schema":{"format":"date","type":"string"}},{"description":"Last day to return, inclusive. Defaults to today and is clamped there.","example":"2026-01-02","in":"query","name":"end","required":false,"schema":{"format":"date","type":"string"}}],"responses":{"200":{"content":{"application/json":{"example":{"data":{"GME":{"country":"usa","currency":"USD","figi":"BBG000BB5BF6","first_date":"2015-03-02","last_date":"2026-07-27","name":"GAMESTOP CORP-CLASS A","observations":[{"available":{"close":200000,"high":400000,"low":175000,"open":250000},"date":"2026-07-27","fee":{"close":5.38,"high":6.02,"low":4.11,"open":4.15},"rebate":{"close":-1.27,"high":1.83,"low":-1.91,"open":-0.04}}],"previous_identities":[],"units":12},"META":{"country":"usa","currency":"USD","figi":"BBG000MM2P62","first_date":"2015-03-02","last_date":"2026-07-27","name":"META PLATFORMS INC-CLASS A","observations":[{"available":{"close":5250000,"high":6000000,"low":5000000,"open":5500000},"date":"2026-07-27","fee":{"close":0.27,"high":0.3,"low":0.25,"open":0.25},"rebate":{"close":4.51,"high":4.53,"low":4.48,"open":4.53}}],"previous_identities":[{"name":"FACEBOOK INC-A","symbol":"FB","valid_from":"2015-03-02T00:00:00","valid_to":"2022-06-09T00:00:00"}],"units":12}},"meta":{"earliest_available":"2015-03-02","end":"2026-07-27","start":null,"unit_days":365,"units_billed":24,"unresolved":["NOTATICKER"]}},"schema":{"$ref":"#/components/schemas/DailyBorrowResponse"}}},"description":"The series, keyed by the symbol you asked for."},"400":{"content":{"application/json":{"example":{"details":{"symbols":["Provide at least one symbol, e.g. symbols=AAPL,MSFT."]},"error":"invalid_request","message":"Request parameters failed validation."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Parameters failed validation. `details` maps each bad field to what was wrong with it; cross-field problems (the resolved date window, the cost ceiling) land under `_schema`."},"401":{"content":{"application/json":{"example":{"error":"invalid_api_key","message":"Invalid or missing API key."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key is missing, malformed, revoked, or does not exist. The four are deliberately indistinguishable."},"402":{"content":{"application/json":{"example":{"error":"units_exhausted","message":"This request could cost up to 120 units and 40 are left. Narrow the request, or add units to your plan."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The request could cost more units than the account has left across its buckets (see `/usage`). Nothing was read or charged. Narrow the request, or add units."},"403":{"content":{"application/json":{"example":{"error":"no_api_access","message":"This account has no API plan that includes this endpoint."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key is valid, but the account behind it has no API plan that includes this endpoint."},"429":{"content":{"application/json":{"example":{"error":"rate_limited","message":"Rate limit exceeded; retry later."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Per-key ceiling exceeded (60/minute, 2000/hour, 20000/day). Back off and retry."},"500":{"content":{"application/json":{"example":{"error":"server_error","message":"Internal error. Please retry."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Something broke on our side. Safe to retry."}},"security":[{"ApiKeyAuth":[]}],"summary":"All-time daily OHLC borrow series","tags":["Borrow data"]}},"/api/v2/intraday/borrow":{"get":{"description":"Fee, rebate and availability at 15-minute granularity, returned as one continuous series however far back the window reaches.\n\n**Units:** one unit per symbol that returns at least one observation; the worst case checked against your units is one per symbol requested.\n\n**Coverage:** unlike the daily series this one has a floor \u2014 15-minute detail does not exist before `meta.earliest_available`. A window ending entirely before that floor is a `400` rather than a confidently empty answer; one that merely starts before it is clamped forward, and `meta.start` reports the window actually served. `meta.archive_incomplete` warns that part of the requested window could not be read, so the series may have gaps.\n\nNeeds a plan that includes the intraday API.","parameters":[{"description":"Comma-separated tickers, up to 100 per request. Case and whitespace are normalised and duplicates collapsed. Anything that doesn't resolve is reported in `meta.unresolved` rather than failing the request.","example":"GME,AMC,TSLA","in":"query","name":"symbols","required":true,"schema":{"type":"string"}},{"description":"First day to return, inclusive. Defaults to 7 days back from `end`.","example":"2026-01-02","in":"query","name":"start","required":false,"schema":{"format":"date","type":"string"}},{"description":"Last day to return, inclusive. Defaults to today and is clamped there.","example":"2026-01-02","in":"query","name":"end","required":false,"schema":{"format":"date","type":"string"}}],"responses":{"200":{"content":{"application/json":{"example":{"data":{"GME":{"country":"usa","currency":"USD","figi":"BBG000BB5BF6","name":"GAMESTOP CORP-CLASS A","observations":[{"available":200000,"datetime":"2026-07-27T15:45:00","fee":5.38,"rebate":-1.27},{"available":175000,"datetime":"2026-07-27T16:00:00","fee":5.41,"rebate":-1.3}],"previous_identities":[]}},"meta":{"archive_incomplete":false,"earliest_available":"2026-07-17","end":"2026-07-27","start":"2026-07-21","units_billed":1,"unresolved":["NOTATICKER"]}},"schema":{"$ref":"#/components/schemas/IntradayBorrowResponse"}}},"description":"The series, keyed by the symbol you asked for."},"400":{"content":{"application/json":{"example":{"details":{"symbols":["Provide at least one symbol, e.g. symbols=AAPL,MSFT."]},"error":"invalid_request","message":"Request parameters failed validation."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Parameters failed validation. `details` maps each bad field to what was wrong with it; cross-field problems (the resolved date window, the cost ceiling) land under `_schema`."},"401":{"content":{"application/json":{"example":{"error":"invalid_api_key","message":"Invalid or missing API key."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key is missing, malformed, revoked, or does not exist. The four are deliberately indistinguishable."},"402":{"content":{"application/json":{"example":{"error":"units_exhausted","message":"This request could cost up to 120 units and 40 are left. Narrow the request, or add units to your plan."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The request could cost more units than the account has left across its buckets (see `/usage`). Nothing was read or charged. Narrow the request, or add units."},"403":{"content":{"application/json":{"example":{"error":"no_api_access","message":"This account has no API plan that includes this endpoint."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key is valid, but the account behind it has no API plan that includes this endpoint."},"429":{"content":{"application/json":{"example":{"error":"rate_limited","message":"Rate limit exceeded; retry later."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Per-key ceiling exceeded (60/minute, 2000/hour, 20000/day). Back off and retry."},"500":{"content":{"application/json":{"example":{"error":"server_error","message":"Internal error. Please retry."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Something broke on our side. Safe to retry."}},"security":[{"ApiKeyAuth":[]}],"summary":"Batched 15-minute borrow series","tags":["Borrow data"]}},"/api/v2/usage":{"get":{"description":"Trailing usage for the account behind the key, plus its unit `buckets` in the order they are used up, each with its `remaining` units and the window it is usable in. Free to call and not metered.","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}},"description":"Usage over the trailing window."},"401":{"content":{"application/json":{"example":{"error":"invalid_api_key","message":"Invalid or missing API key."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key is missing, malformed, revoked, or does not exist. The four are deliberately indistinguishable."},"403":{"content":{"application/json":{"example":{"error":"no_api_access","message":"This account has no API plan that includes this endpoint."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"The key is valid, but the account behind it has no API plan that includes this endpoint."},"429":{"content":{"application/json":{"example":{"error":"rate_limited","message":"Rate limit exceeded; retry later."},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Per-key ceiling exceeded (60/minute, 2000/hour, 20000/day). Back off and retry."}},"security":[{"ApiKeyAuth":[]}],"summary":"Your trailing usage and the units you have left","tags":["Account"]}}},"servers":[{"url":"https://www.iborrowdesk.com"}],"tags":[{"description":"The metered series endpoints.","name":"Borrow data"},{"description":"Usage and limits. Free to call.","name":"Account"}]}
