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

# L2 orderbook updates

> > **Endpoint:** `wss://api.testnet.arcus.xyz/v1/ws` — one socket multiplexes every channel and RPC request. Click **Connect**, then send the example subscribe message below to start receiving data.

Full L2 orderbook snapshot followed by event-driven incremental deltas for a single market.

On subscribe: full snapshot up to `nLevels` per side, then delta updates as orders are placed, modified, or cancelled. Each delta carries a monotonically increasing `lastSequenceId` (continuous with the snapshot's `lastSequenceId`) — drop or re-subscribe on any gap.




## AsyncAPI

````yaml api-reference/asyncapi.yaml l2OrderbookUpdates
id: l2OrderbookUpdates
title: L2 orderbook updates
description: >
  > **Endpoint:** `wss://api.testnet.arcus.xyz/v1/ws` — one socket multiplexes
  every channel and RPC request. Click **Connect**, then send the example
  subscribe message below to start receiving data.


  Full L2 orderbook snapshot followed by event-driven incremental deltas for a
  single market.


  On subscribe: full snapshot up to `nLevels` per side, then delta updates as
  orders are placed, modified, or cancelled. Each delta carries a monotonically
  increasing `lastSequenceId` (continuous with the snapshot's `lastSequenceId`)
  — drop or re-subscribe on any gap.
servers:
  - id: testnet
    protocol: wss
    host: api.testnet.arcus.xyz
    bindings: []
    variables: []
  - id: mainnet
    protocol: wss
    host: api.arcus.xyz
    bindings: []
    variables: []
address: /v1/ws?channel=l2OrderbookUpdates
parameters: []
bindings: []
operations:
  - &ref_4
    id: subscribeL2OrderbookUpdates
    title: Subscribe l2 orderbook updates
    type: receive
    messages:
      - &ref_6
        id: subscribe
        contentType: application/json
        payload:
          - name: Subscribe to L2 Orderbook incremental updates
            type: object
            properties:
              - name: type
                type: string
                description: subscribe
                required: true
              - name: channel
                type: string
                description: l2OrderbookUpdates
                required: true
              - name: id
                type: string
                description: Market display name (e.g. "BTC-USD", "ETH-USD").
                required: true
              - name: nLevels
                type: integer
                description: Price levels per side in the initial snapshot. Range 1–100.
                required: false
              - name: snapshot
                type: boolean
                description: >-
                  When false, suppress the initial book snapshot on subscribe
                  and stream only incremental delta updates. Defaults to true.
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          required:
            - type
            - channel
            - id
          properties:
            type:
              type: string
              const: subscribe
              x-parser-schema-id: <anonymous-schema-21>
            channel:
              type: string
              const: l2OrderbookUpdates
              x-parser-schema-id: <anonymous-schema-22>
            id:
              type: string
              description: Market display name (e.g. "BTC-USD", "ETH-USD").
              example: BTC-USD
              x-parser-schema-id: <anonymous-schema-23>
            nLevels:
              type: integer
              description: Price levels per side in the initial snapshot. Range 1–100.
              default: 20
              minimum: 1
              maximum: 100
              x-parser-schema-id: <anonymous-schema-24>
            snapshot:
              type: boolean
              description: >-
                When false, suppress the initial book snapshot on subscribe and
                stream only incremental delta updates. Defaults to true.
              default: true
              x-parser-schema-id: <anonymous-schema-25>
          x-parser-schema-id: SubscribeL2OrderbookUpdatesPayload
        title: Subscribe to L2 Orderbook incremental updates
        example: |-
          {
            "type": "subscribe",
            "channel": "l2OrderbookUpdates",
            "id": "BTC-USD",
            "nLevels": 50
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribe
    bindings: []
    extensions: &ref_3
      - id: x-parser-unique-object-id
        value: l2OrderbookUpdates
  - &ref_5
    id: receiveL2OrderbookUpdates
    title: Receive l2 orderbook updates
    type: send
    messages:
      - &ref_7
        id: snapshot
        contentType: application/json
        payload:
          - allOf: &ref_0
              - &ref_1
                type: object
                description: Common envelope for all server-pushed channel messages.
                required:
                  - type
                  - channel
                properties:
                  type:
                    type: string
                    enum:
                      - subscribed
                      - channel_data
                    description: >-
                      `subscribed` for the initial snapshot; `channel_data` for
                      updates.
                    x-parser-schema-id: <anonymous-schema-5>
                  channel:
                    type: string
                    description: Channel name.
                    x-parser-schema-id: <anonymous-schema-6>
                  id:
                    type: string
                    description: >-
                      Channel id (market or address). Absent for global
                      channels.
                    x-parser-schema-id: <anonymous-schema-7>
                  contents:
                    type: object
                    additionalProperties: true
                    description: Channel-specific payload. Schema varies by channel.
                    properties: {}
                    x-parser-schema-id: <anonymous-schema-8>
                x-parser-schema-id: ChannelDataEnvelope
              - type: object
                properties:
                  type:
                    const: subscribed
                    x-parser-schema-id: <anonymous-schema-10>
                  contents:
                    type: object
                    required:
                      - bids
                      - asks
                      - lastSequenceId
                    properties:
                      bids:
                        type: array
                        description: >-
                          Price levels, best bid first. Each entry is `[price,
                          size]`.
                        items:
                          type: array
                          minItems: 2
                          maxItems: 2
                          items:
                            type: string
                            x-parser-schema-id: <anonymous-schema-14>
                          x-parser-schema-id: <anonymous-schema-13>
                        example:
                          - - '94500.0'
                            - '1.5'
                          - - '94499.0'
                            - '2.0'
                        x-parser-schema-id: <anonymous-schema-12>
                      asks:
                        type: array
                        description: >-
                          Price levels, best ask first. Each entry is `[price,
                          size]`.
                        items:
                          type: array
                          minItems: 2
                          maxItems: 2
                          items:
                            type: string
                            x-parser-schema-id: <anonymous-schema-17>
                          x-parser-schema-id: <anonymous-schema-16>
                        example:
                          - - '94501.0'
                            - '0.8'
                          - - '94502.0'
                            - '3.1'
                        x-parser-schema-id: <anonymous-schema-15>
                      lastSequenceId:
                        type: integer
                        description: >-
                          Per-market orderbook sequence of the last update
                          reflected in this snapshot. Reconcile
                          `l2OrderbookUpdates` deltas against this — apply
                          deltas whose `lastSequenceId` exceeds it.
                        example: 1042
                        x-parser-schema-id: <anonymous-schema-18>
                      globalSequenceId:
                        type: integer
                        description: Cross-market monotonic sequence. Omitted when zero.
                        example: 880421
                        x-parser-schema-id: <anonymous-schema-19>
                      timestamp:
                        type: integer
                        format: int64
                        description: >-
                          Unix microseconds when the snapshot was taken. Omitted
                          when zero.
                        example: 1780410803123456
                        x-parser-schema-id: <anonymous-schema-20>
                    x-parser-schema-id: <anonymous-schema-11>
                x-parser-schema-id: <anonymous-schema-9>
            x-parser-schema-id: L2OrderbookSnapshotPayload
            name: L2 Orderbook Snapshot
        headers: []
        jsonPayloadSchema:
          allOf: *ref_0
          x-parser-schema-id: L2OrderbookSnapshotPayload
        title: L2 Orderbook Snapshot
        example: |-
          {
            "type": "subscribed",
            "channel": "l2Orderbook",
            "id": "BTC-USD",
            "contents": {
              "bids": [
                [
                  "94500.0",
                  "1.5"
                ],
                [
                  "94499.0",
                  "2.0"
                ]
              ],
              "asks": [
                [
                  "94501.0",
                  "0.8"
                ],
                [
                  "94502.0",
                  "3.1"
                ]
              ],
              "lastSequenceId": 1042,
              "globalSequenceId": 880421,
              "timestamp": 1780410803123456
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: snapshot
      - &ref_8
        id: update
        contentType: application/json
        payload:
          - allOf: &ref_2
              - *ref_1
              - type: object
                properties:
                  type:
                    const: channel_data
                    x-parser-schema-id: <anonymous-schema-27>
                  contents:
                    type: object
                    description: >
                      Incremental delta. Each `[price, size]` entry sets that
                      level's absolute size; `size: "0"` means the level was
                      removed. Drop or re-subscribe on any `lastSequenceId` gap.
                    required:
                      - bids
                      - asks
                      - lastSequenceId
                      - globalSequenceId
                    properties:
                      bids:
                        type: array
                        items:
                          type: array
                          minItems: 2
                          maxItems: 2
                          items:
                            type: string
                            x-parser-schema-id: <anonymous-schema-31>
                          x-parser-schema-id: <anonymous-schema-30>
                        x-parser-schema-id: <anonymous-schema-29>
                      asks:
                        type: array
                        items:
                          type: array
                          minItems: 2
                          maxItems: 2
                          items:
                            type: string
                            x-parser-schema-id: <anonymous-schema-34>
                          x-parser-schema-id: <anonymous-schema-33>
                        x-parser-schema-id: <anonymous-schema-32>
                      lastSequenceId:
                        type: integer
                        description: >-
                          Per-market orderbook sequence for this delta.
                          Monotonically increasing and continuous with the
                          snapshot's `lastSequenceId`.
                        x-parser-schema-id: <anonymous-schema-35>
                      globalSequenceId:
                        type: integer
                        description: Cross-market monotonic sequence.
                        x-parser-schema-id: <anonymous-schema-36>
                    x-parser-schema-id: <anonymous-schema-28>
                x-parser-schema-id: <anonymous-schema-26>
            x-parser-schema-id: L2OrderbookUpdatePayload
            name: L2 Orderbook Incremental Update
            description: >
              `size: "0"` means the level was removed. Drop or re-subscribe on
              any `lastSequenceId` gap.
        headers: []
        jsonPayloadSchema:
          allOf: *ref_2
          x-parser-schema-id: L2OrderbookUpdatePayload
        title: L2 Orderbook Incremental Update
        description: >
          `size: "0"` means the level was removed. Drop or re-subscribe on any
          `lastSequenceId` gap.
        example: |-
          {
            "type": "channel_data",
            "channel": "l2OrderbookUpdates",
            "id": "BTC-USD",
            "contents": {
              "bids": [
                [
                  "94499.0",
                  "0"
                ]
              ],
              "asks": [
                [
                  "94503.0",
                  "1.2"
                ]
              ],
              "lastSequenceId": 1043,
              "globalSequenceId": 880422
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: update
    bindings: []
    extensions: *ref_3
sendOperations:
  - *ref_4
receiveOperations:
  - *ref_5
sendMessages:
  - *ref_6
receiveMessages:
  - *ref_7
  - *ref_8
extensions:
  - id: x-parser-unique-object-id
    value: l2OrderbookUpdates
securitySchemes: []

````