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

# Real-time event stream (WebSocket)

> Live push of the **same events and payloads** your webhooks receive, over a plain WebSocket. Use it for dashboards, monitoring, or low-latency reactions without hosting a public HTTPS endpoint.

**Connect** (same API key as the REST API — no separate credentials):
```javascript
const WebSocket = require('ws');
const ws = new WebSocket(
  'wss://api.hyperprop.com/platform/v1/organization/events/stream',
  { headers: { 'X-API-Key': 'hp_live_...' } }
);
ws.on('message', (raw) => {
  const frame = JSON.parse(raw);
  if (frame.type === 'event') {
    // frame.event is byte-for-byte the same JSON body a webhook POST carries:
    // { id, type, createdAt, organizationId, data, previousAttributes, ... }
    console.log(frame.event.type, frame.event.data.accountNumber);
  }
});
```
Clients that cannot set headers may pass `?api_key=hp_live_...` in the URL instead.

**Frames you receive:**
| Frame | Meaning |
|-------|---------|
| `{ "type": "connected", "organizationId", "serverTime" }` | Sent once after a successful connect |
| `{ "type": "event", "event": { ... } }` | A live event — `event` matches the webhook payload schema exactly |
| `{ "type": "event.replay", ... }` | Slim catch-up event when you connect with `?since=` (id, eventType, accountId, reason, createdAt) |
| `{ "type": "replay.complete", "count", "truncated" }` | Catch-up finished; `truncated: true` means more than 1000 events matched — reconnect with a later `since` |
| `{ "type": "pong" }` | Reply to your `{ "type": "ping" }` |

**Catch-up after a disconnect:** reconnect with `?since=<ISO timestamp>` (e.g. `?since=2026-07-21T10:00:00Z`) to receive slim replays of events you missed, oldest first, then live events resume. Replay frames carry identifiers only — fetch full account state via `GET /platform/v1/organization/trading-accounts/{id}` if needed.

**Delivery guarantees:** `fill.created` is delivered **at least once while you are connected**, independently of your webhook configuration or webhook endpoint health. A fill can occasionally arrive a few seconds late, and duplicates are possible — dedupe on `data.orderId`. Fill replay via `?since=` is complete regardless of webhook subscription state. Other event types on the stream are live best-effort with `?since=` catch-up; webhooks remain the durable channel with retries, HMAC signing, and redelivery for anything money-critical.

**Keep-alive:** the server pings every 30 seconds; standard WebSocket libraries answer automatically. Idle connections that miss pongs are dropped. You may also send `{"type":"ping"}` and receive `{"type":"pong"}`.

**Limits:** maximum 10 concurrent stream connections per organization.

**Authentication:** your organization API key — `X-API-Key: hp_live_...` header (preferred) or the `?api_key=` query parameter for clients that cannot set WebSocket headers.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/organization/events/stream
openapi: 3.0.0
info:
  title: Hyperprop Platform API
  version: 1.0.0
  description: >-
    REST API for the Hyperprop Trading Platform — provision evaluation and
    funded trading accounts, manage traders and plans, react to account
    lifecycle events via signed webhooks, and reconcile billing. Built for prop
    firms integrating from their own backend.


    Authentication, quick start, error handling, idempotency, pagination, custom
    metadata, webhooks, and the MCP connector are documented at
    https://docs.hyperprop.com.
  x-logo:
    url: https://app.hyperprop.com/logo-icon.svg
    altText: Hyperprop
    href: https://hyperprop.com
servers:
  - url: https://api.hyperprop.com/platform
    description: Production
security: []
tags:
  - name: Trading accounts
    description: Create, update, and inspect trading accounts.
  - name: Traders
    description: Look up and update the traders in your organization.
  - name: Trading plans
    description: Define the plans you sell.
  - name: Trading rules
    description: Define how accounts are evaluated.
  - name: Lockouts
    description: Pause and resume trading on an account.
  - name: Payouts
    description: Check payout eligibility and record payouts.
  - name: Purchases
    description: Purchases recorded for your organization.
  - name: Time Machine
    description: Restore accounts to an earlier trading day or instant.
  - name: Webhooks
    description: Register webhook endpoints and inspect deliveries.
  - name: Events
    description: Your organization's event history and real-time event stream.
  - name: Reconciliation
    description: Balances, end-of-day snapshots, and fills for reconciliation.
  - name: Analytics
    description: Organization performance and plan economics.
  - name: Billing
    description: 'Your Hyperprop bill: activity, billing cycles, and forecasts.'
  - name: Team and roles
    description: Manage dashboard access for your staff.
  - name: API keys
    description: Manage your organization's API key.
  - name: Logs and health
    description: API request logs, the audit log, and integration health.
  - name: Organization profile
    description: Your organization's profile and logo.
  - name: Support
    description: Open and follow up on support tickets.
  - name: Partner access
    description: >-
      Read a trader's journal as an approved partner app, with the trader's own
      key.
paths:
  /v1/organization/events/stream:
    get:
      tags:
        - Events
      summary: Real-time event stream (WebSocket)
      description: >-
        Live push of the **same events and payloads** your webhooks receive,
        over a plain WebSocket. Use it for dashboards, monitoring, or
        low-latency reactions without hosting a public HTTPS endpoint.


        **Connect** (same API key as the REST API — no separate credentials):

        ```javascript

        const WebSocket = require('ws');

        const ws = new WebSocket(
          'wss://api.hyperprop.com/platform/v1/organization/events/stream',
          { headers: { 'X-API-Key': 'hp_live_...' } }
        );

        ws.on('message', (raw) => {
          const frame = JSON.parse(raw);
          if (frame.type === 'event') {
            // frame.event is byte-for-byte the same JSON body a webhook POST carries:
            // { id, type, createdAt, organizationId, data, previousAttributes, ... }
            console.log(frame.event.type, frame.event.data.accountNumber);
          }
        });

        ```

        Clients that cannot set headers may pass `?api_key=hp_live_...` in the
        URL instead.


        **Frames you receive:**

        | Frame | Meaning |

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

        | `{ "type": "connected", "organizationId", "serverTime" }` | Sent once
        after a successful connect |

        | `{ "type": "event", "event": { ... } }` | A live event — `event`
        matches the webhook payload schema exactly |

        | `{ "type": "event.replay", ... }` | Slim catch-up event when you
        connect with `?since=` (id, eventType, accountId, reason, createdAt) |

        | `{ "type": "replay.complete", "count", "truncated" }` | Catch-up
        finished; `truncated: true` means more than 1000 events matched —
        reconnect with a later `since` |

        | `{ "type": "pong" }` | Reply to your `{ "type": "ping" }` |


        **Catch-up after a disconnect:** reconnect with `?since=<ISO timestamp>`
        (e.g. `?since=2026-07-21T10:00:00Z`) to receive slim replays of events
        you missed, oldest first, then live events resume. Replay frames carry
        identifiers only — fetch full account state via `GET
        /platform/v1/organization/trading-accounts/{id}` if needed.


        **Delivery guarantees:** `fill.created` is delivered **at least once
        while you are connected**, independently of your webhook configuration
        or webhook endpoint health. A fill can occasionally arrive a few seconds
        late, and duplicates are possible — dedupe on `data.orderId`. Fill
        replay via `?since=` is complete regardless of webhook subscription
        state. Other event types on the stream are live best-effort with
        `?since=` catch-up; webhooks remain the durable channel with retries,
        HMAC signing, and redelivery for anything money-critical.


        **Keep-alive:** the server pings every 30 seconds; standard WebSocket
        libraries answer automatically. Idle connections that miss pongs are
        dropped. You may also send `{"type":"ping"}` and receive
        `{"type":"pong"}`.


        **Limits:** maximum 10 concurrent stream connections per organization.


        **Authentication:** your organization API key — `X-API-Key: hp_live_...`
        header (preferred) or the `?api_key=` query parameter for clients that
        cannot set WebSocket headers.
      operationId: getV1OrganizationEventsStream
      responses:
        '101':
          description: >-
            Switching Protocols — the WebSocket handshake succeeded. The first
            frame is `{ "type": "connected", "organizationId", "serverTime" }`,
            then `event` frames follow (see notes for the full frame table).
        '401':
          description: Authentication required
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model9'
        '426':
          description: >-
            Returned to plain HTTP GETs — connect with a WebSocket client
            instead
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model250'
        '429':
          description: >-
            Too many concurrent stream connections for this organization (max
            10)
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Model251'
      security:
        - X-API-Key: []
components:
  schemas:
    Model9:
      type: object
      properties:
        success:
          type: boolean
          description: Always false on errors
          example: false
        statusCode:
          type: number
          example: 401
        error:
          type: string
          example: Unauthorized
        message:
          type: string
          example: Authentication required
        code:
          type: string
          description: Machine-readable error code — switch on this, not on message text
          example: UNAUTHORIZED
    Model250:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          $ref: '#/components/schemas/error'
    Model251:
      type: object
      properties:
        success:
          type: boolean
          description: Always false on errors
          example: false
        statusCode:
          type: number
          example: 429
        error:
          type: string
          example: Too Many Requests
        message:
          type: string
          example: Maximum 10 concurrent stream connections per organization
        code:
          type: string
          description: Machine-readable error code — switch on this, not on message text
          example: TOO_MANY_CONNECTIONS
    error:
      type: object
      properties:
        code:
          type: string
          example: UPGRADE_REQUIRED
        message:
          type: string
          example: This endpoint is a WebSocket. Connect with a WebSocket client.
  securitySchemes:
    X-API-Key:
      type: apiKey
      name: X-API-Key
      in: header
      description: >-
        Organization API key. Format: "hp_live_{key}". Organization admins
        manage the key in the dashboard.

````

## Related topics

- [Real-time WebSocket for trading events](/trade-api/websocket/real-time-websocket-for-trading-events.md)
- [Get open positions with real-time P&L](/trade-api/positions/get-open-positions-with-real-time-p&l.md)
- [Webhooks](/guides/webhooks.md)
- [Introduction](/introduction.md)
- [Rate limits & quotas](/concepts/rate-limits.md)


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