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

# WebSocket orders channel - Snapshot, live order updates and resume

> Follow the orders of your account on the Apexium API WebSocket: the snapshot after login, one message per change, and resuming after a reconnect with sinceEventId.

The `orders` channel sends the orders of the account behind your API key: a snapshot right after login, then the whole order every time it changes.

## Snapshot

Right after `login_ok`, you receive:

```json theme={null}
{
  "channel": "orders",
  "type": "snapshot",
  "payload": { "eventId": 48213, "orders": [ { "id": "…", "version": 3, "…": "…" } ] },
  "ts": 1791413359090,
  "seq": 1
}
```

`orders` holds every working order, plus every order that changed in the last 24 hours. Each order has the shape of [`GET /v1/orders/{id}`](https://docs.apexiumbet.com/api-reference/overview#orders).

## Changes

Every change to an order sends the whole order again:

```json theme={null}
{
  "channel": "orders",
  "type": "order",
  "payload": { "eventId": 48214, "order": { "id": "…", "version": 4, "status": "FILLED", "…": "…" } },
  "ts": 1791413359512,
  "seq": 2
}
```

A change is anything that moves the order or one of its bets: a fill, a decline, a cancellation, an expiry, a settlement or a correction.

For each order `id`, keep the order with the highest `version`, and ignore one with a lower or equal version: the same version can arrive twice.

## Resume

`eventId` exists for resuming. Keep the highest `eventId` you received, the snapshot's included. When you reconnect, log in with it:

```json theme={null}
{ "type": "login", "apiKey": "apx_live_…", "receiveType": "zstd", "channels": ["orders"], "sinceEventId": 48214 }
```

* **Inside the window.** At most 1 000 changes were missed and the oldest is less than 10 minutes old: the orders that changed are sent as `order` messages, then the live changes follow. No snapshot is sent.
* **Outside the window.** You receive `{ "type": "snapshot_required", "reason": "resume_window_exceeded", "channels": ["orders"] }`, then a new snapshot. Replace what you held with it.

A login without `sinceEventId` always starts with a snapshot.

## Without the channel

A login that names `channels` without `orders` receives none of this. A login without `channels` covers every channel, `orders` included.


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