Skip to content

API for LIVE resource

Description

This section describes API methods for creating, deleting and configurations changing of your resources. You will also find here the information on cache managing and statistical data receiving.

All the responses (including errors) return in JSON Format.

Attention!

  1. You can make not more than 5 API requests (POST, PUT) every minute. When the limit is reached, a response with the status code 200 will be received:
    {"status": "error", "message": "Rate limit exceeded", "description": "Request is forbidden"}
    
  2. There is a limit of 100 resources. If you need more resources, please contact your personal manager or support.

Find below examples for monitoring and configuring of the options in connection with Live streaming service.

Get stream information

General information

Warning!

  1. There is a limit on the number of API calls:
    • no more than 10 requests per minute.

Required headers: CDN-AUTH-TOKEN (authorization token, refer. Authorization)

In case of correct response API returns 2xx response code and response text in the following format:

{
  "status": "Completed",
  "data": <API response>,
  "<request parameter 1>": "value1",
  "<request parameter 2>": "value2"
}

In case of an error response, the API returns the corresponding response code and the response text in the following format:

{
  "status": "Forbidden",
  "description": "Token is expired"
}

The description field returns a text description of the error.

Get stream status

URL: https://api.cdnvideo.ru/app/streams/v1/<your_account_name>/status/<stream_name>

  • Request type: GET
  • Headers: CDN-AUTH-TOKEN
  • Request parameters: no request parameters
  • Response data type: JSON Object
  • Response parameters:
Parameter Type Description
is_alive boolean is the stream alive
start_ts integer or null Time of appearance of the stream.
If the stream is on several servers, then the minimum of hosts.start_ts.
Possible values:
  • UTC timestamp - if the stream is active
  • null - if the stream is inactive
  • hosts array List of servers that have a stream
    hosts.host string Server
    hosts.start_ts integer Time of appearance of the stream

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api.cdnvideo.ru/app/streams/v1/testaccount/status/test/stream1'
    

    Example response for an inactive stream

    {
      "status": "Completed",
      "stream_name": "test/stream1",
      "data": {
        "is_alive": false,
        "start_ts": null,
        "hosts": []
      }
    }
    

    Example response for an active stream

    {
      "status": "Completed",
      "stream_name": "test/stream1",
      "data": {
        "is_alive": true,
        "start_ts": 1693392088,
        "hosts": [
          {
            "host": "ffce3977afe64227676096887231adba",
            "start_ts": 1693392088
          },
          {
            "host": "7bd5e6ccea2e689d252eb4c183a1aaf6",
            "start_ts": 1693392089
          }
        ]
      }
    }
    

    Configuration for LIVE Resource

    RTMP/RTSP-publish

    Get all resources

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: GET
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Array or JSON Object in case of error

    Available query string parameters (* - required parameter):

    Parameter Description Possible values Default value
    active Filter by active/deactivated resource true / false true

    Possible response codes:

    Status Code Response Data Response Format Description
    200 All live resources configured in specified account or error description JSON Response with list of resources or error
    403 None None Forbidden
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    [
      {
        "name": "test_resource",
        "settings": {
          "RTMP-publish": {
            "domain": "p0q2zwj4yih.a.trbcdn.net",
            "pub_protocol": "rtmp",
            "master_stream": "jws2w_test_resource.smil",
            "primary": "a.r.cdnvideo.net",
            "application": "livemaster",
            "dist_protocol": "https",
            "backup": "b.r.cdnvideo.net"
          }
        },
        "streams": {
          "someid1": {
            "stream_name": "someid1_stream01",
            "password": "RtdHESB7aA7rdKDCuVYn5W9Zp",
            "resolution": "720p",
            "name": "stream01",
            "smil": {
              "BANDWIDTH": "5000000",
              "RESOLUTION": "1280x720"
            }
          },
          "someid2": {
            "stream_name": "someid2_stream02",
            "password": "dRKLVu6v90P5PhSAMIGSIgKuh",
            "resolution": "1080p",
            "name": "stream02",
            "smil": {
              "BANDWIDTH": "10000000",
              "RESOLUTION": "1920x1080"
            }
          }
        },
        "active": true,
        "creation_ts": 1542872090,
        "type": "RTMP-publish",
        "id": "1163546047721937079_p0q2zwj4yih",
        "resources": {
          "http": "test"
        },
        "cdn_domain": "test.a.trbcdn.net",
        "description": ""
      }
    ]
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Attention

    To get deactivated resources, use the query parameter "active" with the value "false"

    Get specific resource

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: GET
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object

    Available query string parameters (* - required parameter):

    Parameter Description Possible values Default value
    active Filter by active/deactivated resource true / false true

    Possible response codes:

    Status Code Response Data Response Format Description
    200 Live resource configured in specified account or error description JSON Response with resource or error
    403 None None Forbidden
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/1163546047721937079_p0q2zwj4yih
    

    Successful response example

    {
      "name": "test_resource",
      "settings": {
        "RTMP-publish": {
          "domain": "p0q2zwj4yih.a.trbcdn.net",
          "pub_protocol": "rtmp",
          "master_stream": "jws2w_test_resource.smil",
          "primary": "a.r.cdnvideo.net",
          "application": "livemaster",
          "dist_protocol": "https",
          "backup": "b.r.cdnvideo.net"
        }
      },
      "streams": {
        "someid1": {
          "stream_name": "someid1_stream01",
          "password": "RtdHESB7aA7rdKDCuVYn5W9Zp",
          "resolution": "720p",
          "name": "stream01",
          "smil": {
            "BANDWIDTH": "5000000",
            "RESOLUTION": "1280x720"
          }
        },
        "someid2": {
          "stream_name": "someid2_stream02",
          "password": "dRKLVu6v90P5PhSAMIGSIgKuh",
          "resolution": "1080p",
          "name": "stream02",
          "smil": {
            "BANDWIDTH": "10000000",
            "RESOLUTION": "1920x1080"
          }
        }
      },
      "active": true,
      "creation_ts": 1542872090,
      "type": "RTMP-publish",
      "id": "1163546047721937079_p0q2zwj4yih",
      "resources": {
        "http": "test"
      },
      "cdn_domain": "test.a.trbcdn.net",
      "description": ""
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Attention

    To get deactivated resource, use the query parameter "active" with the value "false"

    Get specific resource status

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/status/live/<resource_id>

    • Method: GET
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 LIVE resource status or error description JSON Response with resource status or error
    403 None None Forbidden
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Response data format:

    Parameter Description Possible values
    resource Resource ID Resource ID from request URL
    status Resource status "Completed" / "Processing" / "Error"
    message Status description "" / "dns processing" / "configuration processing"

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" https://api.cdnvideo.ru/cdn/api/v1/testaccount/status/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {"resource": "3087695896608003328_cybku4cl0av", "status": "Completed", "message": ""}
    

    Unsuccessful response example

    {"status": "error", "message": "Invalid Token", "description": "Invalid or expired token"}
    

    Create resource

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X POST \
      -d '{"name": "test_resource", "type": "RTMP-publish", "streams": {"someid1": {"name": "stream01", "resolution": "720p"}, "someid2": {"name": "stream02", "resolution": "1080p"}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831469",
      "resource_id": "1163546047721937079_p0q2zwj4yih"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}
    

    Update resource

    Attention

    This request completely replaces the resource configuration with the data passed in the body of the PUT request.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PUT
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new resource data
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PUT \
      -d '{"name": "test_resource", "type": "RTMP-publish", "streams": {"someid1": {"name": "stream01", "resolution": "360p"}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/1163546047721937079_p0q2zwj4yih
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008585"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}
    

    Update resource partitially

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new resource first-level data
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"name": "test_resource"}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/1163546047721937079_p0q2zwj4yih
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008585"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "resource name length should be between 5 and 100. Not 3"}
    

    Deactivate resource

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Deactivated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"active": false}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/1163546047721937079_p0q2zwj4yih
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008586"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Activate resource

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Activated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"active": true}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/1163546047721937079_p0q2zwj4yih
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008586"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Local authorization $

    Create resource with local authorization

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data and local authorization parameters
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X POST \
      -d '{"auth": {"md5": {"secret": "123", "forever": true, "anywhere": true}}, "name": "test_resource", "type": "RTMP-publish", "streams": {"someid1": {"name": "stream01", "resolution": "720p"}, "someid2": {"name": "stream02", "resolution": "1080p"}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831469",
      "resource_id": "1163546047721937079_p0q2zwj4yih"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}
    

    Update resource local authorization

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new parameters of local authorization
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"auth": {"md5": {"secret": "456", "forever": true}}}'\
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/1163546047721937079_p0q2zwj4yih
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008585"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}
    

    External authorization $

    Create resource with external authorization

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with external authorization parameters
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X POST \
      -d '{"auth": {"url": "https://test.com/yourscript"}, "name": "test_resource", "type": "RTMP-publish", "streams": {"someid1": {"name": "stream01", "resolution": "720p"}, "someid2": {"name": "stream02", "resolution": "1080p"}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831469",
      "resource_id": "1163546047721937079_p0q2zwj4yih"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}
    

    Update resource external authorization

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new parameters of external authorization
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"auth": {"url": "https://test.com/yourscript2"}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/1163546047721937079_p0q2zwj4yih
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008585"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}
    

    Limitations $

    Create resource with geo, IP, referer or useragent

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data and limitations parameters
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
    -X POST \
    -d '{"name": "test_resource", "type": "RTMP-publish", "streams": {"someid1": {"name": "stream01", "resolution": "720p"}}, "limitations": {"geo": [{"default_action": "allow", "exclude": [{"country": "RU", "region": "BEL", "action": "deny"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}, {"default_action": "allow", "exclude": [{"country": "RU", "region": "CR", "action": "deny"}, {"country": "RU", "region": null, "action": "deny"}], "times": [{"start": "2019-07-20T14:19:00Z", "end": null}]}], "ip": [{"default_action": "deny", "exclude": [{"ip":"192.168.0.1/24"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}], "referer": [{"default_action": "deny", "exclude": [{"referer":"*.ru"}], "times": [{"start": null, "end": "2019-07-20T14:18:00Z"}]}], "useragent": [{"default_action": "deny", "exclude": [{"useragent": "browser_name"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}]}}' \
    https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
    "status": "accept",
    "task_id": "20180402162358692400",
    "resource_id": "1163546047721937079_p0q2zwj4yih"
    }
    

    Unsuccessful response example

    {
    "status": "error",
    "message": "json invalid",
    "description": "limitations : Invalid time interval: start:2021-05-11T19:12:00Z, end:2021-05-09T22:12:00Z"
    }
    

    Update resource limitations

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new parameters of external authorization
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description None Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
    -X PATCH \
    -d '{"limitations": { "ip": [{"default_action": "deny", "exclude": [{"ip":"192.168.0.1/24"}], "times": []}]}}' \
    https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/1163546047721937079_p0q2zwj4yih
    

    Successful response example

    {"status": "accept", "task_id": "20180402162358692401"}
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    To receive the full publication links, you have to combine live resource parameters, received via GET-request.

    <pub_protocol>://<primary|backup>/<application>/<stream_name>?auth=<password>
    

    Example of final link for publishing:

    rtmp://a.r.cdnvideo.net/livemaster/someid1_stream01?auth=MkE5MGtjbPljT52t491y6z14C
    

    <dist_protocol>://<domain>/<application>/<master_stream>/playlist.m3u8
    

    Example of final link for streaming:

    https://p0q2zwj4yih.a.trbcdn.net/livemaster/jws2w_test_resource.smil/playlist.m3u8
    

    Transcoding $

    You can order the service of transcoding the input stream in several qualities. This will reduce the cost of hardware or software.

    Important!

    This service is paid according to the tariffs indicated in dashboard.

    Transcoding profiles

    We offer the following transcoding profiles:

    Profile ID Qualities Video codec Audio codec Combining qualities into one stream
    360_480_720 360p, 480p, 720p h.264 AAC/mp3 +
    480_720_1080 480p, 720p, 1080p h.264 AAC/mp3 +
    360_480_720_1080 360p, 480p, 720p, 1080p h.264 AAC/mp3 +
    Order the service

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data and selected transcoding profile
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X POST \
      -d '{"name": "test_resource", "transcode_profile": "360_480_720", "type": "RTMP-publish", "streams": {"someid1": {"name": "stream01", "resolution": "720p"}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831469",
      "resource_id": "1163546047721937079_p0q2zwj4yih"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "transcode_profile should be one of ['480_720_1080', '360_480_720', '360_480_720_1080']. Not 360_480"}
    

    Attention

    If you order a transcoding service, then you should specify ONLY ONE input stream.

    Change the service

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new transcoding profile
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"transcode_profile": "360_480_720_1080"}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/1163546047721937079_p0q2zwj4yih
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831471"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "there must be only one stream to be transcoded. Not 0"}
    

    Attention

    If you order a transcoding service, then you should specify ONLY ONE input stream.

    Deactivate the service

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with empty transcoding profile
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"transcode_profile": ""}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/1163546047721937079_p0q2zwj4yih
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831472"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    SRT-publish

    Get all resources

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: GET
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Array or JSON Object in case of error

    Available query string parameters (* - required parameter):

    Parameter Description Possible values Default value
    active Filter by active/deactivated resource true / false true

    Possible response codes:

    Status Code Response Data Response Format Description
    200 All live resources configured in specified account or error description JSON Response with list of resources or error
    403 None None Forbidden
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    [
        {
          "id": "3087695896608003328_cybku4cl0av",
          "name": "test_resource",
          "type": "SRT-publish",
          "active": true,
          "streams": {
            "someid1": {
              "name": "stream01",
              "smil": {
                "BANDWIDTH": "5000000",
                "RESOLUTION": "1280x720"
              },
              "password": "IEVM5Vyew2nEjPcYZmaskikMN",
              "resolution": "720p",
              "stream_name": "someid1_stream01"
            },
            "someid2": {
              "name": "stream02",
              "smil": {
                "BANDWIDTH": "10000000",
                "RESOLUTION": "1920x1080"
              },
              "password": "SA4fxfaJGK6jLcaADwYZZhe2S",
              "resolution": "1080p",
              "stream_name": "someid2_stream02"
            }
          },
          "settings": {
            "SRT-publish": {
              "backup": "b.r.cdnvideo.net",
              "domain": "test.a.trbcdn.net",
              "primary": "a.r.cdnvideo.net",
              "application": "livemastersrt",
              "pub_protocol": "srt",
              "dist_protocol": "https",
              "master_stream": "kqa3m_test_resource.smil",
              "transcode_profile": ""
            }
          },
          "resources": {
            "http": "test"
          },
          "creation_ts": 1686209143,
          "description": "",
          "locations": {
            "/": {
              "cache": {
                "live": true,
                "valid": {
                  "2xx": "300s",
                  "3xx": "1s",
                  "4xx": "1s",
                  "5xx": "1s"
                }
              }
            }
          },
          "cache": {
            "live": true,
            "consider_args": false
          },
          "cdn_domain": "test.a.trbcdn.net"
        }
    ]
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Attention

    To get deactivated resources, use the query parameter "active" with the value "false"

    Get specific resource

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: GET
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object

    Available query string parameters (* - required parameter):

    Parameter Description Possible values Default value
    active Filter by active/deactivated resource true / false true

    Possible response codes:

    Status Code Response Data Response Format Description
    200 Live resource configured in specified account or error description JSON Response with resource or error
    403 None None Forbidden
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {
      "id": "3087695896608003328_cybku4cl0av",
      "name": "test_resource",
      "type": "SRT-publish",
      "active": true,
      "streams": {
        "someid1": {
          "name": "stream01",
          "smil": {
            "BANDWIDTH": "5000000",
            "RESOLUTION": "1280x720"
          },
          "password": "IEVM5Vyew2nEjPcYZmaskikMN",
          "resolution": "720p",
          "stream_name": "someid1_stream01"
        },
        "someid2": {
          "name": "stream02",
          "smil": {
            "BANDWIDTH": "10000000",
            "RESOLUTION": "1920x1080"
          },
          "password": "SA4fxfaJGK6jLcaADwYZZhe2S",
          "resolution": "1080p",
          "stream_name": "someid2_stream02"
        }
      },
      "settings": {
        "SRT-publish": {
          "backup": "b.r.cdnvideo.net",
          "domain": "test.a.trbcdn.net",
          "primary": "a.r.cdnvideo.net",
          "application": "livemastersrt",
          "pub_protocol": "srt",
          "dist_protocol": "https",
          "master_stream": "kqa3m_test_resource.smil",
          "transcode_profile": ""
        }
      },
      "resources": {
        "http": "test"
      },
      "creation_ts": 1686209143,
      "description": "",
      "locations": {
        "/": {
          "cache": {
            "live": true,
            "valid": {
              "2xx": "300s",
              "3xx": "1s",
              "4xx": "1s",
              "5xx": "1s"
            }
          }
        }
      },
      "cache": {
        "live": true,
        "consider_args": false
      },
      "cdn_domain": "test.a.trbcdn.net"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Attention

    To get deactivated resource, use the query parameter "active" with the value "false"

    Get specific resource status

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/status/live/<resource_id>

    • Method: GET
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 LIVE resource status or error description JSON Response with resource status or error
    403 None None Forbidden
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Response data format:

    Parameter Description Possible values
    resource Resource ID Resource ID from request URL
    status Resource status "Completed" / "Processing" / "Error"
    message Status description "" / "dns processing" / "configuration processing"

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" https://api.cdnvideo.ru/cdn/api/v1/testaccount/status/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {"resource": "3087695896608003328_cybku4cl0av", "status": "Completed", "message": ""}
    

    Unsuccessful response example

    {"status": "error", "message": "Invalid Token", "description": "Invalid or expired token"}
    

    Create resource

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X POST \
      -d '{"name": "test_resource", "type": "SRT-publish", "streams": {"someid1": {"name": "stream01", "resolution": "720p"}, "someid2": {"name": "stream02", "resolution": "1080p"}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831469",
      "resource_id": "3087695896608003328_cybku4cl0av"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}
    

    Update resource

    Attention

    This request completely replaces the resource configuration with the data passed in the body of the PUT request.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PUT
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new resource data
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PUT \
      -d '{"name": "test_resource", "type": "SRT-publish", "streams": {"someid1": {"name": "stream01", "resolution": "360p"}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008585"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}
    

    Update resource partitially

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new resource first-level data
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"name": "test_resource"}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008585"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "resource name length should be between 5 and 100. Not 3"}
    

    Deactivate resource

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Deactivated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"active": false}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008586"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Activate resource

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Activated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"active": true}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008586"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Local authorization $

    Create resource with local authorization

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data and local authorization parameters
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X POST \
      -d '{"auth": {"md5": {"secret": "123", "forever": true, "anywhere": true}}, "name": "test_resource", "type": "SRT-publish", "streams": {"someid1": {"name": "stream01", "resolution": "720p"}, "someid2": {"name": "stream02", "resolution": "1080p"}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831469",
      "resource_id": "3087695896608003328_cybku4cl0av"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}
    

    Update resource local authorization

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new parameters of local authorization
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"auth": {"md5": {"secret": "456", "forever": true}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008585"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}
    

    External authorization $

    Create resource with external authorization

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data and external authorization parameters
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X POST \
      -d '{"auth": {"url": "https://test.com/yourscript"}, "name": "test_resource", "type": "SRT-publish", "streams": {"someid1": {"name": "stream01", "resolution": "720p"}, "someid2": {"name": "stream02", "resolution": "1080p"}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831469",
      "resource_id": "3087695896608003328_cybku4cl0av"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}
    

    Update resource external authorization

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new parameters of external authorization
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"auth": {"url": "https://test.com/yourscript2"}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008585"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}
    

    Limitations $

    Create resource with geo, IP, referer or useragent

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data and limitations parameters
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
    -X POST \
    -d '{"name": "test_resource", "type": "SRT-publish", "streams": {"someid1": {"name": "stream01", "resolution": "720p"}}, "limitations": {"geo": [{"default_action": "allow", "exclude": [{"country": "RU", "region": "BEL", "action": "deny"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}, {"default_action": "allow", "exclude": [{"country": "RU", "region": "CR", "action": "deny"}, {"country": "RU", "region": null, "action": "deny"}], "times": [{"start": "2019-07-20T14:19:00Z", "end": null}]}], "ip": [{"default_action": "deny", "exclude": [{"ip":"192.168.0.1/24"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}], "referer": [{"default_action": "deny", "exclude": [{"referer":"*.ru"}], "times": [{"start": null, "end": "2019-07-20T14:18:00Z"}]}], "useragent": [{"default_action": "deny", "exclude": [{"useragent": "browser_name"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}]}}' \
    https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
    "status": "accept",
    "task_id": "20180402162358692400",
    "resource_id": "3087695896608003328_cybku4cl0av"
    }
    

    Unsuccessful response example

    {
    "status": "error",
    "message": "json invalid",
    "description": "limitations : Invalid time interval: start:2021-05-11T19:12:00Z, end:2021-05-09T22:12:00Z"
    }
    

    Update resource limitations

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new parameters of external authorization
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description None Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
    -X PATCH \
    -d '{"limitations": { "ip": [{"default_action": "deny", "exclude": [{"ip":"192.168.0.1/24"}], "times": []}]}}' \
    https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {"status": "accept", "task_id": "20180402162358692401"}
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    To receive the full publication links, you have to combine live resource parameters, received via GET-request.

    <pub_protocol>://<primary|backup>:19998/?streamid=#!::r=<application>/<stream_name>,auth=<password>
    

    Example of final link for publishing:

    srt://a.r.cdnvideo.net:19998/?streamid=#!::r=livemastersrt/someid1_stream01,auth=IEVM5Vyew2nEjPcYZmaskikMN
    

    <dist_protocol>://<domain>/<application>/<master_stream>/playlist.m3u8
    

    Example of final link for streaming:

    https://test.a.trbcdn.net/livemastersrt/kqa3m_test_resource.smil/playlist.m3u8
    

    Transcoding $

    You can order the service of transcoding the input stream in several qualities. This will reduce the cost of hardware or software.

    Important!

    This service is paid according to the tariffs indicated in dashboard.

    Transcoding profiles

    We offer the following transcoding profiles:

    Profile ID Qualities Video codec Audio codec Combining qualities into one stream
    360_480_720 360p, 480p, 720p h.264 AAC/mp3 +
    480_720_1080 480p, 720p, 1080p h.264 AAC/mp3 +
    360_480_720_1080 360p, 480p, 720p, 1080p h.264 AAC/mp3 +
    Order the service

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data and selected transcoding profile
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X POST \
      -d '{"name": "test_resource", "transcode_profile": "360_480_720", "type": "SRT-publish", "streams": {"someid1": {"name": "stream01", "resolution": "720p"}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831469",
      "resource_id": "3087695896608003328_cybku4cl0av"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "transcode_profile should be one of ['480_720_1080', '360_480_720', '360_480_720_1080']. Not 360_480"}
    

    Attention

    If you order a transcoding service, then you should specify ONLY ONE input stream.

    Change the service

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new transcoding profile
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"transcode_profile": "360_480_720_1080"}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831471"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "there must be only one stream to be transcoded. Not 0"}
    

    Attention

    If you order a transcoding service, then you should specify ONLY ONE input stream.

    Deactivate the service

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with empty transcoding profile
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"transcode_profile": ""}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103450831472"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    HLS-cache

    Get all resources

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: GET
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Array or JSON Object in case of error

    Available query string parameters (* - required parameter):

    Parameter Description Possible values Default value
    active Filter by active/deactivated resource true / false true

    Possible response codes:

    Status Code Response Data Response Format Description
    200 All live resources configured in specified account or error description JSON Response with list of resources or error
    403 None None Forbidden
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    [
      {
        "origin": {
          "https": true,
          "servers": {
            "yourdomain.com": {
              "backup": false,
              "port": 80,
              "weight": 1
            }
          }
        },
        "cdn_domain": "wtx3l7rtrl6.a.trbcdn.net",
        "name": "live-qxthy19jjz",
        "streams": {
          "2it9dwypm4": {
            "id": "/stream/playlist.m3u8"
          }
        },
        "names": ["test.cname.com"],
        "active": true,
        "creation_ts": 1551853456,
        "type": "HLS-cache",
        "id": "8053158264585032642_wtx3l7rtrl6",
        "resources": {
          "http": "wtx3l7rtrl6"
        },
        "description": ""
      }
    ]
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Attention

    To get deactivated resources, use the query parameter "active" with the value "false"

    Get specific resource

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: GET
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object

    Available query string parameters (* - required parameter):

    Parameter Description Possible values Default value
    active Filter by active/deactivated resource true / false true

    Possible response codes:

    Status Code Response Data Response Format Description
    200 Live resource configured in specified account or error description JSON Response with resource or error
    403 None None Forbidden
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/8053158264585032642_wtx3l7rtrl6
    

    Successful response example

    {
      "origin": {
        "https": true,
        "servers": {
          "yourdomain.com": {
            "backup": false,
            "port": 80,
            "weight": 1
          }
        }
      },
      "cdn_domain": "wtx3l7rtrl6.a.trbcdn.net",
      "name": "live-qxthy19jjz",
      "streams": {
        "2it9dwypm4": {
          "id": "/stream/playlist.m3u8"
        }
      },
      "names": ["test.cname.com"],
      "active": true,
      "creation_ts": 1551853456,
      "type": "HLS-cache",
      "id": "8053158264585032642_wtx3l7rtrl6",
      "resources": {
        "http": "wtx3l7rtrl6"
      },
      "description": ""
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Attention

    To get deactivated resource, use the query parameter "active" with the value "false"

    Get specific resource status

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/status/live/<resource_id>

    • Method: GET
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 LIVE resource status or error description JSON Response with resource status or error
    403 None None Forbidden
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Response data format:

    Parameter Description Possible values
    resource Resource ID Resource ID from request URL
    status Resource status "Completed" / "Processing" / "Error"
    message Status description "" / "dns processing" / "configuration processing"

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" https://api.cdnvideo.ru/cdn/api/v1/testaccount/status/live/3087695896608003328_cybku4cl0av
    

    Successful response example

    {"resource": "3087695896608003328_cybku4cl0av", "status": "Completed", "message": ""}
    

    Unsuccessful response example

    {"status": "error", "message": "Invalid Token", "description": "Invalid or expired token"}
    

    Create resource

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X POST \
      -d '{"name": "live-qxthy20jjz", "type": "HLS-cache", "streams": {"3it9dwypm4": {"id": "/stream/playlist.m3u8"}}, "origin": {"https": false, "read_timeout": "10s", "connect_timeout": "10s", "send_timeout": "10s", "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}, "names": ["test-cname.com"]}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20190305103450831469",
      "resource_id": "9282601590143242685_pqy19d9z3pm"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}
    

    Update resource

    Attention

    This request completely replaces the resource configuration with the data passed in the body of the PUT request.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PUT
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new resource data
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PUT \
      -d '{"name": "live-qxthy20jjz-2", "type": "HLS-cache", "streams": {"4it9dwypm4": {"id": "/stream/playlist-2.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/9282601590143242685_pqy19d9z3pm
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20190305103450831470"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}
    

    Update resource partitially

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new resource first-level data
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"name": "test_resource"}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/9282601590143242685_pqy19d9z3pm
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20181122103856008585"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "resource name length should be between 5 and 100. Not 3"}
    

    Deactivate resource

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Deactivated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"active": false}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/9282601590143242685_pqy19d9z3pm
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20190305103450831479"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Activate resource

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Activated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
      -d '{"active": true}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/9282601590143242685_pqy19d9z3pm
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20190305103450831479"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    Local authorization $

    Attention

    It is not possible to enable local authorization for the entire HLS-cache resource. You can configure local authorization for a specific location.

    Important!

    If local authorization is enabled for locations that include playlists (m3u8, mpd), it is necessary to disable caching in these locations for them to work correctly.

    Create resource with local authorization

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data and local authorization parameters
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X POST \
      -d '{"locations": {"~* \\.m3u8$": {"auth": {"md5": {"secret": "123", "forever": true, "anywhere": true}}}}, "name": "live-qxthy20jjz", "type": "HLS-cache", "streams": {"3it9dwypm4": {"id": "/stream/playlist.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20190305103450831469",
      "resource_id": "9282601590143242685_pqy19d9z3pm"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}
    

    Update resource local authorization

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new parameters of local authorization
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
     -d '{"locations": {"~* \\.m3u8$": {"auth": {"md5": {"secret": "234", "forever": true, "anywhere": true}}, "cache": {"valid": {"2xx": "1s", "3xx": "1s"}}}, "/": {"cache": {"valid": {"2xx": "300s", "3xx": "1s", "4xx": "1s", "5xx": "1s"}}}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/9282601590143242685_pqy19d9z3pm
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20190305103450831470"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}
    

    External authorization $

    Important!

    It is not possible to enable external authorization for the entire HLS-cache resource. You can configure external authorization for a specific location.

    Create resource with external authorization

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data and external authorization parameters
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X POST \
      -d '{"locations": {"~* \\.m3u8$": {"auth": {"url": "https://test.com/yourscript"}}}, "name": "live-qxthy20jjz", "type": "HLS-cache", "streams": {"3it9dwypm4": {"id": "/stream/playlist.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20190305103450831469",
      "resource_id": "9282601590143242685_pqy19d9z3pm"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}
    

    Update resource external authorization

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new parameters of external authorization
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description JSON Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
      -X PATCH \
     -d '{"locations": {"~* \\.m3u8$": {"auth": {"url": "https://test.com/yourscript_new"}, "cache": {"valid": {"2xx": "1s", "3xx": "1s"}}}, "/": {"cache": {"valid": {"2xx": "300s", "3xx": "1s", "4xx": "1s", "5xx": "1s"}}}}}' \
      https://api.cdnvideo.ru/cdn/api/v1/testaccount/resource/live/9282601590143242685_pqy19d9z3pm
    

    Successful response example

    {
      "status": "accept",
      "task_id": "20190305103450831470"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}
    

    Limitations $

    Create resource with geo, IP, referer or useragent limitations

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

    • Method: POST
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with resource data and limitations parameters
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
    -X POST \
    -d '{"name": "test_resource", "type": "HLS-cache", "streams": {"someid1": {"id": "/stream/playlist.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}, "names": ["test-cname.com"], "limitations": {"geo": [{"default_action": "allow", "exclude": [{"country": "RU", "region": "BEL", "action": "deny"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}, {"default_action": "allow", "exclude": [{"country": "RU", "region": "CR", "action": "deny"}, {"country": "RU", "region": null, "action": "deny"}], "times": [{"start": "2019-07-20T14:19:00Z", "end": null}]}], "ip": [{"default_action": "deny", "exclude": [{"ip":"192.168.0.1/24"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}], "referer": [{"default_action": "deny", "exclude": [{"referer":"*.ru"}], "times": [{"start": null, "end": "2019-07-20T14:18:00Z"}]}], "useragent": [{"default_action": "deny", "exclude": [{"useragent": "browser_name"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}]}}' \
    https://api.cdnvideo.ru/cdn/api/v1/<account_name>/resource/live/
    

    Successful response example

    {
    "status": "accept",
    "task_id": "20180402162358692413",
    "resource_id": "1163546047721937079_p0q2zwj4yih"
    }
    

    Unsuccessful response example

    {
    "status": "error",
    "message": "json invalid",
    "description": "limitations : Invalid time interval: start:2021-05-11T19:12:00Z, end:2021-05-09T22:12:00Z"
    }
    

    Update resource limitations

    Attention

    This request completely replaces the resource first level fields with the data passed in the PATCH request body. The request does not change fields that have not been passed.

    URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

    • Method: PATCH
    • Headers: CDN-AUTH-TOKEN
    • Request Data: JSON with new parameters of external authorization
    • Response Data Type: JSON Object
    Status Code Response Data Response Format Description
    200 task_id or error description None Updated, id of task in global task queue or error
    400 None None Bad Request
    404 None None Not Found
    500 None None Internal Server Error
    503 None None Service Unavailable

    Request example

    curl -H "CDN-AUTH-TOKEN: $TOKEN" \
    -X PATCH \
    -d '{"limitations": {"geo": [{"default_action": "allow", "exclude": [{"country": "RU", "region": "BEL", "action": "deny"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}, {"default_action": "allow", "exclude": [{"country": "RU", "region": "CR", "action": "deny"}, {"country": "RU", "region": null, "action": "deny"}], "times": [{"start": "2019-07-20T14:19:00Z", "end": null}]}], "ip": [{"default_action": "deny", "exclude": [{"ip":"192.168.0.1/24"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}], "referer": [{"default_action": "deny", "exclude": [{"referer":"*.ru"}], "times": [{"start": null, "end": "2019-07-20T14:18:00Z"}]}], "useragent": [{"default_action": "deny", "exclude": [{"useragent": "browser_name"}], "times": [{"start": "2019-07-20T14:17:00Z", "end": "2019-07-20T14:18:00Z"}]}]}}' \
    https://api.cdnvideo.ru/cdn/api/v1/<account_name>/resource/live/<resource_id>
    

    Successful response example

    {
    "status": "accept",
    "task_id": "20180402162358692413"
    }
    

    Unsuccessful response example

    {"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}
    

    To receive the full streaming links, you have to combine live resource parameters, received via GET-request.

    <pub_protocol>://<cdn_domain>/<stream_id>
    
    <pub_protocol>://<names>/<stream_id>
    

    Example of final CDN-links:

    https://wtx3l7rtrl6.a.trbcdn.net/stream/playlist.m3u8
    
    https://test.cname.com/stream/playlist.m3u8