Server APIs v2
  • Server APIs overview
  • Accessing Server APIs
  • Room signaling
  • Stream mixing
  • Streaming moderation
  • Streaming control
  • Cloud recording
  • Server callbacks
  • Return codes
  • API testing

Starts recording streams on CDN

Last updated:2022-03-22 13:07

1 Description

Starts recording specified live streams on CDN.

You can configure your CDN to record all live streams. But when you need to record specific live streams, you can use call this API to do so.

For the server callback triggered when a recorded file is generated, see Recording completed.

If you use Tencent Cloud as your CDN provider, please clarify the following recording parameters:

  • Recording file format: M3U8, FLV, MP4, AAC (mono), or MP3 (mono).
  • Duration of a single recording (in seconds): ranges from 300 s to 7,200s, and the default value is 7,200s. If you want a single recording longer than 7,200s, you will need to merge multiple recordings together using another API Merge recorded files.
  • Retention period: how long the recordings should be kept.
To use the CDN recording service, you will need to contact ZEGO Technical Support to enable it first. For pricing details, you can check with our sales.

2 Request method and endpoint

  • Request method: GET
  • Request endpoint:
  • Transmission protocol: HTTPS
  • Rate limit: 20 requests/second

3 Request parameters

Listed below are the parameters specific to this request and part of the public request parameters. For the complete list of public request parameters, see Server APIs public request parameters.

Parameter Type Required Description
Array of String
A list of Stream IDs.
Example: StreamId[]=cdn01&StreamId[]=cdn02
The CDN provider.
  • Tencent: Tencent Cloud
End time of the recording task, a Unix timestamp. Recording end time must be later than the current time and not later than [current time + 24 hours].

4 Request example
&<Public Request Parameters>

5 Response parameters

Parameter Type Description
Return code.
Description of the request execution result.
Request ID.
Returned data.
└ Tencent
Array of Object
Data returned by Tencent Cloud (when Tencent Cloud is the CDN provider).
  └ StreamName
Stream name.
  └ TaskId
A globally unique task ID.
  └ RequestId
A unique Request ID that is returned for every request. This request ID will be required for any troubleshooting on the request.
  └ Code
Error code related to the current stream.
  └ Message
Error message related to the current stream.

6 Response example


7 Return codes

Listed below are the return codes related to this API. For the complete list of return codes, see Return codes.

Return code Description
41001 Failed to save live stream.
41002 Failed to save channel.
41003 Live stream does not exist.
41004 Stream no longer exists.
42001 Failed to forbid live stream.
42002 Failed to resume live stream.
42003 Batch disable live broadcast failed.
42004 Failed to resume live streaming in batches.
43001 Failed to create recording index file.