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

# Overview

Clients open one connection, send `subscribe` and `unsubscribe` commands, and receive a stream of
`{ channel, data }` frames.

## Endpoints

| Network | URL |
| - | - |
| Mainnet | `wss://am-api.cloud.aultblockchain.xyz/ws` |
| Testnet | `wss://test-dex-api.cloud.aultblockchain.xyz/ws` |
| Testnet, Perpetuals (Testnet-Only) | `wss://test-dex-api.cloud.aultblockchain.xyz/ws/perp` |

`/ws` serves Spot subscriptions. `/ws/perp` is **Testnet-Only** and serves [Perpetual Subscriptions](https://docs.aultblockchain.com/dex-api/websocket/perpetuals.md).
No authentication is required.
Set a descriptive [User-Agent](https://docs.aultblockchain.com/dex-api/getting-started/introduction.md#user-agent) in non-browser clients.

```
$ wscat -c wss://test-dex-api.cloud.aultblockchain.xyz/ws
Connected (press CTRL+C to quit)
> { "method": "subscribe", "subscription": { "type": "l2Book", "coin": "AULT/USDC" } }
< {"channel":"subscriptionResponse","data":{"type":"l2Book","coin":"AULT/USDC"}}
< {"channel":"l2Book","data":{"coin":"AULT/USDC","levels":[[],[]],"time":1787643422155}}
```

## Delivery Guarantees

Delivery is best effort. Messages can be missed during disconnections, server restarts, upstream
gaps, or when a client's buffer is full.

> [!WARNING]
>
> Reconnecting does not restore subscriptions and does not replay missed messages. Any client holding
> derived state, such as a local order book or a set of live orders, must resubscribe and reconcile
> against REST, or it will carry the gap forward.

## Reconnecting

Reconnect on close, on heartbeat timeout, and on transport error, using exponential backoff with
jitter.

After the connection is back:

1. Resend every subscription.
2. Discard any locally maintained order book.
3. For `l2Book`, wait for a new stream snapshot and replace the book with each frame. Use REST
   [Market Data](https://docs.aultblockchain.com/dex-api/rest/market-data.md#maintaining-a-local-book) independently; it has no shared
   sequence with the stream.
4. Reconcile other account state through [Orders](https://docs.aultblockchain.com/dex-api/rest/orders.md),
   [User Fills](https://docs.aultblockchain.com/dex-api/rest/user-fills.md), and [Balances](https://docs.aultblockchain.com/dex-api/rest/balances.md).

Types that deliver an initial snapshot make this cheaper. See
[Subscriptions](https://docs.aultblockchain.com/dex-api/websocket/subscriptions.md).

## Field Encodings

| Kind | Format | Example |
| - | - | - |
| Coin | `BASE/QUOTE` string | `"AULT/USDC"` |
| Price (`px`) | Decimal string, minimal form | `"1.5"`, `"0.0001"` |
| Size and amount | Decimal string, units depend on payload | `"100"` |
| Numeric order id (`oid`) | 50-bit integer, JavaScript safe | `562949953421312` |
| Hex order id (`oidHex`) | Bare lowercase hex, 32 characters | `"abcdef0123..."` |
| Numeric trade id (`tid`) | 50-bit integer, JavaScript safe | `12345678901234` |
| Address | Bech32 with `ault1` prefix | `"ault1..."` |
| Timestamp | Unix milliseconds, number | `1700000000000` |

Book `sz` preserves raw chain base units. Trade/order sizes and wallet balances are human units;
check strategy payment-asset units separately. Candle OHLCV fields are JSON numbers. Spot
`activeAssetCtx` mixes numeric base fields and decimal-string extensions. Trailing zeros in canonical decimal strings are collapsed.

## Limits

Connections are limited per client IP address, and inbound messages have a maximum size of 4,096
bytes. Prefer one connection carrying many subscriptions over many connections.

| Condition | Response |
| - | - |
| Per-IP connection limit reached | `429 Too Many Requests` |
| Server at capacity | `503 Service Unavailable` |

Command rate limits and the per-connection subscription cap are in
[Subscriptions](https://docs.aultblockchain.com/dex-api/websocket/subscriptions.md). Keepalive timing is in
[Heartbeats](https://docs.aultblockchain.com/dex-api/websocket/heartbeats.md).


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