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

# Get Price-to-Beat (PTB) values for crypto up/down contracts

> Returns the oracle price captured at the start of each requested window
("the price to beat"), nested `{window: {symbol: {...}}}`. `windows` is
comma-separated; each must be one of `1m, 5m, 15m, 1h, 4h, 1d`. Window
starts align to clean ET boundaries. Only **window** PTB sources are
accepted: `binance`, `kalshi_cfbenchmarks`, `polymarket_twap30`,
`polymarket_twap60`. Contract-tick series (`polymarket_chainlink`,
`hyperliquid_mark`) are not window benchmarks and are rejected. When
`source` is omitted, the server picks Binance or a legacy TWAP series
from the `oracle_twap_feed` flag. Binance may fall back to an external
market-data source for missing symbols; venue series do not. Symbols
with no resolvable price for a window are **omitted** (not `null`).




## OpenAPI

````yaml /openapi/data-api.yaml get /markets/crypto/ptb
openapi: 3.1.0
info:
  title: Kairos Data API
  version: 1.0.0
  summary: >-
    The full Kairos data plane — markets, candles, trades, search, discover,
    sports, trader analytics, and PnL.
  description: |
    The Kairos Data API at `data.kairos.trade` is the platform's primary data
    plane: market metadata and prices, OHLCV candles, live venue trade proxies,
    normalized trade history, full-text search, discovery feeds, the sports
    catalog, public trader analytics, and account PnL.

    ## Authentication

    Most endpoints accept a Kairos **API key** (`X-Client-Id` + `X-Api-Key` +
    `X-Api-Secret`, all three) or a first-party session JWT. Endpoints tagged
    `public` (trader analytics, provider configs, several sports feeds) need
    no credentials at all. Some endpoints additionally require an API-key
    **scope** (`trade:read`, `position:read`) — stated per operation.

    For high-volume market-data consumption (candles/trades/metadata at
    scale), prefer the dedicated **Market Data API** at `md.kairos.trade` —
    it has higher budgets, ETag caching, and a binary candle format.

    ## Rate limits

    Rate limits use a sliding window keyed on the authenticated user (JWT
    `sub`) or, for anonymous callers, the trusted client IP. Routes belong to
    a named **bucket** (`x-kairos-bucket`) whose per-minute budget is shared
    by every route in it; routes with no bucket run under the service default
    of 100/minute. `x-kairos-rate-limit` states the bucket's compile-time
    default — operators can raise or lower a bucket at runtime, so treat the
    documented number as the baseline, not a contract. 429 responses carry
    `Retry-After` and `X-RateLimit-*`.

    ## Conventions

    - Prices are on the **0–100 cents scale** unless a field says otherwise
      (trader-analytics position/trade prices use the 0–1 scale; each field's
      description states its scale).
    - Errors: `{"detail": "<message>"}` for handler errors; FastAPI's
      standard validation envelope for 422s. Errors surfaced from a venue
      adapter instead use `{"error", "provider", "operation", "message"}` —
      see `DataProviderError`. Unhandled failures always return the generic
      500 body; internal details are logged, never returned.
    - Every request body is capped at 8 MiB service-wide (413).
  contact:
    name: Kairos
    url: https://app.kairos.trade/docs/api-reference
  termsOfService: https://kairos.trade/terms
servers:
  - url: https://data.kairos.trade
    description: Production
  - url: https://staging-data.kairos.trade
    description: Staging
security:
  - apiKeyClientId: []
    apiKeyKey: []
    apiKeySecret: []
paths:
  /markets/crypto/ptb:
    get:
      tags:
        - Markets
      summary: Get Price-to-Beat (PTB) values for crypto up/down contracts
      description: |
        Returns the oracle price captured at the start of each requested window
        ("the price to beat"), nested `{window: {symbol: {...}}}`. `windows` is
        comma-separated; each must be one of `1m, 5m, 15m, 1h, 4h, 1d`. Window
        starts align to clean ET boundaries. Only **window** PTB sources are
        accepted: `binance`, `kalshi_cfbenchmarks`, `polymarket_twap30`,
        `polymarket_twap60`. Contract-tick series (`polymarket_chainlink`,
        `hyperliquid_mark`) are not window benchmarks and are rejected. When
        `source` is omitted, the server picks Binance or a legacy TWAP series
        from the `oracle_twap_feed` flag. Binance may fall back to an external
        market-data source for missing symbols; venue series do not. Symbols
        with no resolvable price for a window are **omitted** (not `null`).
      operationId: getCryptoPriceToBeat
      parameters:
        - name: windows
          in: query
          required: false
          schema:
            type: string
            default: 15m
          description: >-
            Comma-separated windows. Each must be one of 1m, 5m, 15m, 1h, 4h,
            1d.
          example: 5m,15m
        - name: source
          in: query
          required: false
          schema:
            type: string
            enum:
              - binance
              - kalshi_cfbenchmarks
              - polymarket_twap30
              - polymarket_twap60
          description: |
            ET-aligned window source. New market clients should pass this
            explicitly. TWAP30 remains for legacy 1m overlays.
          example: kalshi_cfbenchmarks
      responses:
        '200':
          description: PTB values nested by window then symbol.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketsPtbResponse'
        '400':
          description: No windows given, or an invalid window value.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: >-
                      Invalid window: 30m. Must be one of: ['15m', '1d', '1h',
                      '1m', '4h', '5m']
        '401':
          $ref: '#/components/responses/DataUnauthorized'
        '403':
          $ref: '#/components/responses/DataForbidden'
        '422':
          $ref: '#/components/responses/DataValidationError'
        '429':
          $ref: '#/components/responses/DataRateLimited'
        '500':
          description: Oracle store/source lookup failed for one or more windows.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: Failed to fetch price-to-beat values
components:
  schemas:
    MarketsPtbResponse:
      type: object
      description: Keyed by window (1m/5m/15m/1h/4h/1d), each value keyed by symbol.
      additionalProperties:
        $ref: '#/components/schemas/MarketsPtbWindowValues'
    MarketsPtbWindowValues:
      type: object
      description: >-
        Keyed by oracle symbol (btc-usd/eth-usd/sol-usd/xrp-usd). A symbol is
        omitted entirely if no price could be resolved for this window.
      additionalProperties:
        $ref: '#/components/schemas/MarketsPtbValue'
    DataError:
      type: object
      description: Handler error envelope (FastAPI HTTPException).
      required:
        - detail
      properties:
        detail:
          type: string
          description: Human-readable error message.
          example: Invalid provider
    MarketsPtbValue:
      type: object
      required:
        - price
        - timestamp_ms
        - game_start_ms
      properties:
        price:
          type: number
          example: 97000.5
        timestamp_ms:
          type: integer
          description: >-
            Actual epoch-ms timestamp of the oracle sample used (may differ
            slightly from game_start_ms).
        game_start_ms:
          type: integer
          description: Epoch-ms start of the requested window (the "price to beat" anchor).
  responses:
    DataUnauthorized:
      description: >
        No valid credential presented — missing/invalid API-key headers, or an
        invalid/expired session token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DataError'
          example:
            detail: Not authenticated
    DataForbidden:
      description: >
        Authenticated but not permitted. Three distinct causes: the session user
        is not invited

        (`Invite required`), the API key lacks the operation's scope, or API-key
        access to the

        requested venue is switched off (`API access is disabled for
        <provider>`). Admin and API-key

        callers bypass the invite check; session and admin callers bypass scope
        and venue checks.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DataError'
          example:
            detail: Invite required
    DataValidationError:
      description: Request failed FastAPI parameter validation.
      content:
        application/json:
          schema:
            type: object
            required:
              - detail
            properties:
              detail:
                type: array
                description: >-
                  One entry per failed field, with location, message, and error
                  type.
                items:
                  type: object
                  additionalProperties: true
    DataRateLimited:
      description: >
        Rate limit exceeded for this route's sliding window, keyed on the
        session `sub` when

        authenticated and on the trusted client IP otherwise. Honor
        `Retry-After`. A per-API-key

        data ceiling (set per credential) rejects with `{"detail": "API key data
        rate limit

        exceeded"}` instead of the `error` envelope below.
      headers:
        Retry-After:
          schema:
            type: integer
        X-RateLimit-Limit:
          schema:
            type: integer
        X-RateLimit-Remaining:
          schema:
            type: integer
        X-RateLimit-Reset:
          schema:
            type: integer
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: 'Rate limit exceeded: 100 per 1 minute'
  securitySchemes:
    apiKeyClientId:
      type: apiKey
      in: header
      name: X-Client-Id
      description: >-
        Credential client id (`kairos_ck_...`). Must be sent together with
        X-Api-Key and X-Api-Secret.
    apiKeyKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: 64-char hex API key.
    apiKeySecret:
      type: apiKey
      in: header
      name: X-Api-Secret
      description: 64-char hex API secret.

````

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