> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qelso.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Order books

> The order book at one millisecond, or sampled on a time grid. Give either `at`, or `start` and `end` (with `interval`), not both.

- **`at`:** the book with every change at or before `at` applied. `data` holds one book, with `t` = `at`.
- **`start`, `end`, `interval`:** one book per interval `[t, t + interval)` in the window, as of the interval's end, like prices. Intervals with no data at their end have null `bids` and `asks`.
- **`last_change`:** the time of the latest change included in each book.

**Availability:**
- **Kalshi:** from 17 October 2026, exact to the millisecond.
- **Polymarket:**
  - At intervals of 1m and coarser, from `book_snapshots`' `available_from` in `GET /v2/venues`: each book is the latest minute book at or before the interval's end. `last_change` is that book's time; the change itself may be earlier.
  - At a millisecond, or below 1m: from `book_updates`' `available_from` in `GET /v2/venues`. `last_change` there can be earlier or later than the book's latest real change: for exact times, use `book-updates`.

**Datasets read:** `book_snapshots`, `book_updates`.

**Access:** `minute` for intervals of 1m and coarser; `subminute` for `at` and for intervals below 1m. **Cost:** 1 unit per page; 5 for `at` and below 1m.

**Limits:** a page holds up to `limit` books and stops at 100,000 price levels. Below 1m, the window is ≤ 6 h and ≤ 100,000 intervals. On Polymarket below 1m, a page can also stop sooner, on markets whose book changes very often.

**Streams:** NDJSON only. Resume key: `after=<t>`.




## OpenAPI

````yaml /openapi.json get /v2/markets/{market_id}/books
openapi: 3.1.0
info:
  title: Qelso Data API
  version: 2.1.0
  summary: >-
    Historical prediction-market data from Kalshi and Polymarket, from daily
    bars to individual order-book changes.
  description: >
    The Qelso Data API serves historical data from prediction-market venues
    through one set of endpoints:

    market discovery, minute and sub-minute prices, the order book at any
    millisecond, best bid/ask

    and book changes, and trades.


    ## Authentication

    - Send your API key in the `X-API-Key` header on every request (`GET
    /v2/health` needs none).

    - Existing API keys work here.

    - Your plan and add-ons decide which venues and data you can read. `GET
    /v2/usage` shows them.


    ## Venues and IDs

    - Every market, event and series has an ID made of the venue and the venue's
    own ID, separated by a colon. Examples:
      - market `kalshi:KXFEDDECISION-26OCT-H0` or `polymarket:560868`;
      - event `kalshi:KXFEDDECISION-26OCT`;
      - series `kalshi:KXFEDDECISION`.
    - For Polymarket, the part after the colon may also be the slug. Responses
    always return the numeric form.

    - Kalshi tickers are case-insensitive.

    - Responses also carry the venue's own IDs: `native_id` everywhere, and
    `native` in market details.

    - `GET /v2/venues` lists the venues, the datasets each one provides, and
    from when.

    - Combo (multivariate) markets are not covered.


    ## One market, one book: the YES side

    - Every market has two outcomes, YES and NO, and one order book: the **YES
    book**, bids and asks, best first.
      - On Kalshi, a NO bid at p is a YES ask at 1 − p.
      - Polymarket's two tokens mirror each other, so the YES token's book is the market's whole book. Never add the two together.
    - **`outcome=no`** returns the NO view on every price endpoint: prices
    become 1 − p, and bids and asks swap.

    - Many Polymarket markets have outcomes other than "Yes" and "No": two
    teams, "Over"/"Under", "Up"/"Down". On those, YES is the venue's
    first-listed outcome and NO the second. Every market object, and the
    `market` object of every history response, gives both labels in `outcomes`,
    e.g. `{"yes": {"label": "Browns"}, "no": {"label": "Steelers"}}`.

    - Scalar markets (`market_type: scalar`) settle at any value from 0 to 1
    (`settlement_value`).


    ## Time

    - **Inputs** take three forms:
      - RFC 3339 (`2026-10-18T14:00:00Z`). Offsets are allowed; no offset means UTC.
      - A date (`2026-10-18`), meaning midnight UTC.
      - Epoch **milliseconds**.

      Digits beyond milliseconds are dropped.
    - **Windows** are `[start, end)`: `start` is included, `end` is not. An
    `end` later than now is treated as now.

    - **Outputs** are RFC 3339 UTC with milliseconds
    (`2026-10-18T14:00:00.000Z`).

    - **Grid rows** (prices, candles, stats, sampled books) each cover one
    interval `[t, t + resolution)` on the UTC grid:
      - 1m on the minute; 1h on the hour; 6h at 00, 06, 12 and 18; 1d at midnight;
      - 1s and 100ms on whole seconds and tenths.

      `t` is the interval's start. Prices, books and the state fields of stats are as of the interval's **end** (its close), so every grid endpoint lines up on `t`. Only whole intervals inside the window are returned.

      A row has `carried: true` when nothing changed in its interval, so its values repeat the previous row's. Where there is no data at an interval's end, its values are null.
    - **Event rows** (best bid/ask changes, book changes, trades) carry:
      - `ts`: the venue's time, in milliseconds;
      - `seq`: orders a market's rows that share the same `ts`, from 1. `(ts, seq)` is a row's position in the market; don't compare it across markets.

    ## Prices and sizes

    - Prices are numbers from 0 to 1 (dollars per $1 contract, the implied
    probability), with up to 6 decimals, on every venue.

    - Sizes are in contracts (Kalshi) or shares (Polymarket), with up to 6
    decimals.

    - `mid` = (bid + ask) / 2. An empty bid counts as 0 and an empty ask as 1.
    It is null when both sides are empty.


    ## Pagination

    - Lists and history pages return `next_cursor`. Pass it back as `cursor`,
    with the same parameters, until it is null.

    - Cursors are opaque, tied to the request that produced them, and valid for
    24 hours.

    - On history endpoints, a paging run serves the data available when its
    first page was served, so its pages never skip or repeat a row, unless the
    data is corrected while you page. Data that arrives later appears when you
    request again.


    ## Streams

    - History endpoints also stream. Send one of:
      - `Accept: application/x-ndjson`: one JSON row per line, the same objects as in `data`;
      - `Accept: text/csv`: a header row first.

      Books stream as NDJSON only. Discovery and lifecycle don't stream.
    - Streams carry rows only. For Kalshi data, the attribution and data type
    come in the `Qelso-Attribution` and `Qelso-Data-Type` response headers.

    - A stream that ends normally has delivered every row we hold for the
    window.

    - If anything fails after the first byte, we close the connection without
    finishing the response, so your HTTP client raises an error. Resume with
    `after=` set to the last row's key (each endpoint gives the fields).

    - Send `Accept-Encoding: gzip` for large streams.


    ## Limits

    Rate limits are counted in **units per minute per organisation**. Each
    response's `Qelso-Units` header gives its cost; `X-RateLimit-Limit`,
    `X-RateLimit-Remaining` and `X-RateLimit-Reset` give your budget.


    | Class | Endpoints | Page size | Window per request | Units |

    |---|---|---|---|---|

    | Reference | venues, categories, series, events, markets, market,
    lifecycle, usage | ≤ 1,000 items (default 100) | — | 1 |

    | Minute | prices, candles and stats at 1m–1d; books at intervals of 1m–1d |
    ≤ 1,000 points | no limit (your plan's history window applies) | 1 |

    | Sub-minute | prices and candles at 1s and 100ms; books `at` a millisecond
    or at intervals below 1m | ≤ 10,000 points (books ≤ 1,000) | ≤ 6 h; books
    also ≤ 100,000 intervals | 5 |

    | Ticks | bbo, book-updates | ≤ 10,000 rows | ≤ 6 h | 10 |

    | Ticks | trades | ≤ 10,000 rows | ≤ 31 days | 10 |

    | Streams | prices, candles, stats, books, bbo, book-updates, trades with
    `Accept: application/x-ndjson` or `text/csv` | — | ≤ 24 h (sub-minute, bbo,
    book-updates; books below 1m also ≤ 100,000 intervals); ≤ 31 days (trades);
    ≤ 366 days (1m–1d) | the endpoint's page cost |


    - Book pages also stop at 100,000 price levels.

    - Requests rejected with 400, 403, 404 or 406 cost 1 unit. `GET /v2/health`
    is free.

    - Each organisation may run at most **2 streams**, **4 sub-minute or tick
    requests** and **2 list or search requests** (series, events and markets) at
    once.

    - Plans may have monthly quotas, per calendar month in UTC, shown by `GET
    /v2/usage` with what's used:
      - **rows:** the data rows you receive (prices, candles, stats, books, best bid/ask, book changes and trades, in pages and streams), with the rows of files you buy in the store;
      - **requests:** data requests answered with at least one row.

      Lists, search, details and `GET /v2/usage` never count, and a used-up quota never refuses them. A quota may let data through past its `limit` before it refuses.
    - A stream won't start when its quota is used up. Once started, a stream is
    never cut off for rate or quota, so it may finish slightly over.


    ## Errors

    Errors share one shape: `{"error": {"code": "...", "message": "...",
    "request_id": "...", "details": {...}}}`. The `code` values are stable:


    | HTTP | `code` | Meaning |

    |---|---|---|

    | 400 | `invalid_parameter` | A parameter is missing, malformed or out of
    range (`details.parameter`) |

    | 400 | `invalid_cursor` | The cursor is malformed or expired, or was sent
    with different parameters |

    | 400 | `window_too_large` | The window or number of intervals is over this
    endpoint's limit (`details.max`) |

    | 401 | `unauthorized` | The key is missing, invalid, revoked or expired |

    | 403 | `forbidden_venue` | No access to this venue (`details.reason`:
    `not_in_plan`, `eligibility_required` or `not_yet_available`) |

    | 403 | `forbidden_dataset` | This data isn't available to you on this venue
    (`details.reason`: `not_in_plan`, or `not_offered` when we don't offer it on
    that venue) |

    | 403 | `plan_history_limit` | `start` is earlier than your plan allows
    (`details.earliest_allowed`) |

    | 403 | `plan_resolution_not_allowed` | The resolution or interval is finer
    than your plan allows (`details.min_resolution`) |

    | 403 | `suspended` | Your organisation's access to this venue is suspended
    |

    | 404 | `not_found` | Unknown market, event, series or path |

    | 406 | `not_acceptable` | This endpoint can't return the format asked for
    in `Accept` |

    | 429 | `rate_limited` | Over your units per minute or your concurrent
    requests; wait `Retry-After` seconds |

    | 429 | `quota_exceeded` | A monthly quota is used up (`details.resets_at`);
    don't retry automatically |

    | 500 | `internal_error` | Our fault; retry with backoff and quote
    `request_id` |

    | 503 | `metadata_refreshing` | Market metadata is being refreshed; retry
    after `Retry-After` seconds |

    | 503 | `service_unavailable` | Temporarily unavailable; retry after
    `Retry-After` seconds |

    | 504 | `timeout` | The query ran over its time limit; narrow the window, or
    use a stream |


    ## Kalshi data

    - Every response and stream that contains Kalshi data carries
    `"attribution": "Powered by Kalshi Research"` and a `data_type`:
      - `historical`: all of the data is at least 24 hours old;
      - `delayed`: some of it is newer.
    - Show the attribution wherever you display Kalshi data.

    - Kalshi data is available to eligible organisations whose plan includes it.


    ## Coming from v1

    - IDs carry the venue: `polymarket:560868` or `polymarket:<slug>`.

    - Tokens are gone. There is one YES book per market; use `outcome=no` for
    the NO side.

    - Prices at 10m, 1h, 6h and 1d are interval closes, not averages. Sampled
    books are as of each interval's end, not its start, so they line up with
    prices.

    - Errors have stable codes. Limits are counted in units, not requests.


    ## Versioning

    - v2 changes only by addition: new endpoints, parameters, fields and enum
    values (venues, datasets, entitlements, lifecycle types, error codes) may
    appear. Treat unknown values as "other".

    - Anything that would break a client goes into a new version, with notice.
servers:
  - url: https://api.qelso.io
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Reference
    description: Venues, categories and what's available.
  - name: Discovery
    description: Series, events and markets on every venue.
  - name: History
    description: >-
      Prices, candles, statistics and order books, from daily to 100-millisecond
      intervals.
  - name: Ticks
    description: Best bid/ask changes, order-book changes and trades.
  - name: Account
    description: Usage, limits and health.
paths:
  /v2/markets/{market_id}/books:
    get:
      tags:
        - History
      summary: Order books
      description: >
        The order book at one millisecond, or sampled on a time grid. Give
        either `at`, or `start` and `end` (with `interval`), not both.


        - **`at`:** the book with every change at or before `at` applied. `data`
        holds one book, with `t` = `at`.

        - **`start`, `end`, `interval`:** one book per interval `[t, t +
        interval)` in the window, as of the interval's end, like prices.
        Intervals with no data at their end have null `bids` and `asks`.

        - **`last_change`:** the time of the latest change included in each
        book.


        **Availability:**

        - **Kalshi:** from 17 October 2026, exact to the millisecond.

        - **Polymarket:**
          - At intervals of 1m and coarser, from `book_snapshots`' `available_from` in `GET /v2/venues`: each book is the latest minute book at or before the interval's end. `last_change` is that book's time; the change itself may be earlier.
          - At a millisecond, or below 1m: from `book_updates`' `available_from` in `GET /v2/venues`. `last_change` there can be earlier or later than the book's latest real change: for exact times, use `book-updates`.

        **Datasets read:** `book_snapshots`, `book_updates`.


        **Access:** `minute` for intervals of 1m and coarser; `subminute` for
        `at` and for intervals below 1m. **Cost:** 1 unit per page; 5 for `at`
        and below 1m.


        **Limits:** a page holds up to `limit` books and stops at 100,000 price
        levels. Below 1m, the window is ≤ 6 h and ≤ 100,000 intervals. On
        Polymarket below 1m, a page can also stop sooner, on markets whose book
        changes very often.


        **Streams:** NDJSON only. Resume key: `after=<t>`.
      operationId: getMarketBooks
      parameters:
        - $ref: '#/components/parameters/MarketId'
        - name: at
          in: query
          description: One book at this instant. Not with `start`, `end` or `interval`.
          schema:
            $ref: '#/components/schemas/TimestampInput'
        - $ref: '#/components/parameters/StartOptional'
          description: Start of the grid (with `end`). Not with `at`.
        - $ref: '#/components/parameters/EndOptional'
          description: End of the grid, exclusive (with `start`). Not with `at`.
        - name: interval
          in: query
          description: >-
            Interval length, with `start` and `end` (1m if omitted). Not with
            `at`.
          schema:
            type: string
            enum:
              - 100ms
              - 1s
              - 1m
              - 10m
              - 1h
              - 6h
              - 1d
        - name: depth
          in: query
          description: Price levels per side, best first, or `all`.
          schema:
            anyOf:
              - type: integer
                minimum: 1
                maximum: 1000
              - type: string
                enum:
                  - all
            default: 10
        - $ref: '#/components/parameters/Outcome'
        - name: limit
          in: query
          description: Books per page.
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 1000
        - $ref: '#/components/parameters/Cursor'
        - $ref: '#/components/parameters/AfterT'
      responses:
        '200':
          description: A page of books, or an NDJSON stream of them.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            Qelso-Units:
              $ref: '#/components/headers/Qelso-Units'
            Qelso-Attribution:
              $ref: '#/components/headers/Qelso-Attribution'
            Qelso-Data-Type:
              $ref: '#/components/headers/Qelso-Data-Type'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BooksPage'
              examples:
                book_at_a_millisecond:
                  summary: >-
                    The book at one millisecond (illustrative values, top of
                    book)
                  value:
                    market:
                      id: kalshi:KXFEDDECISION-26DEC-H0
                      venue: kalshi
                      native_id: KXFEDDECISION-26DEC-H0
                      title: Fed holds rates in December 2026?
                      status: open
                      outcomes:
                        'yes':
                          label: Hold
                          token_id: null
                        'no':
                          label: 'No'
                          token_id: null
                      open_time: '2026-09-17T18:00:00.000Z'
                      close_time: '2026-12-09T18:55:00.000Z'
                    outcome: 'yes'
                    interval: null
                    depth: 1
                    data:
                      - t: '2026-11-03T14:03:07.250Z'
                        bids:
                          - - 0.47
                            - 600
                        asks:
                          - - 0.49
                            - 800
                        last_change: '2026-11-03T14:03:06.981Z'
                    next_cursor: null
                    attribution: Powered by Kalshi Research
                    data_type: historical
            application/x-ndjson:
              schema:
                type: string
                description: One BookSample object per line.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '406':
          $ref: '#/components/responses/NotAcceptable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/Unavailable'
        '504':
          $ref: '#/components/responses/Timeout'
components:
  parameters:
    MarketId:
      name: market_id
      in: path
      required: true
      description: >-
        Venue-qualified market ID. For Polymarket, the part after the colon may
        also be the slug.
      schema:
        $ref: '#/components/schemas/MarketId'
    StartOptional:
      name: start
      in: query
      description: Start of the window, inclusive.
      schema:
        $ref: '#/components/schemas/TimestampInput'
    EndOptional:
      name: end
      in: query
      description: End of the window, exclusive.
      schema:
        $ref: '#/components/schemas/TimestampInput'
    Outcome:
      name: outcome
      in: query
      description: >-
        `yes` (default) or `no`. On markets with other labels (two teams,
        Over/Under, Up/Down), `yes` is the venue's first-listed outcome;
        `market.outcomes` in the response names both. The NO view mirrors the
        YES book: prices become 1 − p, bids and asks swap (so do candle highs
        and lows), and trade aggressors flip.
      schema:
        $ref: '#/components/schemas/Outcome'
    Cursor:
      name: cursor
      in: query
      description: >-
        The `next_cursor` from the previous page. Send it with the same
        parameters.
      schema:
        type: string
        minLength: 1
        maxLength: 4096
    AfterT:
      name: after
      in: query
      description: >-
        Streams only: resume after the interval starting at this time (the last
        row's `t`).
      schema:
        $ref: '#/components/schemas/TimestampInput'
  schemas:
    TimestampInput:
      description: >-
        RFC 3339 date-time (no offset means UTC), a date (midnight UTC), or
        epoch milliseconds.
      anyOf:
        - type: string
          format: date-time
        - type: string
          format: date
        - type: integer
          minimum: 100000000000
          description: Epoch milliseconds.
      examples:
        - '2026-11-03T14:00:00Z'
        - '2026-11-03'
        - 1793714400000
    BooksPage:
      type: object
      required:
        - market
        - outcome
        - interval
        - depth
        - data
        - next_cursor
      properties:
        market:
          $ref: '#/components/schemas/MarketRef'
        outcome:
          $ref: '#/components/schemas/Outcome'
        interval:
          anyOf:
            - $ref: '#/components/schemas/Resolution'
            - type: 'null'
          description: Null for a book `at` a millisecond.
        depth:
          anyOf:
            - type: integer
              minimum: 1
              maximum: 1000
            - type: string
              enum:
                - all
        data:
          type: array
          items:
            $ref: '#/components/schemas/BookSample'
        next_cursor:
          $ref: '#/components/schemas/NextCursor'
        attribution:
          $ref: '#/components/schemas/Attribution'
        data_type:
          $ref: '#/components/schemas/DataType'
    MarketId:
      type: string
      description: Venue and the venue's market ID, separated by a colon.
      pattern: ^[a-z][a-z0-9_]{1,31}:[^/\s]{1,256}$
      examples:
        - kalshi:KXFEDDECISION-26OCT-H0
        - polymarket:560868
    Outcome:
      type: string
      enum:
        - 'yes'
        - 'no'
      default: 'yes'
    MarketRef:
      type: object
      description: The market a history response is about.
      required:
        - id
        - venue
        - native_id
        - title
        - status
        - outcomes
        - open_time
        - close_time
      properties:
        id:
          $ref: '#/components/schemas/MarketId'
        venue:
          $ref: '#/components/schemas/Venue'
        native_id:
          type: string
        title:
          type: string
        status:
          $ref: '#/components/schemas/MarketStatus'
        outcomes:
          $ref: '#/components/schemas/Outcomes'
        open_time:
          anyOf:
            - $ref: '#/components/schemas/Time'
            - type: 'null'
        close_time:
          anyOf:
            - $ref: '#/components/schemas/Time'
            - type: 'null'
    Resolution:
      type: string
      enum:
        - 100ms
        - 1s
        - 1m
        - 10m
        - 1h
        - 6h
        - 1d
      default: 1m
    BookSample:
      type: object
      required:
        - t
        - bids
        - asks
        - last_change
      properties:
        t:
          $ref: '#/components/schemas/Time'
          description: >-
            The interval's start (the book is as of its end); for a book `at` a
            millisecond, that moment.
        bids:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/PriceLevel'
          description: Best (highest) first. Null when there is no data for that time.
        asks:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/PriceLevel'
          description: Best (lowest) first. Null when there is no data for that time.
        last_change:
          anyOf:
            - $ref: '#/components/schemas/Time'
            - type: 'null'
          description: The time of the latest change included in this book.
    NextCursor:
      type:
        - string
        - 'null'
      description: Pass as `cursor` for the next page; null on the last page.
    Attribution:
      type: string
      description: Present when the response contains Kalshi data.
      enum:
        - Powered by Kalshi Research
    DataType:
      type: string
      description: >-
        Present when the response contains Kalshi data. `historical` if all of
        it is at least 24 hours old, otherwise `delayed`.
      enum:
        - historical
        - delayed
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - request_id
          properties:
            code:
              $ref: '#/components/schemas/ErrorCode'
            message:
              type: string
              description: For people; may change. Use `code` in programs.
            request_id:
              type: string
            details:
              type: object
              additionalProperties: true
              description: >-
                Machine-readable specifics: the parameter at fault, the limit,
                the reason, when a quota resets.
    Venue:
      description: 'A venue code. Known values: `kalshi`, `polymarket`; more will be added.'
      anyOf:
        - type: string
          enum:
            - kalshi
            - polymarket
        - type: string
          pattern: ^[a-z][a-z0-9_]{1,31}$
    MarketStatus:
      type: string
      description: >
        The same five statuses on every venue:


        | Status | Kalshi | Polymarket |

        |---|---|---|

        | `unopened` | `initialized` | — |

        | `open` | `active` | open |

        | `paused` | `inactive` | — |

        | `closed` | past close, not yet finalized (`closed`, `determined`,
        `disputed`, `amended`) | closed, no result yet |

        | `settled` | `finalized` | resolved |


        `venue_status` gives the venue's own value. A result can appear while a
        market is still `closed` (Kalshi `determined`), and can change after a
        dispute.
      enum:
        - unopened
        - open
        - paused
        - closed
        - settled
    Outcomes:
      type: object
      required:
        - 'yes'
        - 'no'
      properties:
        'yes':
          $ref: '#/components/schemas/OutcomeInfo'
        'no':
          $ref: '#/components/schemas/OutcomeInfo'
    Time:
      type: string
      format: date-time
      description: RFC 3339 UTC with milliseconds.
      pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$
      examples:
        - '2026-11-03T14:03:07.250Z'
    PriceLevel:
      type: array
      description: One price level as `[price, size]`.
      prefixItems:
        - $ref: '#/components/schemas/Price'
        - $ref: '#/components/schemas/Size'
      items: false
      minItems: 2
      maxItems: 2
      examples:
        - - 0.47
          - 600
    ErrorCode:
      description: >-
        A stable error code (see "Errors" in the introduction). More may be
        added.
      anyOf:
        - type: string
          enum:
            - invalid_parameter
            - invalid_cursor
            - window_too_large
            - unauthorized
            - forbidden_venue
            - forbidden_dataset
            - plan_history_limit
            - plan_resolution_not_allowed
            - suspended
            - not_found
            - not_acceptable
            - rate_limited
            - quota_exceeded
            - internal_error
            - metadata_refreshing
            - service_unavailable
            - timeout
        - type: string
    OutcomeInfo:
      type: object
      required:
        - label
        - token_id
      properties:
        label:
          type: string
          description: >-
            The venue's label for this outcome, e.g. "Yes", "Hold" or a team
            name. On Kalshi, `yes` is the market's own short line (e.g. "Over
            9.5 points"), or "Yes" when it has none, and `no` is "No".
        token_id:
          type:
            - string
            - 'null'
          description: Polymarket's token ID for this outcome; null on Kalshi.
  headers:
    X-Request-ID:
      description: Unique ID of this request. Quote it when you contact support.
      schema:
        type: string
    X-RateLimit-Limit:
      description: Units your organisation may use per minute. Absent when unlimited.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Units left in the current minute.
      schema:
        type: integer
    X-RateLimit-Reset:
      description: Epoch seconds when the current minute window resets.
      schema:
        type: integer
    Qelso-Units:
      description: >-
        Units this request cost. A stream costs its endpoint's page cost; its
        rows count against your monthly quota instead.
      schema:
        type: integer
        minimum: 0
    Qelso-Attribution:
      description: >-
        Present when the response contains Kalshi data. Always `Powered by
        Kalshi Research`.
      schema:
        type: string
        enum:
          - Powered by Kalshi Research
    Qelso-Data-Type:
      description: >-
        Present when the response contains Kalshi data. `historical` if all of
        it is at least 24 hours old, otherwise `delayed`.
      schema:
        type: string
        enum:
          - historical
          - delayed
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
        minimum: 0
  responses:
    BadRequest:
      description: '`invalid_parameter`, `invalid_cursor` or `window_too_large`.'
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: window_too_large
              message: This request serves at most 6 hours. Use a stream for more.
              request_id: 4f0c2a9e-0b7e-4f3e-9a51-2a8c3d1f6e20
              details:
                parameter: end
                max: PT6H
    Unauthorized:
      description: '`unauthorized`.'
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: Missing or invalid API key.
              request_id: 0a6f9c1e-55b2-4d7c-8a0e-6b3f2c9d1e44
    Forbidden:
      description: >-
        `forbidden_venue`, `forbidden_dataset`, `plan_history_limit`,
        `plan_resolution_not_allowed` or `suspended`.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: forbidden_dataset
              message: Your access to kalshi doesn't include tick data.
              request_id: 7d2e1b4a-9c3f-4e8d-b6a1-5f0e2c7d9a13
              details:
                venue: kalshi
                entitlement: ticks
                reason: not_in_plan
    NotFound:
      description: '`not_found`.'
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: Market kalshi:KXNOPE-26 not found.
              request_id: 2c9e7a1f-3b6d-4f0a-8e5c-1d4b7a2f9e61
    NotAcceptable:
      description: '`not_acceptable`: this endpoint can''t return the format in `Accept`.'
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: '`rate_limited` or `quota_exceeded`.'
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limited
              message: Rate limit exceeded; retry in 12 seconds.
              request_id: 9b1d3f7e-2a4c-4e6b-8d0f-3c5a7e9b1d24
              details:
                limit: units_per_minute
    InternalError:
      description: '`internal_error`.'
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unavailable:
      description: '`metadata_refreshing` or `service_unavailable`.'
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Timeout:
      description: '`timeout`: the query ran over its time limit.'
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Your API key, created in the dashboard. Example: `X-API-Key:
        pk_live_your_key_here`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.