---
title: "Subscribe"
url: https://docs.truemarkets.co/api/websocket/market-data/subscribe
description: "Message sent to server indicating which topics the client wants to subscribe to or unsubscribe from."
---

Docs index: https://docs.truemarkets.co/llms.txt

# Subscribe

You send these messages to True Markets Market Data WebSocket.

Address: `/v1/defi/market`

## Servers

- `wss://api.truemarkets.co` (Production, wss)
- `wss://api.uat.truemarkets.co` (Uat, wss)

## Messages

### subscription

Subscribe or unsubscribe from topics.

Payload: `SubscriptionPayload`

Example payload:

```json
{
  "type": "subscribe",
  "topics": [
    "all"
  ]
}
```

## Types

```ts
export type SubscribeMessage = SubscriptionPayload;

export interface SubscriptionPayload {
  /** Action the request is intending to take. */
  type: "subscribe" | "unsubscribe";

  /** Topics to subscribe to or unsubscribe from, e.g. `["price_candles"]`, `["price_candles","surging_assets"]`, or `["all"]`. */
  topics: Topic[];
}

/**
 * Topic identifier. `all` is a wildcard alias for every stream (per-instrument
 * topics excluded). Per-instrument topics are parameterized:
 * `orderbook.{venue}.{pair}` (e.g. `orderbook.hyperliquid-perp.BTC-USD`),
 * `price.{SYMBOL}` (e.g. `price.BTC`, `price.BTC-PERP`),
 * `candles.{SYMBOL}.{interval}` (e.g. `candles.ETH.1h`) and
 * `reference.{SYMBOL}` (e.g. `reference.BTC`). They are subscribable but not
 * part of the fixed enum below and are never delivered to `all` subscribers.
 *
 */
export type Topic =
  | "all"
  | "price_candles"
  | "trending_assets"
  | "surging_assets"
  | "reference_prices";
```