Available languages: [Python](https://databento.com/docs/api-live/client-control-messages/subscription-request.python.md) · [C++](https://databento.com/docs/api-live/client-control-messages/subscription-request.cpp.md) · [Rust](https://databento.com/docs/api-live/client-control-messages/subscription-request.rust.md) · [Raw](https://databento.com/docs/api-live/client-control-messages/subscription-request.raw.md)

Source: https://databento.com/docs/api-live/client-control-messages/subscription-request


### Subscription request

Add a new subscription to the session.

Supports multiple subscriptions for different schemas, which enables rich data streams containing mixed record types.

Specify an optional `start` time for [intraday replay](https://databento.com/docs/api-live/basics/intraday-replay.md) with subscriptions made before starting the session.

Subscriptions end when the TCP connection closes or when their symbols are removed with an [unsubscribe request](https://databento.com/docs/api-live/client-control-messages/unsubscribe-request.md).

When subscribing to many symbols, a subscription can be split across multiple control messages so as to avoid exceeding the maximum length.
It's recommended to chunk the symbols in groups of 500.
All but the last message should include `is_last=0` to indicate to the gateway that another part of the subscription remains.

#### Example message

```text
schema=trades|start=1671717080706865759|stype_in=raw_symbol|symbols=SPY,QQQ\n
```

#### Fields

| Field | Required | Type | Description |
| `schema` | required | string | The data record [schema](https://databento.com/docs/schemas/whats-a-schema.md) code (string identifier). Must be one of the values from [metadata.list_schemas](https://databento.com/docs/api-historical/metadata/metadata-list-schemas.md). |
| `stype_in` | required | string | The [symbology type](https://databento.com/docs/api-historical/basics/symbology.md) of input `symbols`. |
| `symbols` | required | string | A comma-separated list of symbols to filter for. Setting this value to `ALL_SYMBOLS` will subscribe to all the symbols in the dataset. |
| `start` | optional | string or uint64_t | The inclusive start of subscription replay. Filters on `ts_event` except for CBBO and BBO schemas, which filter on `ts_recv`. Takes an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) string or a [UNIX timestamp](https://en.wikipedia.org/wiki/Unix_time) in nanoseconds. Must be within the last 24 hours. Pass `0` to request all available data. Cannot be specified after the session is [started](https://databento.com/docs/api-live/message-flows/start-session.md). |
| `snapshot` | optional | int8_t | Request subscription with [snapshot](https://databento.com/docs/conventions/mbo-snapshot.md). When `snapshot=1`, start must be absent. |
| `id` | optional | uint32_t | A numerical identifier for the subscription. |
| `is_last` | optional | int8_t | `0` indicates more requests will be sent with the same parameters other than `symbols` and the gateway should wait to process the request. `is_last=1` is the default and instructs the gateway to process the request immediately. |
