> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stmlink.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> 对外开放的服务端接口有两组前缀，都用同一套鉴权：`/server/v1/...`（SRTC 与 SMeeting 的主接口）和 `/stm/srvapi/v1/...`（SMeeting 的用户体系，服务端极简对接会用到）。鉴权是 app_id + nonce + timestamp + signature 四个请求头，用 app_key 做 HMAC-SHA256 签名，只能从业务方自己的后端调用。除这两组前缀外的接口均为内部接口，不要建议客户调用。 Public server APIs use two path prefixes with the same authentication: `/server/v1/...` (the main APIs of both SRTC and SMeeting) and `/stm/srvapi/v1/...` (the SMeeting user system, used by server-side low-code integration). Authenticate with four request headers, app_id + nonce + timestamp + signature, where signature is HMAC-SHA256 keyed with app_key; call these APIs only from the customer's own backend. Any other path is internal: never suggest calling it.
> app_key 是服务端密钥，绝不能出现在客户端代码、前端配置或移动 App 里。客户端加入频道用的 token 必须由业务方后端签发后下发（SRTC 走 `/server/v1/channel/grant`，SMeeting 走 `/stm/srvapi/v1/member/grant`）。 app_key is a server-side secret and must never appear in client code, frontend config, or a mobile app. The token a client uses to join must be issued by the customer's backend and passed down to the client (SRTC: `/server/v1/channel/grant`; SMeeting: `/stm/srvapi/v1/member/grant`).
> SRTC 与 SMeeting 是上下两层不同的产品，术语不通用：SRTC 是音视频底座，说「频道 channel」「加入 / 退出」；SMeeting 建在 SRTC 之上，说「房间 room」「会议 meeting」「进入 / 退出」。回答时按用户所在的层用对应术语，不要把「房间」「会议」安到 SRTC 的接口上，也不要用「频道」「加入 / 离开」描述 SMeeting 的概念（接口标识符原样保留）。 SRTC and SMeeting are two separate layers with different terminology. SRTC is the audio/video foundation: it has channels, and users join and leave a channel. SMeeting is built on top of SRTC: it has rooms and meetings, and members enter and exit a meeting. Answer in the terms of the layer the user is working with: never apply "room" or "meeting" to SRTC APIs, and never describe SMeeting concepts in prose with "channel", "join", or "leave" (API identifiers such as `force_join` keep their literal names).
> 同一能力在各端 SDK 里的包名、类名、方法名并不相同。写示例代码时请使用文档中该端自己的 API，不要把一个端的写法套到另一个端上。苹果平台每个产品都有两套 SDK（Swift 原生与 Objective-C），两套 API 不能混用。 Package, class, and method names differ between platform SDKs for the same capability. In sample code, use the API documented for that platform; never carry one platform's code over to another. On Apple platforms each product ships two SDKs (native Swift and Objective-C) whose APIs must not be mixed.

# Media output

> Pull URLs (HTTP-FLV / RTSP) and push tasks (RTMP / RTMPS): video from the composite video or any one user, audio from the meeting's mixed audio or any one user, in any combination

## Request a pull URL (HTTP-FLV / RTSP)

`POST /server/v1/stream/pull-url`

Authentication: required (see [Overview](https://docs.stmlink.com/en/meeting/server-api/overview.md))

Requests a pull URL (HTTP-FLV or RTSP) for audio and video in a meeting. Video and audio each choose their own source:
video is the meeting's composite video, one of a user's video tracks, or none; audio is the meeting's mixed audio, one of a user's audio tracks, or none, following the video by default.
For example, "presenter's video + meeting mixed audio" is video=user, video\_uid=presenter, audio=mix.

* When the composite video or the meeting's mixed audio is used, the meeting must have a stream mixing task in progress (recording task\_type includes 2); otherwise error code 1073 is returned
* flv: video must be H264 (no transcoding; if the publisher uses VP8, no video can be pulled); audio is transcoded to AAC
* rtsp: only RTSP over TCP is supported (the player must use TCP, for example ffplay with `-rtsp_transport tcp`); video is passed through as is (H264 or VP8),
  audio is transcoded to AAC by default; pass rtsp\_audio=opus to pass Opus through as is and skip server-side transcoding
* The URL is signed and can be pulled repeatedly by multiple players until it expires; after expiry, new pull requests are rejected, while playback already in progress is not affected
* Sources are subscribed only when someone pulls and unsubscribed automatically after the last player disconnects, so nothing is consumed when no one is pulling; there is no stop endpoint to call
* The meeting must have started (the channel is open), otherwise error code 1024 is returned; 2101 is returned if the meeting doesn't exist
* Whether the user is in the meeting is not checked; if the source hasn't published yet when pulling, the player gets a 404 and should retry

The actual validity period is the returned expire\_at (the server-configured limit may be smaller than the requested value).

**Request parameters**

**meeting\_id** `string` *required*

Meeting ID
Example: `jd8w2k`

**protocol** `string` *required*

Pull protocol: flv (HTTP-FLV), rtsp (RTSP over TCP)
Example: `flv`

**video** `string` *required*

Video source: mcu is the meeting's composite video (a stream mixing task must be in progress), user is a specific user's video (with video\_uid), none means no video
Example: `mcu`

**video\_uid** `string`

Required when video is user: which user's video to use (in-meeting user ID) (max length 64)
Example: `1001`

**video\_desc** `string`

Optional when video is user: when the user publishes multiple video tracks at once (such as camera and screen sharing), specifies one of them (exact match on the track description); if omitted, the first one to arrive is used (max length 50)
Example: `camera`

**audio** `string`

Audio source: auto follows the video (default; the composite video comes with the meeting's mixed audio, a single user's video with that user's own audio; auto can't be used without video), mix is the meeting's mixed audio (a stream mixing task must be in progress), user is a specific user's audio (with audio\_uid), none means no audio. Video and audio can't both be none
Example: `auto`

**audio\_uid** `string`

Required when audio is user: which user's audio to use (in-meeting user ID) (max length 64)
Example: `1002`

**audio\_desc** `string`

When the user publishes multiple audio tracks, specifies one of them (exact match on the track description); if omitted, the first one is used. Effective when audio is user, or auto following a single user's video (max length 50)
Example: `mic`

**expire** `integer`

URL validity in seconds; defaults to 24 hours if omitted, up to one day
Example: `86400`

**rtsp\_audio** `string`

Audio codec for RTSP, effective only when protocol is rtsp: aac (default, compatible with NVRs and surveillance platforms), opus (passed through as is, no server-side transcoding)
Example: `aac`

Request example:

```json theme={null}
{
  "audio": "auto",
  "audio_desc": "mic",
  "audio_uid": "1002",
  "expire": 86400,
  "meeting_id": "jd8w2k",
  "protocol": "flv",
  "rtsp_audio": "aac",
  "video": "mcu",
  "video_desc": "camera",
  "video_uid": "1001"
}
```

**Response parameters**

**url** `string`

Pull URL; signed, and can be pulled repeatedly by multiple players until it expires
Example: `http://1.2.3.4:8080/f/eyJhcHBpZCI6....flv`

**expire\_at** `integer`

URL expiry time, Unix timestamp in seconds; after expiry, new pull requests are rejected, while playback already in progress is not affected
Example: `1718198266`

Response example:

```json theme={null}
{
  "code": 0,
  "data": {
    "expire_at": 1718198266,
    "url": "http://1.2.3.4:8080/f/eyJhcHBpZCI6....flv"
  }
}
```

***

## Start a push

`POST /server/v1/stream/push/start`

Authentication: required (see [Overview](https://docs.stmlink.com/en/meeting/server-api/overview.md))

Start a push: pushes the selected video and audio in the meeting to your RTMP live room (rtmp\:// and rtmps\:// are supported) and returns a push\_id.
The source parameters are the same as for requesting a pull URL, and a meeting can have multiple pushes at once (for example, the composite video to one platform and a guest's own video to another).

* The meeting must be in progress (someone is in the meeting), and error code 2101 is returned if the meeting doesn't exist; when the meeting ends and everyone leaves, all of its pushes stop automatically
* Calling again for the same push URL in the same meeting doesn't start another push: if the sources are unchanged, the existing push\_id is returned; if they changed, this push is updated to the new sources
* While a source doesn't exist yet (for example, the stream mixing task hasn't started, or the user to push hasn't published), the push stays in waiting; this is not a failure, and pushing starts automatically once the source appears
* Pushes reconnect automatically after a disconnection; query push status with List push tasks
* Error code 1072 is returned when no push service is available, and 1075 when the push URL is invalid

**Request parameters**

**meeting\_id** `string` *required*

Meeting ID; the meeting must be in progress (someone is in the meeting)
Example: `jd8w2k`

**push\_url** `string` *required*

Push URL; rtmp\:// and rtmps\:// are supported, and it must include the stream key (URLs with an empty stream name such as rtmp\://host/app/ are rejected) (max length 1024)
Example: `rtmp://live.example.com/app/stream_key`

**video** `string` *required*

Video source: mcu is the meeting's composite video (a stream mixing task must be in progress), user is a specific user's video (with video\_uid), none means no video
Example: `mcu`

**video\_uid** `string`

Required when video is user: which user's video to use (in-meeting user ID) (max length 64)
Example: `1001`

**video\_desc** `string`

Optional when video is user: when the user publishes multiple video tracks at once (such as camera and screen sharing), specifies one of them (exact match on the track description); if omitted, the first one to arrive is used (max length 50)
Example: `camera`

**audio** `string`

Audio source: auto follows the video (default; the composite video comes with the meeting's mixed audio, a single user's video with that user's own audio; auto can't be used without video), mix is the meeting's mixed audio (a stream mixing task must be in progress), user is a specific user's audio (with audio\_uid), none means no audio. Video and audio can't both be none
Example: `auto`

**audio\_uid** `string`

Required when audio is user: which user's audio to use (in-meeting user ID) (max length 64)
Example: `1002`

**audio\_desc** `string`

When the user publishes multiple audio tracks, specifies one of them (exact match on the track description); if omitted, the first one is used. Effective when audio is user, or auto following a single user's video (max length 50)
Example: `mic`

Request example:

```json theme={null}
{
  "audio": "auto",
  "audio_desc": "mic",
  "audio_uid": "1002",
  "meeting_id": "jd8w2k",
  "push_url": "rtmp://live.example.com/app/stream_key",
  "video": "mcu",
  "video_desc": "camera",
  "video_uid": "1001"
}
```

**Response parameters**

**push\_id** `string`

Push task ID, used to stop the push and query its status
Example: `p7k2xq`

Response example:

```json theme={null}
{
  "code": 0,
  "data": {
    "push_id": "p7k2xq"
  }
}
```

***

## Stop a push

`POST /server/v1/stream/push/stop`

Authentication: required (see [Overview](https://docs.stmlink.com/en/meeting/server-api/overview.md))

Stops a push. Stopping a push that has already stopped is treated as success; error code 1074 is returned if the push\_id doesn't exist or doesn't belong to this meeting.

**Request parameters**

**meeting\_id** `string` *required*

Meeting ID; the push must belong to this meeting
Example: `jd8w2k`

**push\_id** `string` *required*

Push task ID, from the response of Start a push
Example: `p7k2xq`

Request example:

```json theme={null}
{
  "meeting_id": "jd8w2k",
  "push_id": "p7k2xq"
}
```

**Response parameters**

`data` is null

Response example:

```json theme={null}
{
  "code": 0,
  "data": null
}
```

***

## List push tasks

`POST /server/v1/stream/push/list`

Authentication: required (see [Overview](https://docs.stmlink.com/en/meeting/server-api/overview.md))

Queries the push tasks of a meeting: sources, masked push URL, push status, and most recent error, in reverse order of creation.
If push\_id is omitted, pushes in progress and those stopped within the last day are returned.

Status values: waiting for the source, connecting to the live streaming platform, publishing,
retrying after a push failure (see err for the reason), stopped.

**Request parameters**

**meeting\_id** `string` *required*

Meeting ID
Example: `jd8w2k`

**push\_id** `string`

Push task ID; pass it to see only that push. If omitted, pushes in progress and those stopped within the last day in the meeting are returned
Example: `p7k2xq`

Request example:

```json theme={null}
{
  "meeting_id": "jd8w2k",
  "push_id": "p7k2xq"
}
```

**Response parameters**

**push\_id** `string`

Push task ID
Example: `p7k2xq`

**meeting\_id** `string`

Meeting ID
Example: `jd8w2k`

**video** `string`

Video source: mcu is the composite video, user is a specific user, none means no video
Example: `mcu`

**video\_uid** `string`

Whose video is used when video is user
Example: `1001`

**video\_desc** `string`

Which of the user's video tracks is used when video is user; empty means the first one to arrive
Example: `camera`

**audio** `string`

Audio source: auto follows the video, mix is the meeting's mixed audio, user is a specific user, none means no audio
Example: `auto`

**audio\_uid** `string`

Whose audio is used when audio is user
Example: `1002`

**audio\_desc** `string`

Which of the user's audio tracks; empty means the first one
Example: `mic`

**push\_url** `string`

Push URL with the stream key masked (only the scheme, server, and first path segment are kept)
Example: `rtmp://live.example.com/app/***`

**status** `string`

Push status: waiting for the source (for example, the stream mixing task hasn't started or the user to push hasn't published; pushing starts automatically once the source appears, and this is not a failure), connecting to the live streaming platform, publishing, retrying after a push failure (see err for the reason), stopped
Example: `publishing`

**err** `string`

Most recent error; empty when everything is normal
Example: `connection refused`

**created\_at** `integer`

Creation time, Unix timestamp in seconds
Example: `1718194666`

**started\_at** `integer`

Push start time (when it first entered publishing), Unix timestamp in seconds; 0 means it has never actually started pushing (for example, it has stayed in waiting)
Example: `1718194667`

**ended\_at** `integer`

Stop time, Unix timestamp in seconds; 0 means not stopped
Example: `1718198266`

Response example:

```json theme={null}
{
  "code": 0,
  "data": [
    {
      "audio": "auto",
      "audio_desc": "mic",
      "audio_uid": "1002",
      "created_at": 1718194666,
      "ended_at": 1718198266,
      "err": "connection refused",
      "meeting_id": "jd8w2k",
      "push_id": "p7k2xq",
      "push_url": "rtmp://live.example.com/app/***",
      "started_at": 1718194667,
      "status": "publishing",
      "video": "mcu",
      "video_desc": "camera",
      "video_uid": "1001"
    }
  ]
}
```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.