WebSocket: Order Status Updates
Get instant order status updates pushed to your application in real-time instead of polling the REST API.Connection
Authentication
Include your API credentials in theAuthorization header during the WebSocket handshake:
| HTTP Code | Reason |
|---|---|
| 401 | Missing Authorization header |
| 400 | Malformed header (must be partnerId:secret) |
welcome message. If credentials are invalid, you receive an error message with code AUTH_FAILED and the connection is closed with WebSocket close code 4401.
Quick Start
Message Protocol
All messages are JSON objects with atype field.
Client → Server
subscribe
Subscribe to order status updates. Send withouthoudiniIds to receive updates for all your orders, or specify an array to watch specific orders.
Subscribe to all orders
Subscribe to specific orders
Subscriptions are additive. Sending multiple
subscribe messages with different houdiniIds adds to your watch list. Sending a subscribe without houdiniIds switches to all-orders mode.unsubscribe
Stop receiving updates. Send withouthoudiniIds to unsubscribe from everything, or specify an array to stop watching specific orders.
Unsubscribe from all
Unsubscribe from specific orders
If you are subscribed to all orders and send an
unsubscribe with specific houdiniIds, this resets your subscription to none. To continue receiving updates for other orders, re-subscribe after unsubscribing.ping
Application-level keepalive. The server responds withpong.
Server → Client
welcome
Sent immediately after a successful connection.order_update
Pushed whenever an order’s status changes. Thedata field contains the full order object — the same shape as GET /v2/orders/{houdiniId}.
subscribed
Confirmation after asubscribe message.
When subscribed to all orders
unsubscribed
Confirmation after anunsubscribe message.
When unsubscribed from all
When unsubscribed from specific orders
error
Sent when the server cannot process a client message.| Error Code | Description |
|---|---|
AUTH_FAILED | Invalid credentials — connection will be closed with code 4401 |
INVALID_MESSAGE | Message is not valid JSON or missing type field |
UNKNOWN_MESSAGE_TYPE | The type field is not recognized |
Order Status Codes
Thestatus field in order_update is a numeric code:
| Code | Label | Description |
|---|---|---|
| -2 | INITIALIZING | Order is being initialized |
| -1 | NEW | Order initialized, awaiting processing |
| 0 | WAITING | Waiting for user’s deposit |
| 1 | CONFIRMING | Deposit is being confirmed on-chain |
| 2 | EXCHANGING | Swap is in progress |
| 3 | ANONYMIZING | Going through privacy routing |
| 4 | FINISHED | Completed successfully |
| 5 | EXPIRED | Expired (no deposit within 30 minutes) |
| 6 | FAILED | Failed |
| 7 | REFUNDED | Refunded to sender |
| 8 | DELETED | Deleted (order older than 48 hours) |
FINISHED, EXPIRED, FAILED, REFUNDED, DELETED.
Reconnection
The server does not persist subscriptions across disconnects. If your connection drops:- Reconnect with credentials
- Re-send your
subscribemessage - Optionally call
GET /v2/ordersto catch any updates you missed
Security Notes
- Only orders belonging to your partner account are delivered. You cannot receive updates for other partners’ orders.
- The
Authorizationheader format is validated during the HTTP upgrade. Credentials are verified immediately after the WebSocket connection is established. - Anonymous/private swap orders have their routing path censored from the response.