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

# Live market stream (SSE)

> Stream live ScripX market snapshots over Server-Sent Events: per-scheme market events at a chosen interval with automatic client reconnect semantics.

The [market snapshot](/api-reference/trading/market), pushed: the same depth payload at your chosen interval. A `text/event-stream` of `event: market` messages. Requires the `market:read` scope.

Query parameters: `scheme` (default `RODTEP`), `interval` seconds between events (default 2), `limit` maximum events before the server closes the stream (default 600, cap 3600). Clients are expected to reconnect on close; treat the close as normal, not an error.

### Request example

```bash theme={"dark"}
curl -N "https://api.scripxhq.com/v1/market/stream?scheme=RODTEP&interval=2" \
  -H "X-ScripX-Key: <YOUR_API_KEY>"
```

### Stream example

```text theme={"dark"}
event: market
data: {"scheme":"RODTEP","depth":{"supply_paise":2400000000,"demand_paise":1900000000},"asof":"2026-07-24T11:00:02+05:30"}

event: market
data: {"scheme":"RODTEP","depth":{"supply_paise":2400000000,"demand_paise":1905000000},"asof":"2026-07-24T11:00:04+05:30"}
```

Every event counts against your rate limit's spirit but the stream itself is one call; prefer one stream over hammering the snapshot.

### Errors

* `401` / `403` / `429` before the stream opens, the standard [auth errors](/authentication#authentication-errors).

**Terms used here:** [scheme](/annexure/terminology#scheme), [paise](/annexure/terminology#paise), [firm quote](/annexure/terminology#firm-quote), [API key](/annexure/terminology#api-key), [scope](/annexure/terminology#scope). Full list in the [terminology annexure](/annexure/terminology).

### Next steps

* [Firm quote](/api-reference/trading/quote) when a level is worth trading.


## OpenAPI

````yaml GET /v1/market/stream
openapi: 3.1.0
info:
  title: ScripX Partner API
  version: 1.2.0
  description: >-
    Automate duty-credit-scrip trading: quote, order, positions, market,
    webhooks. Auth: `X-ScripX-Key: scripx_live_…`. Money = integer paise; price
    = bps of face.
  contact:
    name: ScripX API Support
    email: amin@eximfiles.io
    url: https://scripxhq.com
servers:
  - url: https://api.scripxhq.com
    description: >-
      Production and sandbox share one host; a scripx_test_ key selects the
      sandbox.
security:
  - ApiKeyAuth: []
tags:
  - name: Firms
    description: >-
      client-firm lifecycle: register, verify, authorize, credits, update,
      offboard
  - name: Trading
    description: quote, orders, positions, market
  - name: Group
    description: intra-group netting + positions (enterprise/broker)
  - name: Cross
    description: 'broker cross-desk: block deals + intra-group transfers'
  - name: Webhooks
    description: event subscriptions + delivery
  - name: Account
    description: usage + metering
  - name: Keys
    description: self-serve scoped child keys (sub-accounts)
paths:
  /v1/market/stream:
    get:
      tags:
        - Trading
      summary: Live market stream (Server-Sent Events)
      description: >-
        An `text/event-stream` of `event: market` snapshots. Query: `scheme`
        (default RODTEP), `interval` seconds (default 2), `limit` max events
        (default 600, cap 3600). Clients reconnect on close.
      parameters:
        - name: scheme
          in: query
          required: false
          schema:
            type: string
            enum:
              - RODTEP
              - ROSCTL
        - name: interval
          in: query
          required: false
          schema:
            type: number
            default: 2
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            default: 600
            maximum: 3600
      responses:
        '200':
          description: SSE stream
          content:
            text/event-stream:
              schema:
                type: string
        '401':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          description: stable machine code
          enum:
            - bad_request
            - unauthorized
            - forbidden
            - not_found
            - conflict
            - unprocessable
            - rate_limited
            - internal
        message:
          type: string
        detail:
          type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-ScripX-Key
      description: >-
        Your API key, e.g. `scripx_live_…`. Bound to one firm; tenant isolation
        is enforced.

````