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

# Trades WebSocket

> Connect to `wss://synthesis.trade/api/v1/trades/ws` and send JSON messages over the socket.

Subscription behavior:
- Returns historical trades ordered by newest first (up to `limit`, default `100`, max `10000`).
- If `offset` is `0` or omitted, the socket stays subscribed for live updates.
- If `offset` is greater than `0`, only that historical page is returned.

Market rules:
- For Polymarket, `markets` should contain condition IDs.
- For Kalshi, `markets` should contain market IDs.



## OpenAPI

````yaml /openapi.json get /api/v1/trades/ws
openapi: 3.1.0
info:
  title: Synthesis API
  version: 1.0.0
  description: Unified prediction market API for Polymarket and Kalshi.
servers:
  - url: https://synthesis.trade
security: []
tags:
  - name: Projects
    description: Create and manage project accounts, sessions, and account API keys.
  - name: Accounts
    description: >-
      Authenticate and manage account-level sessions, account API keys, and
      public account preferences.
  - name: Markets
    description: Unified market discovery and analytics across Polymarket and Kalshi.
  - name: Polymarket
    description: Polymarket market data, prices, orderbooks, trades, and holders endpoints.
  - name: Kalshi
    description: Kalshi market data, events, history, leaderboard, and profile endpoints.
  - name: Wallets
    description: Wallet management routes. Each wallet supports multiple chains.
  - name: Polygon
    description: >-
      Polygon wallet routes for balances, orders, minting, redemption,
      withdrawals, and swaps.
  - name: Polygon Copytrades
    description: Polymarket copytrade configuration and management for Polygon wallets.
  - name: Solana
    description: >-
      Solana wallet routes used for Kalshi balances, KYC, orders, redemption,
      and withdrawals.
  - name: News
    description: News endpoints with market and event matching.
  - name: WebSockets
    description: >-
      Real-time streaming endpoints for orderbooks, trades, balances, and live
      data feeds.
paths:
  /api/v1/trades/ws:
    get:
      tags:
        - WebSockets
      summary: Trades WebSocket
      description: >-
        Connect to `wss://synthesis.trade/api/v1/trades/ws` and send JSON
        messages over the socket.


        Subscription behavior:

        - Returns historical trades ordered by newest first (up to `limit`,
        default `100`, max `10000`).

        - If `offset` is `0` or omitted, the socket stays subscribed for live
        updates.

        - If `offset` is greater than `0`, only that historical page is
        returned.


        Market rules:

        - For Polymarket, `markets` should contain condition IDs.

        - For Kalshi, `markets` should contain market IDs.
      operationId: trades-ws
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - type
              properties:
                type:
                  type: string
                  description: >-
                    WebSocket message type. Supported values: `subscribe` or
                    `unsubscribe`.
                venue:
                  type: string
                  description: >-
                    Optional venue filter. Supported values: `polymarket` or
                    `kalshi`. If omitted, the all-venues stream is only
                    supported when `markets` is also omitted.
                markets:
                  type: array
                  items:
                    type: string
                  description: >-
                    Optional list of market IDs. Maximum `100` items. For
                    Polymarket, use condition IDs. For Kalshi, use market IDs.
                    Mixed-venue lists are supported when you provide the
                    matching IDs for each venue.
                  example:
                    - >-
                      0xbd71b43bb47eb60dbcb41fa25df2a0ed4da612873d6e0447a2c730bd4cc25910
                    - KXBTC-25-T100000
                offset:
                  type: integer
                  description: >-
                    Historical pagination offset. Historical queries return
                    trades up to `limit` per venue/query shape. Live
                    subscription is only attached when `offset` is `0` or
                    omitted.
                  default: 0
                  example: 100
                limit:
                  type: integer
                  description: >-
                    Maximum historical trades to return per query. Capped at
                    `500`.
                  default: 100
                  example: 500
      responses:
        '101':
          description: WebSocket connection established
          content:
            application/json:
              examples:
                Historical Trades:
                  summary: Initial historical trades returned on subscribe
                  value:
                    success: true
                    response:
                      trades:
                        - venue: polymarket
                          trade:
                            tx_hash: >-
                              0xa1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
                            token_id: >-
                              21742633143463906290569050155826241533067272736897614950488156847949938836455
                            address: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                            side: true
                            amount: '97.5'
                            shares: '150.0'
                            price: '0.65'
                            username: trader1
                            image: ''
                            created_at: '2026-01-01T00:00:00'
                          event:
                            event_id: 12345
                            title: Will Bitcoin reach $100k by end of 2025?
                            slug: will-bitcoin-reach-100k-by-end-of-2025
                            description: >-
                              This market resolves to Yes if spot Bitcoin trades
                              at or above $100,000 before 2025 ends.
                            image: https://example.com/bitcoin.png
                            tags:
                              - crypto
                              - bitcoin
                            labels:
                              - crypto
                              - macro
                            neg_risk: false
                            active: true
                            liquidity: '1500000'
                            volume: '5000000'
                            volume24hr: '250000'
                            volume1wk: '900000'
                            volume1mo: '2200000'
                            volume1yr: '5000000'
                            live:
                              live: false
                              ended: false
                            created_at: '2026-01-01T00:00:00'
                            updated_at: '2026-01-01T00:00:00'
                            ends_at: '2026-12-31T23:59:59'
                          market:
                            event_id: 12345
                            condition_id: >-
                              0xbd71b43bb47eb60dbcb41fa25df2a0ed4da612873d6e0447a2c730bd4cc25910
                            question_id: '0xabcd'
                            question: Will Bitcoin reach $100k?
                            outcome: 'Yes'
                            slug: will-bitcoin-reach-100k-yes
                            description: >-
                              Buy Yes if you think Bitcoin will trade at or
                              above $100,000 before market expiry.
                            image: https://example.com/bitcoin-market.png
                            left_outcome: 'Yes'
                            right_outcome: 'No'
                            left_price: '0.65'
                            right_price: '0.35'
                            left_token_id: >-
                              21742633143463906290569050155826241533067272736897614950488156847949938836455
                            right_token_id: >-
                              48572956138472615938471625938471659384716593847165938471659384716593847165938
                            winner_token_id: ''
                            active: true
                            resolved: false
                            fees: true
                            decimals: 6
                            liquidity: '1500000'
                            volume: '5000000'
                            volume24hr: '250000'
                            volume1wk: '900000'
                            volume1mo: '2200000'
                            volume1yr: '5000000'
                            rewards:
                              rewards: false
                            created_at: '2026-01-01T00:00:00'
                            updated_at: '2026-01-01T00:00:00'
                            ends_at: '2026-12-31T23:59:59'
                        - venue: kalshi
                          trade:
                            trade_id: t_abc123
                            market_id: KXBTC-25-T100000
                            outcome: 'yes'
                            side: true
                            amount: '50.0'
                            shares: '100.0'
                            price: '0.50'
                            created_at: '2026-01-01T00:00:00'
                          event:
                            event_id: KXBTC-25
                            series_id: KXBTC
                            title: Bitcoin above $100k?
                            category: Crypto
                            status: active
                            yes_price: '0.65'
                            no_price: '0.35'
                            volume: '500000'
                            volume24hr: '25000'
                            open_interest: '150000'
                            created_at: '2026-01-01T00:00:00'
                            ends_at: '2026-12-31T23:59:59'
                          market:
                            market_id: KXBTC-25-T100000
                            event_id: KXBTC-25
                            series_id: KXBTC
                            title: Bitcoin above $100k?
                            category: Crypto
                            status: active
                            yes_price: '0.65'
                            no_price: '0.35'
                            volume: '500000'
                            volume24hr: '25000'
                            open_interest: '150000'
                            created_at: '2026-01-01T00:00:00'
                            ends_at: '2026-12-31T23:59:59'
                Polymarket Trade:
                  summary: Live Polymarket trade streamed after subscribe
                  value:
                    success: true
                    response:
                      venue: polymarket
                      trade:
                        tx_hash: >-
                          0xc3d4e5f6a7b8c3d4e5f6a7b8c3d4e5f6a7b8c3d4e5f6a7b8c3d4e5f6a7b8c3d4
                        token_id: >-
                          21742633143463906290569050155826241533067272736897614950488156847949938836455
                        address: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                        side: true
                        amount: '97.5'
                        shares: '150.0'
                        price: '0.65'
                        username: trader1
                        image: ''
                        created_at: '2026-01-01T00:00:01'
                      event:
                        event_id: 12345
                        title: Will Bitcoin reach $100k by end of 2025?
                        slug: will-bitcoin-reach-100k-by-end-of-2025
                        description: >-
                          This market resolves to Yes if spot Bitcoin trades at
                          or above $100,000 before 2025 ends.
                        image: https://example.com/bitcoin.png
                        tags:
                          - crypto
                          - bitcoin
                        labels:
                          - crypto
                          - macro
                        neg_risk: false
                        active: true
                        liquidity: '1500000'
                        volume: '5000000'
                        volume24hr: '250000'
                        volume1wk: '900000'
                        volume1mo: '2200000'
                        volume1yr: '5000000'
                        live:
                          live: false
                          ended: false
                        created_at: '2026-01-01T00:00:00'
                        updated_at: '2026-01-01T00:00:00'
                        ends_at: '2026-12-31T23:59:59'
                      market:
                        event_id: 12345
                        condition_id: >-
                          0xbd71b43bb47eb60dbcb41fa25df2a0ed4da612873d6e0447a2c730bd4cc25910
                        question_id: '0xabcd'
                        question: Will Bitcoin reach $100k?
                        outcome: 'Yes'
                        slug: will-bitcoin-reach-100k-yes
                        description: >-
                          Buy Yes if you think Bitcoin will trade at or above
                          $100,000 before market expiry.
                        image: https://example.com/bitcoin-market.png
                        left_outcome: 'Yes'
                        right_outcome: 'No'
                        left_price: '0.65'
                        right_price: '0.35'
                        left_token_id: >-
                          21742633143463906290569050155826241533067272736897614950488156847949938836455
                        right_token_id: >-
                          48572956138472615938471625938471659384716593847165938471659384716593847165938
                        winner_token_id: ''
                        active: true
                        resolved: false
                        fees: true
                        decimals: 6
                        liquidity: '1500000'
                        volume: '5000000'
                        volume24hr: '250000'
                        volume1wk: '900000'
                        volume1mo: '2200000'
                        volume1yr: '5000000'
                        rewards:
                          rewards: false
                        created_at: '2026-01-01T00:00:00'
                        updated_at: '2026-01-01T00:00:00'
                        ends_at: '2026-12-31T23:59:59'
                Kalshi Trade:
                  summary: Live Kalshi trade streamed after subscribe
                  value:
                    success: true
                    response:
                      venue: kalshi
                      trade:
                        trade_id: t_def456
                        market_id: KXBTC-25-T100000
                        outcome: 'yes'
                        side: true
                        amount: '50.0'
                        shares: '100.0'
                        price: '0.50'
                        created_at: '2026-01-01T00:00:01'
                      event:
                        event_id: KXBTC-25
                        series_id: KXBTC
                        title: Bitcoin above $100k?
                        category: Crypto
                        status: active
                        yes_price: '0.65'
                        no_price: '0.35'
                        volume: '500000'
                        volume24hr: '25000'
                        open_interest: '150000'
                        created_at: '2026-01-01T00:00:00'
                        ends_at: '2026-12-31T23:59:59'
                      market:
                        market_id: KXBTC-25-T100000
                        event_id: KXBTC-25
                        series_id: KXBTC
                        title: Bitcoin above $100k?
                        category: Crypto
                        status: active
                        yes_price: '0.65'
                        no_price: '0.35'
                        volume: '500000'
                        volume24hr: '25000'
                        open_interest: '150000'
                        created_at: '2026-01-01T00:00:00'
                        ends_at: '2026-12-31T23:59:59'
                Unsubscribed:
                  summary: Unsubscribe acknowledgment
                  value:
                    success: true
                    response: Unsubscribed
                Error:
                  summary: Error response
                  value:
                    success: false
                    response: Invalid markets
      security: []

````