Last update:2025-10-20 17:13:13
When your source video cannot be “pushed” directly to our network, the Live Ingest & Forwarding feature allows you to ingest it from any external source and redistribute it to one or more destinations. Functioning as a powerful stream relay, it provides an API-driven solution for workflows where direct publishing isn’t possible.
The process consists of two main actions:
All API requests must be authenticated using three query parameters appended to the endpoint URL: n, r, and k.
n: Your CDNetworks platform account name.r: A unique random string (max 32 characters). A Unix timestamp is a good choice.k: A 32-character MD5 signature.The signature k is calculated as md5(r + key), where key is your secret API key.
key.r. Example: r = 1409284800.key = 012f37a3f2952, the combined string is 1409284800012f37a3f2952.k.
k = md5("1409284800012f37a3f2952") which results in b9fed80be752551834eec3e52fa94115.This feature can be controlled in two ways:
The following endpoint is used to create, stop, update, and resume forwarding tasks.
POSThttp://livect.cdnetworks.com/api/cdn/v2/forwardRequest.actionContent-Type: application/jsonExample Request URL:
http://livect.cdnetworks.com/api/cdn/v2/forwardRequest.action?n=your_account&r=1409284800&k=b9fed80be752551834eec3e52fa94115
Example Request Body (cmd=1, Create Task):
{
"transcallbackurl": "http://example.com/api/callback",
"cmd": "1",
"type": "live",
"list": [
{
"id": "task_unique_id_001",
"src": [
{
"url": "http://source.example.com/live/stream1.flv",
"wmImage": "http://source.example.com/assets/logo.jpg",
"wmGravity": "TOP_LEFT"
},
{
"url": "http://backup.example.com/live/stream1.flv"
}
],
"forward": [
{
"url": "rtmp://[dest1.example.com/live/output](https://dest1.example.com/live/output)"
},
{
"url": "rtmp://[dest2.example.com/live/output](https://dest2.example.com/live/output)"
}
],
"start": "1495177025000",
"end": "1495184225000",
"fops": {
"bps": "1200000",
"res": "1280x720",
"fps": "25",
"vcodec": "libx264",
"forced_gopInterval": "3000"
},
"extendParam": {
"waitCrtUrlFinish": "1"
}
}
]
}
| Field | Type | Required | Description |
|---|---|---|---|
transcallbackurl |
String | No | The URL to which status and event notifications (callbacks) will be sent. |
cmd |
String | Yes | The command to execute: 1: Create and start a task. 2: Stop a task. 3: Update the src list for a running task. 5: Resume a stopped task. |
type |
String | Yes | The type of content. Use live for live streams or video for on-demand files (VOD). |
list |
Array | Yes | An array of task objects. See details below. |
list Object Parameters| Field | Type | Required | Description |
|---|---|---|---|
id |
String | Yes | A unique identifier for the task (max 32 characters). Submitting a new task with an existing id will stop the old task. |
src |
Array | Yes | An array of source stream objects. See details below. |
forward |
Array | Yes | An array of destination objects where the stream will be forwarded. See details below. |
start |
String | No | The scheduled start time (13-digit Unix timestamp in ms). If omitted, the task starts immediately. |
end |
String | No | The scheduled end time (13-digit Unix timestamp in ms). The task stops automatically at this time. |
fops |
Object | No | Transcoding and encoding settings. See details below. |
extendParam |
Object | No | Advanced parameters for fine-tuning task behavior. See details below. |
src Object Parameters| Field | Type | Required | Description |
|---|---|---|---|
url |
String | Yes | The source URL to pull the stream from. Multiple URLs can be provided for redundancy. Supported formats include: Live Protocols: RTMP, HLS (.m3u8), HTTP-FLV, RTSP Video Formats: MP4, FLV, HLS (.m3u8) |
wmImage |
String | No | URL of a watermark image. For multiple watermarks, separate URLs with a semicolon (;). Note: If the URL contains special characters like &, it must be URL-encoded. |
wmGravity |
String | No | The static position of the watermark. Default is TOP_RIGHT. Options: TOP_LEFT, TOP_CENTER, TOP_RIGHT, CENTER_LEFT, CENTER, CENTER_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT. |
wmPosition |
String | No | Specifies the watermark’s top-left corner using percentages of the video’s dimensions. The format is WxH%, where W is the percentage offset from the left edge, and H is the percentage offset from the top edge. For example, 30%x40% places the watermark starting at a point 30% of the video’s width from the left and 40% of the video’s height from the top. The values must be integers from 0 to 99. This parameter is mutually exclusive with wmGravity; if both are set, the positioning behavior may be unpredictable. |
relofftime |
String | No | Specifies a relative time segment for the task, in seconds. The behavior depends on the type of the stream:For VOD ( type=video): The format is [start_second]-[end_second]. This defines the specific segment of the source file to be streamed. For example, 30-60 will use the portion of the video from the 30-second mark to the 60-second mark as the stream’s content.For Live ( type=live): The format is 0-[duration_in_seconds]. This defines the total duration for which the live stream will be pulled and forwarded. For example, 0-60 will relay the live stream for 60 seconds. |
pullStreamHeaders |
Array | No | An array of custom HTTP header objects to send with the request when pulling the source stream. Note: 1. The total length cannot exceed 2KB. Values cannot contain single quotes ( '), double quotes ("), two consecutive semicolons (;;), commas (,), or newline characters.Example: [{"headerKey": "User-Agent", "headerValue": "MyCustomPlayer/1.0"}, {"headerKey": "Referer", "headerValue": "http://example.com"}] |
forward Object Parameters| Field | Type | Required | Description |
|---|---|---|---|
url |
String | Yes | The destination RTMP URL to push the stream to. Multiple URLs can be specified; however, the system will treat each destination as a separate forwarding task. |
resetUrl |
String | No | A new destination URL to use when resuming a task with cmd=5. |
Note: Only the RTMP protocol is supported for forwarding destinations.
fops Object Parameters (Transcoding)| Field | Type | Required | Description |
|---|---|---|---|
bps |
String | No | Target video bitrate in bits per second (e.g., 1200000 for 1.2 Mbps). |
res |
String | No | Target resolution (e.g., 1280x720). The x must be lowercase. |
fps |
String | No | Target frames per second (e.g., 25). |
vcodec |
String | No | Output video codec (e.g., libx264, libx265). When omitted, the output will retain the source video’s codec. If a watermark is used, vcodec must be set to libx264. |
acodec |
String | No | Output audio codec (e.g., libmp3lame, libfaac, libvorbis). When omitted the output will retain the source audio’s codec. |
bufferTime |
String | No | For HLS sources, a buffer duration in seconds to absorb source instability. Default is 0. Increases latency. |
forced_gopInterval |
String | No | The desired keyframe interval in milliseconds (e.g., 3000 for a 3-second GOP). |
extendParam Object Parameters| Field | Type | Required | Description |
|---|---|---|---|
waitCrtUrlFinish |
String | No | When using cmd=3 to update the src list for VOD files, 1 waits for the current file to finish before switching. 0 (default) switches immediately. |
loop |
String | No | Controls looping behavior for VOD files. Default is 1 (play once). Use -1 for an infinite loop. Note: If both loop and a task end time are set, the end time takes precedence. |
index |
String | No | For VOD tasks (type=video) only. Specifies the starting file in the src list by its position (index). Default is 1, which starts with the first file. |
Note on Parameter Precedence:
When end (in the list object), loop (in extendParam), and relofftime (in the src object) are all specified for a task, they are prioritized in the following order: end > loop > relofftime. The task will stop based on the highest-precedence parameter that is met.
The API returns a standard HTTP status code and a JSON body with a business-level status.
Sample Success Response:
{
"http_code": "200",
"msg": "receive task success!",
"call_time": 1479952114000
}
Common HTTP Status Codes:
200 OK: Request accepted. Check the JSON body for the business-level result.400 Bad Request: The request is malformed (e.g., invalid JSON, missing required fields).403 Forbidden: Authentication failed (e.g., incorrect k signature, invalid r value, rate limit exceeded).5xx Server Error: An unexpected error occurred on the server.Business-Level http_code in JSON Body:
| HTTP | http_code |
msg Example |
Description | Suggested Action |
|---|---|---|---|---|
| 200 | 200 | receive task success! |
The task was successfully received and queued for processing. | None. |
| 400 | 1001 | cmd is error |
The cmd field is incorrect. |
cmd only supports 1, 2, 3, 5. |
| 400 | 1001 | type is error |
The type field is incorrect. |
type only supports live or video. |
| 400 | 1001 | list is null |
The list array is missing or empty. |
This is a required field. |
| 400 | 1001 | params id is null |
The id field within a list object is missing or empty. |
This is a required field. |
| 400 | 1001 | params src list is null |
The src array is missing or empty. |
This is a required field. |
| 400 | 1001 | params src num is too long |
The number of items in the src array exceeds the limit. |
The maximum is 800 items. Reduce the number of sources. |
| 400 | 1001 | params src length is too long |
The total character count of the src array’s content exceeds the limit. |
The maximum is 204,800 characters. Reduce the content size (e.g., shorten URLs). |
| 400 | 1001 | params src is error |
A url within a src object is missing or empty. |
This is a required field. |
| 400 | 1001 | params relofftime is error |
The relofftime format is incorrect. |
Refer to the parameter description for the correct format. |
| 400 | 1001 | params forward list is null |
The forward array is missing or empty. |
This is a required field. |
| 400 | 1001 | params forward is error |
A url within a forward object is missing or empty. |
This is a required field. |
| 400 | 1001 | params start format is error |
The start time format is incorrect. |
Must be a 13-digit Unix timestamp in milliseconds. |
| 400 | 1001 | params end format is error |
The end time format is incorrect. |
Must be a 13-digit Unix timestamp in milliseconds. |
| 400 | 1001 | params end plan is error! |
The end time is in the past. |
The end time must be later than the current time. |
| 400 | 1001 | params start and end interval Too Brief! |
The duration between start and end is too short. |
The minimum interval is 5 minutes. |
| 400 | 1001 | params ${field} format is error |
A specified field has an incorrect format. | Refer to the API documentation for the correct format of the specified field. |
| 403 | 1002 | apiName, n, r, k not exist or empty |
One or more authentication parameters are missing. | Ensure n, r, and k are all present in the request URL. |
| 403 | 1002 | random.length gt 32 or key.length ne 32 |
The length of the r or k parameter is incorrect. |
r cannot exceed 32 characters, and k must be exactly 32 characters. |
| 403 | 1002 | you do not have right to access this api |
You do not have permission to use this API. | Confirm that API access is enabled for your account. Activation may take 5-10 minutes. |
| 403 | 1002 | k is error |
The k parameter (MD5 signature) is incorrect. |
Verify your MD5 calculation method and secret key. |
| 403 | 1002 | frequency is great than limitCount |
The API call rate limit has been exceeded. | Reduce call frequency. The limit typically refreshes every 5 minutes (e.g., 100 calls per 5 minutes). |
| 403 | 1002 | random is repeat |
The r value has been repeated within a short time. |
Ensure r is unique for each request. Using a timestamp is a good practice. |
| 403 | 1002 | user and host not relation |
The account does not have permission for the specified domain. | For sub-accounts, ensure the domain is configured in the control panel’s domain list. |
This endpoint allows you to retrieve the status and details of tasks.
GEThttp://livect.cdnetworks.com/api/cdn/v2/forwardQueryByPage.actionExample Request URL:
http://livect.cdnetworks.com/api/cdn/v2/forwardQueryByPage.action?n=test&r=1741165183&k=a6edsa3c30d64e172b52136ba493ad1f&id=task_unique_id_001
| Field | Required | Description |
|---|---|---|
n, r, k |
Yes | Standard authentication parameters. |
id |
Conditional | The unique task id (exact match). |
src |
Conditional | A source URL (fuzzy match). |
forward |
Conditional | A forwarding destination URL (fuzzy match). |
pageNo |
No | Page number for paginated results. Default is 1. |
pageSize |
No | Number of results per page. Default is 100, max is 100. |
Note: At least one of id, src, or forward must be provided.
Sample Query Response:
{
"total": 1,
"pageNo": 1,
"pageSize": 100,
"list": [
{
"id": "task_unique_id_001",
"type": "live",
"src": "[{\"url\":\"http://source.example.com/live/stream1.flv\"}]",
"forward": "rtmp://[dest1.example.com/live/output](https://dest1.example.com/live/output)",
"cmd": "1",
"code": "0",
"msg": "Start pushing!",
"startTime": "2025-03-05 16:05:12",
"endTime": ""
}
]
}
If a transcallbackurl is provided in the task creation request, the system will send POST requests with a JSON payload to that URL to notify you of task status changes.
Sample Callback Body:
{
"id": "task_unique_id_001",
"srcurl": "[{\"url\":\"http://source.example.com/live/stream1.flv\"}]",
"forwardurl": "rtmp://[dest1.example.com/live/output](https://dest1.example.com/live/output)",
"cmd": "1",
"code": "0",
"msg": "Start pushing!",
"event_time": 1600402486054
}
code and msg Reference| code | msg Description | Meaning |
|---|---|---|
0 |
Start pushing! |
The stream forwarding has started successfully. |
1 |
Push stream success |
The task completed normally (e.g., VOD file finished, scheduled end time reached). |
2 |
live_pull failed:xxxxx |
Forwarding stopped due to an external error (e.g., source stream became unavailable, connection lost). |
3 |
Push stream failed! |
Forwarding stopped due to an internal server error. |
4 |
(file): Server returned 404... |
A non-critical warning occurred (e.g., a VOD file in a playlist was not found). The task will attempt to continue with the next item. |
5 |
list update success |
An informational update, often used in VOD carousels to indicate a new file is being processed. |
90 |
task not exists |
The requested task ID was not found (applies to cmd values 2, 3, 5). |
91 |
task repeat,task not start! |
A task with the same destination URL is already active. |
92 |
task start delivery failed! |
The system failed to initiate the task. Please retry. |
Task Lifetime:
start and end are omitted, the task runs until cmd=2 is called or the source stream is disconnected.start and end are provided, the task runs within that window. It can still be stopped early with cmd=2.Time Constraints:
start and end time must be at least 5 minutes.end time must be in the future.Transcoding: If you set any transcoding parameters in fops (like bps, res, or fps), you must also specify the vcodec.
Updating a Task (cmd=3): This command is used to update the source (src) for a task that is already running. You can also include fops and extendParam in the update request. Note that if a scheduled task has not yet started, you must first cancel it (cmd=2) and then create a new one with the updated configuration.
Resuming a Task (cmd=5): This command resumes a stopped task. It can be used within 48 hours of a task stopping. There are two stop scenarios with different resume behaviors:
Natural Stop: Occurs when all files in the src list have finished playing. Resuming with cmd=5 will restart the task from the beginning of the first file in the list.
Manual Stop: Occurs when a task is stopped with a cmd=2 command. Resuming with cmd=5 will continue from the point of interruption.
The resume request ignores fops and extendParam; it only requires the id, src, and forward parameters to match the original task. Use resetUrl to specify a new destination if needed.
Stopping a Task (cmd=2):
id must match the running task.forward array of the stop request.forward list in your cmd=2 request should ideally include all currently active forwarding URLs for that task, or match the complete forward list provided when the task was initially created or last updated.forward array of a stop request must exactly match the URL(s) that were used when the task was created (cmd=1) or last modified (cmd=3).Rate Limiting: Be mindful of the API call frequency limit (typically 100 calls per 5 minutes). Exceeding this limit will result in a 403 Forbidden error.
Parameter Formatting: Note the difference in format: src and forward are JSON arrays in the API request, but are delivered as stringified JSON in the srcurl and forwardurl fields of callback messages.