Overview
The Temple WebSocket API streams real-time market data and your account's events, and takes order commands, all on one connection.
Endpoints
| Environment | URL |
|---|---|
| Production | wss://ws.templedigitalgroup.com/v1/stream |
| Development | wss://ws-dev.templedigitalgroup.com/v1/stream |
Authenticate with your API key in the X-API-Key header when you connect. See Connecting and authentication.
How it works
- Every message, in both directions, is a JSON object with a
typefield. - Market data (orderbook, trades, ticker, candles, oracle prices) arrives on channels you subscribe to. Each update is a
datamessage naming itschannel. See Market data channels. - Your own events (your orders and your trades) are pushed to you automatically as
user_datamessages. You do not subscribe to them. See User events. - Orders are placed and cancelled with
place_order,cancel_orderandcancel_all_orders. They need an API key with thewritescope. See Placing and cancelling orders.
Quick start
Connect with your API key. This example uses wscat:
wscat -c wss://ws.templedigitalgroup.com/v1/stream -H "X-API-Key: your-api-key-here"
Subscribe to a market's orderbook and trades:
{"type":"subscribe","channels":["orderbook:CC/USDCx","trades:CC/USDCx"]}The server confirms with subscribed, then sends a full orderbook snapshot followed by level updates:
{"type":"data","channel":"orderbook:CC/USDCx","data":{"type":"snapshot","bids":[{"price":0.1439,"quantity":75685,"order_count":26}],"asks":[{"price":0.1432,"quantity":5438.34,"order_count":120}]}}Place a limit order. The id is yours, and the reply carries the same id:
→ {"type":"place_order","id":"c-1","symbol":"CC/USDCx","side":"buy","quantity":10,"price":0.15}
← {"type":"order_ack","id":"c-1","request_id":51234}
The order's progress then arrives as user_data events carrying the same request_id.
Updated 3 days ago
Did this page help you?

