Skip to main content
WSS
/
md
/
ws

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":"XAU-PERP","level":"LEVEL_2"}
Subscribe to trades only — no order book or ticker — with level: "TRADES":
{"rid":2,"type":"subscribe","symbol":"XAU-PERP","level":"TRADES"}
For a book-level subscription, the optional trades and ticker fields (both default true) independently suppress trade or ticker delivery. For example, a book-only feed (no trades, no ticker):
{"rid":3,"type":"subscribe","symbol":"XAU-PERP","level":"LEVEL_2","trades":false,"ticker":false}
Subscribe to candles for a symbol and interval:
{"rid":4,"type":"subscribe_candles","symbol":"XAU-PERP","width":"1m"}
After a successful subscribe at a book level (LEVEL_1/LEVEL_2/LEVEL_3), you receive:
  • Ticker updates (t = "s") — unless ticker: false
  • Trade updates (t = "t") — unless trades: false
  • Order book updates matching your selected level:
    • LEVEL_1 -> t = "1"
    • LEVEL_2 -> t = "2"
    • LEVEL_3 -> t = "3"
After a successful subscribe at level: "TRADES", you receive only trade updates (t = "t") — no ticker or order book events. The trades and ticker fields have no effect on a TRADES subscription. 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.
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

Subscribe BBO Candles Request
type:object

Subscribe to BBO (Best Bid and Offer) candle updates on a symbol and width

Unsubscribe BBO Candles Request
type:object

Unsubscribe from BBO candle updates 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")

BBO Candle Event
type:object

BBO (Best Bid and Offer) candle update (t="bc")

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")