Skip to main content
WSS
/
md
/
ws
Messages
Subscribe Request
type:object

Subscribe to market data for a symbol

Unsubscribe Request
type:object

Unsubscribe from market data for a symbol

Subscribe Candle Request
type:object

Subscribe to candle udpates on a symbol and width

Unsubscribe Candle Request
type:object

Unsubscribe from candle udpates on a symbol and width

Success Response
type:object

Confirmation of a successful client request

Error Response
type:object

Response indicating a failed client request

Heartbeat Event
type:object

Heartbeat/timestamp event (t="h")

Ticker Event
type:object

Ticker statistics update (t="s")

Trade Event
type:object

Trade event (t="t")

Candle Event
type:object

Candle update (t="c")

Level 1 Book Update Event
type:object

Level 1 orderbook update - best bid/ask (t="1")

Level 2 Book Update Event
type:object

Level 2 orderbook update - aggregated price levels (t="2")

Level 3 Book Update Event
type:object

Level 3 orderbook update - individual order quantities (t="3")

Quickstart

1. Get a token

curl -s -X POST https://gateway.sandbox.architect.exchange/api/authenticate \
  -H "Content-Type: application/json" \
  -d '{"api_key":"YOUR_KEY","api_secret":"YOUR_SECRET","expiration_seconds":3600}'
# Response: {"token":"<bearer-token>"}

2. Connect to the WebSocket

Pass the token as an Authorization header on the WebSocket upgrade request. Invalid or missing tokens are rejected with HTTP 401 before the connection is established.
# Store the token
TOKEN=$(curl -s -X POST https://gateway.sandbox.architect.exchange/api/authenticate \
  -H "Content-Type: application/json" \
  -d '{"api_key":"YOUR_KEY","api_secret":"YOUR_SECRET","expiration_seconds":3600}' \
  | python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")

# Connect
wscat -c wss://gateway.sandbox.architect.exchange/md/ws \
  -H "Authorization: Bearer $TOKEN"
Replace gateway.sandbox.architect.exchange with gateway.architect.exchange for production.

3. Subscribe

Once connected, send a subscribe message to start receiving market data:
{"rid":1,"type":"subscribe","symbol":"BTCUSD-PERP","level":"LEVEL_2"}
Subscribe to candles for a symbol and interval:
{"rid":2,"type":"subscribe_candles","symbol":"BTCUSD-PERP","width":"1m"}
After a successful subscribe, you receive:
  • Ticker updates (t = "s")
  • Trade updates (t = "t")
  • Order book updates matching your selected level:
    • LEVEL_1 -> t = "1"
    • LEVEL_2 -> t = "2"
    • LEVEL_3 -> t = "3"
After a successful subscribe_candles, you receive candle updates (t = "c").

Details

Request ID (rid)

  • rid is used to correlate request/response pairs.
  • Server acknowledgements and request errors include the same rid as your request.
  • Market data events do not include rid.

Symbol fields in events

  • Ticker, trade, and order book events use s for symbol.
  • Candle events use symbol.

Heartbeat events

  • The server emits heartbeat events (t = "h"):
{
  "t": "h",
  "ts": 1609459200,
  "tn": 123456789
}
Use heartbeat and market data flow to monitor connection health.