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

# Quote stream

> Re-quotes one pair on an interval and streams each result as Server-Sent Events. Costs ONE PER TICK against the 300/min quote budget.

SERVER-SIDE ONLY: authentication is the `Authorization` header, and the browser EventSource API cannot set headers — which is correct, because your key is a secret. Consume this from your backend and relay it over your own transport.

Events: `open` (echoed config) → `quote` → `close`. Also `error` (the stream CONTINUES) and `throttled` (budget spent; ticks resume when the window rolls). `: hb` comment lines every 20s keep intermediaries from idling the connection out.



## OpenAPI

````yaml https://www.oceanx.trade/api/v1/openapi.json get /api/v1/spot/quote/stream
openapi: 3.1.0
info:
  title: OceanX Developer API
  version: 1.0.0
  description: >-
    Public API for the OceanX trading platform. Currently in beta and free to
    use while in beta.


    This spec covers the **spot quote** domain. The wallet **tracker** and
    **perps** domains are documented at https://docs.oceanx.trade/api/overview
    and are not yet described here.
  contact:
    url: https://docs.oceanx.trade
  termsOfService: https://www.oceanx.trade/legal/terms
  license:
    name: Proprietary
    url: https://www.oceanx.trade/legal/terms
servers:
  - url: https://www.oceanx.trade
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Market Data
    description: Read-only OceanX market context sourced and cached by VM producers.
  - name: Spot
    description: >-
      Executable Solana swap quotes off OceanX's own router, and the exit
      checker that reports whether a whole position can be sold.
  - name: Callouts
    description: >-
      Public token callouts — user-posted token calls with live click/volume
      attribution stats. Read-only.
paths:
  /api/v1/spot/quote/stream:
    get:
      tags:
        - Spot
      summary: Quote stream
      description: >-
        Re-quotes one pair on an interval and streams each result as Server-Sent
        Events. Costs ONE PER TICK against the 300/min quote budget.


        SERVER-SIDE ONLY: authentication is the `Authorization` header, and the
        browser EventSource API cannot set headers — which is correct, because
        your key is a secret. Consume this from your backend and relay it over
        your own transport.


        Events: `open` (echoed config) → `quote` → `close`. Also `error` (the
        stream CONTINUES) and `throttled` (budget spent; ticks resume when the
        window rolls). `: hb` comment lines every 20s keep intermediaries from
        idling the connection out.
      operationId: getSpotQuoteStream
      parameters:
        - name: inputMint
          in: query
          required: true
          schema:
            type: string
            pattern: ^[1-9A-HJ-NP-Za-km-z]{32,44}$
            description: Base58 Solana mint address.
        - name: outputMint
          in: query
          required: true
          schema:
            type: string
            pattern: ^[1-9A-HJ-NP-Za-km-z]{32,44}$
            description: Base58 Solana mint address.
        - name: amount
          in: query
          schema:
            type: string
            pattern: ^\d+$
            description: >-
              Atomic (base-unit) amount as a decimal integer string. A string,
              not a number, because a large 9-decimal balance exceeds
              Number.MAX_SAFE_INTEGER and would be corrupted by JSON float
              parsing.
            example: '1000000000'
        - name: uiAmount
          in: query
          schema:
            type: number
            exclusiveMinimum: 0
        - name: inputDecimals
          in: query
          schema:
            type: integer
            minimum: 0
            maximum: 18
        - name: slippageBps
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 50
        - name: intervalMs
          in: query
          schema:
            type: integer
            minimum: 250
            maximum: 60000
            default: 1000
          description: Re-quote cadence.
        - name: maxSeconds
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 240
            default: 240
          description: Connection lifespan. We always close with a `close` event.
        - name: onlyChanges
          in: query
          schema:
            type: boolean
            default: false
          description: Emit only when the proceeds or the chosen route actually move.
      responses:
        '200':
          description: An SSE stream.
          headers:
            X-RateLimit-Limit:
              schema:
                type: integer
              description: Requests allowed per window.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: Requests left.
            X-RateLimit-Reset:
              schema:
                type: integer
              description: Unix seconds when the window resets.
          content:
            text/event-stream:
              schema:
                type: string
                description: SSE frames; see the description.
        '400':
          description: Failed validation before reaching the engine.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing, malformed or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The key is valid but lacks the required scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limited. Honour `Retry-After`.
          headers:
            X-RateLimit-Limit:
              schema:
                type: integer
              description: Requests allowed per window.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: Requests left.
            X-RateLimit-Reset:
              schema:
                type: integer
              description: Unix seconds when the window resets.
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: The routing engine is unreachable or timed out. Retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable machine-readable code. Branch on this, not the message.
              example: no_route
            message:
              type: string
              description: Human-readable detail. May change.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An OceanX API key, created in the app under Settings → Developer API.
        Send it as `Authorization: Bearer ox_live_…`. These endpoints require
        the `md.read` scope, which is on every key by default.

````