About

You can use this API with any RESTful compliant client.
In the tables below you will find useful information about request methods, URIs, parameters, how to validate different data and a short description for each. Some of the requests have default values or helper functions. The latter can be used to quickly perform a simple task.
The main purpose of this API is to allow you to configure or fetch information about your zones, or create a purge cache job.

Authentication

You can find your Authentication Token (also known as API key) in your control panel under "View Profile". You will need this token for authenticating with UCDN API. Every request to our API should be authenticated. At the moment we support the following methods of authentication. You can select whichever one you find most suitable for you.
  • Query Token - for every request to our API supply the query parameter token. So the request to GET your account info will become GET https://api.ucdn.com/v4/account/?token=your-api-token.
  • HTTP Header Token - every request to our API must include the HTTP header X-UCDN-Token with value your Authentication Token.

Request Prameters and Responses

Request prameters for the GET method must be in the query string. For every other method (POST, PUT, PATCH) parameters should be supplied in the request body using application/json or application/x-www-form-urlencoded. Content-Type header in the request is required.
Our API always responds with json.

List all certificates

This API call lists all certificates for your account. It retuns an array with objects. Every object is information for one certificate. See the call for single certificate where all keys and values for single object are explained.
GET https://api.ucdn.com/v4/certificates
This request returns the following information
Name Type Description
*** array All certificates for this account.
This request returns one of the following messages
Status Type Description
200 array success message

Examples

curl -X GET "https://api.ucdn.com/v4/certificates/?token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:03:15 GMT
Server: Apache
X-Powered-By: PHP/5.6.8-pl0-gentoo
X-Cache: hit
Vary: Accept-Encoding
Content-Length: 320
Content-Type: application/json; charset=utf-8

[
    {
        "id": 18,
        "hostname": "cdn.section9.com",
        "fingerprint": "3d284b5326388d22f9bfb15600917ebc1dfa96cd",
        "used_in_zones": [
            {
                "zone_id": 1,
                "domain": "cdn.section9.com",
                "cdn_domain": "a1-121.so.clients.cdn13.com"
            }
        ]
    },
    {
        "id": 35,
        "hostname": "cdn3.section9.co.jp",
        "fingerprint": "0f382f59b8ee80950c9663042190008927a6012f",
        "used_in_zones": []
    }
]

Single certificate information

Information for a particular certificate. For security reasons it includes the certificate's fingerprint only.
GET https://api.ucdn.com/v4/certificate/{crt_id}
This request returns the following information
Name Type Description
id int The id of this certificate
fingerprint string sha1 of the certificate you've uploaded.
hostname string The hostname this certificate is used with.
used_in_zones array List of all zones which make use of this certificate.
This request returns one of the following messages
Status Type Description
200 object success message
404 string certificate did not exists

Examples

curl -X GET "https://api.ucdn.com/v4/certificate/18/?token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:03:15 GMT
Server: Apache
X-Powered-By: PHP/5.6.8-pl0-gentoo
X-Cache: hit
Vary: Accept-Encoding
Content-Length: 199
Content-Type: application/json; charset=utf-8

{
    "id": 18,
    "hostname": "cdn.section9.com",
    "fingerprint": "3d284b5326388d22f9bfb15600917ebc1dfa96cd",
    "used_in_zones": [
        {
            "zone_id": 1,
            "domain": "cdn.section9.com",
            "cdn_domain": "a1-121.so.clients.cdn13.com"
        }
    ]
}

Upload certificate

Will add this certificate in UCDN. UCDN ssl servers will start to use this certificate for this hostname.
POST https://api.ucdn.com/v4/certificate/
This request returns one of the following messages
Status Type Description
200 string success message
409 string Error message
This request expects the following parameters
Name Type Validation Default Description
certificate string required It must be in .pem format. Base64 encoded certificate with BEGIN and END. Your certificate in pem format
key string required It must be in .pem format. We support only base64 encoded RSA keys. Your key in pem format
ca_bundle string It must be in .pem format. Base64 encoded with BEGIN and END. CA bundle




Examples

curl -X POST "https://api.ucdn.com/v4/certificate/?token=acf0230d03f5b71d7252e336106f7338" --header "Content-Type: application/json" -d '{"key": "-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQDc95uOOiAJNKaoZBvTqIaMjCRVWhGjiZcHkmM+rENyW4xOuai1\nY2WUyj59jYsHzusu31NmaWgNTSzeYhI0oSBPCmitIEDmp7mGzfqadwFlbtQuAsaK\nR2QkvdpTHkPJaiT0N58Isq2J3M2jjwHnX2npYQILxgndWwt+syeXFoDauwIDAQAB\nAoGAEijfRd8NBvSmxawEhW6SMDbMPZ97V59VJDApq9roaBuR+l5TuSSEEqhUXmkl\nhezBc0azSfVbscwn5dbVfDHJv84Y5BcPyvzBqtrUhzO64HPefFICQh6HpE4t/rke\npSl9KeznWpiQqMq5AQwQo1IHeINnXdp7ZLDp9mCGOJV4Y3ECQQDwIL7kM7Q0nhZ/\nOO4yYzL+AMAYvs1hvhR2Ij7bWYuqJ+Pb/8aV8IrjDQMujFcfS2GwKDEPed42oQZl\n79hQjvavAkEA65Kjzck51prvMNdwv1abcq66COXLf8EdyY74QqjrtKknEweQclQs\nihCt0x47O+YiB1zJ/VLpW845EBCfUpbftQJAI7s7rIllD09W2aeHCkholhNWglgi\nB6FZOhrub4Vrmu5Eob/1tOoOQKr3Bj4r2KRG7QeOBVeFEWv0n8aI0bP0UQJBAKY9\n+LzbmaZ59fxIvTc5/j9DUOPAjwicFtJLw6T/Ij9+86U5PFWCU2AnfxOyjOirci4x\n7BWKckYoVRqiMF0PPdUCQEeq3IancNy8/5s7N6PKxEtnJ6G/Odty03pZ5xwSReM9\njBYtqogXMe6BSm9HlVSPYfA8gs4vynFtJlt0Cdc1A/c=\n-----END RSA PRIVATE KEY-----", "certificate": "-----BEGIN CERTIFICATE-----\nMIICLTCCAZYCCQCl/56DTdFTUDANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQGEwJB\nVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0\ncyBQdHkgTHRkMRQwEgYDVQQDDAtleGFtcGxlLmNvbTAeFw0xNTAxMjYxNjIzMTla\nFw0xNjAxMjYxNjIzMTlaMFsxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0\nYXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxFDASBgNVBAMM\nC2V4YW1wbGUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDc95uOOiAJ\nNKaoZBvTqIaMjCRVWhGjiZcHkmM+rENyW4xOuai1Y2WUyj59jYsHzusu31NmaWgN\nTSzeYhI0oSBPCmitIEDmp7mGzfqadwFlbtQuAsaKR2QkvdpTHkPJaiT0N58Isq2J\n3M2jjwHnX2npYQILxgndWwt+syeXFoDauwIDAQABMA0GCSqGSIb3DQEBBQUAA4GB\nAAEQreWBJw7zReaELu2Pn+IUnXd8N6hJBjp3SX1jCO6LjodjKd33sqyvFvRhZOSg\nevp0wiADmAoVE9jToxPEO5ZxJ1j6dtycog60IRbMGskWeh10m/cUzaKGWYnatYqE\nZsNWvi3ahdovfzM7ukkecn9SDrUD+74+qNIhL6QDqhOD\n-----END CERTIFICATE-----"}'
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:10:29 GMT
Server: Apache
X-Powered-By: PHP/5.6.8-pl0-gentoo
Vary: Accept-Encoding
Content-Length: 39
Content-Type: application/json; charset=utf-8

{
    "message": "Certificate saved",
    "id": 41
}

Delete certificate

Removes certificate from the CDN. Any further HTTPS hits on the domain for this certificate will use the shared UCDN ssl certificate. This may cause verification errors.
DELETE https://api.ucdn.com/v4/certificate/{crt_id}
This request returns one of the following messages
Status Type Description
200 string success message
404 string certificate did not exists

Examples

curl -X DELETE "https://api.ucdn.com/v4/certificate/20/?token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:10:28 GMT
Server: Apache
X-Powered-By: PHP/5.6.8-pl0-gentoo
Vary: Accept-Encoding
Content-Length: 33
Content-Type: application/json; charset=utf-8

{
    "message": "Certificate 43 was deleted"
}

Usage report

Returns served bytes and requests for а particular zone or this account as a whole when `zone_name` is not specified.
GET https://api.ucdn.com/v4/reports?zone_name=...&zone_type=...&date_from=...&date_to=...
This request returns the following information
Name Type Description
bytes_served int Bytes served for the requested period
hits int File hits for the requested period
This request returns one of the following messages
Status Type Description
200 json data
400 json Fail message
404 json Fail message
532 json Fail message
This request expects the following parameters
Name Type Validation Default Description
zone_name string Existing zone name Name of the existing zone.
zone_type string Valid types: ['objects', 'livestream']. Required when zone_name parameter is given. Type of the given zone.
date_from string GMT date in format YYYY-MM-DD or a Unix timestamp 24 hours ago From which date to generate the reports. Inclusive.
date_to string GMT date in format YYYY-MM-DD or a Unix timestamp Now To which date to generate the reports. Exclusive.




Examples

curl -X GET "https://api.ucdn.com/v4/reports?zone_name=test-zone&zone_type=objects&date_from=2015-08-12&date_to=2015-08-13&token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2015 13:21:34 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 49
Content-Type: application/json; charset=utf-8

{
    "hits": 72223298971,
    "bytes_served": 1031761416566
}

Bandwidth

Returns bandwidth in Mbps for particular zone or this account as a whole when `zone_name` is omitted.
GET https://api.ucdn.com/v4/reports/get_bandwidth?zone_name=...&zone_type=...&date_from=...&date_to=...
This request returns the following information
Name Type Description
bandwidth json Json with this structure {timestamp: bandiwdth} (in Mbps).
This request returns one of the following messages
Status Type Description
200 json data
400 json Invalid date_from or date_to parameters.
401 json Input parameter problem - invalid token.
404 json Zone with given name does not exists.
532 json Fail message
This request expects the following parameters
Name Type Validation Default Description
zone_name string Existing zone name Name of the existing zone.
zone_type string Valid types: ['objects', 'livestream']. Required when zone_name parameter is given. Type of the given zone.
date_from string GMT date in format YYYY-MM-DD or a Unix timestamp. The interval between date_from and date_to should be no more than 1 year. 24 hours ago From which date to generate the bandwidth. Inclusive.
date_to string GMT date in format YYYY-MM-DD or a Unix timestamp. Date_to parameter should be no more than 2 month from now. Now To which date to generate the bandwidth. Exclusive.




Examples

curl -X GET 'https://api.ucdn.com/v4/reports/get_bandwidth?date_from=1711539900&date_to=1711549800&zone_name=test_livestream&zone_type=livestream&token=acf0230d03f5b71d7252e336106f7338'
{
   "1394571600": 19.29,
   "1394571900": 9.29,
   "1394572200": 7.00,
   "1394572500": 11.35,
   "1394572800": 17.65,
   "1394573100": 18.21,
   "1394573400": 11.14,
   "1394573700": 13.32,
   "1394574000": 19.84
}

Bandwidth 95th percentile

Returns 95th percentile of the bandwidth in Mbps for particular zone or this account as a whole when `zone_name` is omitted.
GET https://api.ucdn.com/v4/reports/get_bandwidth_95th?year=...&month=...&region=...
This request returns the following information
Name Type Description
elements json Json with this structure {date: {region: 95th_percentile_bandwidth}} (in Mbps).
This request returns one of the following messages
Status Type Description
200 json data
400 json Invalid region, invalid year or month parameters.
401 json Input parameter problem - invalid token.
532 json Fail message
This request expects the following parameters
Name Type Validation Default Description
year int required Positive year. For which year to generate the bandwidth. Inclusive.
month int Positive month between 1-12. Whole year. For which month to generate the bandwidth. Exclusive.
region string Valid regions: europe, united-states, asia, asia-pacific, asia-west. All regions. For which region to generate the bandwidth. Exclusive.




Examples

curl -X GET 'https://api.ucdn.com/v4/reports/get_bandwidth_95th?year=2024&month=01&token=acf0230d03f5b71d7252e336106f7338'
{
    "2024-01": {
        "Asia-Pacific": "16.44",
        "Asia": "15.94",
        "United States": "8.39",
        "Europe": "12.47"
    }
}

Bytes served via SSL

Returns stats with bytes served. The data is for particular time period and grouped in time intervals.
GET https://api.ucdn.com/v4/reports/bytes/ssl?from=...&to=...&zones=...&zones_type=...&by=...
This request returns the following information
Name Type Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for information on what it is made of.
element_duration int Lenght of tht time interval for each element. In seconds.
element_description array Every element in `elements` is an array of values. This fields says what does each value in an element mean.
This request returns one of the following messages
Status Type Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
from string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 24 hours ago From which date to generate the reports
to string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 now To which date to generate the reports
zones string A zone name or a list of zone names separated with comma. Example: test-zone,test-zone-1. Required when zones_type parameter is given. All zones for this account Names of the existing zone. This way a report for a particular zone or group of zones can be made.
zones_type string Valid types: ['objects', 'livestream']. Required when zones parameter is given. Type of the given zone.
by string One of to following: 5min, hour, day day Group the reported elements in slots with particular time length.




Examples

curl -X GET 'https://api.ucdn.com/v4/reports/bytes/ssl?from=2021-01-03&to=2024-01-03&zones_type=objects&zones=test-zone&token=acf0230d03f5b71d7252e336106f7338'
{
    "element_description": [
        "unix timestamp of the time slot start",
        "bytes served in this time slot"
    ],
    "element_duration": 3600,
    "elements": [
        [
            1609632000,
            0
        ],
        [
            1609635600,
            0
        ],
        [
            1609639200,
            0
        ],
        [
            1609642800,
            0
        ],
        [
            1609646400,
            0
        ],
        [
            1609650000,
            0
        ],
        [
            1609653600,
            0
        ],
        [
            1609657200,
            0
        ],
        [
            1609660800,
            0
        ],
        [
            1609664400,
            0
        ],
        [
            1609668000,
            0
        ],
        [
            1609671600,
            0
        ],
        [
            1609675200,
            0
        ],
        [
            1609678800,
            0
        ]
    ]
}

Hits SSL

Returns total number of hits. The data is for particular time period and grouped in time intervals.
GET https://api.ucdn.com/v4/reports/hits/ssl?from=...&to=...&zones=...&zones_type=...&by=...
This request returns the following information
Name Type Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for information on what it is made of.
element_duration int Lenght of tht time interval for each element. In seconds.
element_description array Every element in `elements` is an array of values. This fields says what does each value in an element mean.
This request returns one of the following messages
Status Type Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
from string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 24 hours ago From which date to generate the reports
to string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 now To which date to generate the reports
by string One of to following: 5min, hour, day day Group the reported elements in slots with particular time length.
zones string A zone name or a list of zone names separated with comma. Example: test-zone,test-zone-1. Required when zones_type parameter is given. All zones for this account Names of the existing zone. This way a report for a particular zone or group of zones can be made.
zones_type string Valid types: ['objects', 'livestream']. Required when zones parameter is given. Type of the given zone.




Examples

curl -X GET 'https://api.ucdn.com/v4/reports/hits/ssl?from=2021-01-03&to=2024-01-03&zones_type=objects&zones=test-zone&token=acf0230d03f5b71d7252e336106f7338'
{
    "element_description": [
        "unix timestamp of the time slot start",
        "bytes served in this time slot"
    ],
    "element_duration": 3600,
    "elements": [
        [
            1609632000,
            0
        ],
        [
            1609635600,
            0
        ],
        [
            1609639200,
            0
        ],
        [
            1609642800,
            0
        ],
        [
            1609646400,
            0
        ],
        [
            1609650000,
            0
        ],
        [
            1609653600,
            0
        ],
        [
            1609657200,
            0
        ],
        [
            1609660800,
            0
        ],
        [
            1609664400,
            0
        ],
        [
            1609668000,
            0
        ],
        [
            1609671600,
            0
        ],
        [
            1609675200,
            0
        ],
        [
            1609678800,
            0
        ]
    ]
}

Bytes served

Returns stats with bytes served. The data is for a particular time period and grouped in time intervals.
GET https://api.ucdn.com/v4/reports/bytes?from=...&to=...&zones=...&zones_type=...&by=...
This request returns the following information
Name Type Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for information on what it is made of.
element_duration int Lenght of tht time interval for each element. In seconds.
element_description array Every element in `elements` is an array of values. This fields says what does each value in an element mean.
This request returns one of the following messages
Status Type Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
from string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 24 hours ago From which date to generate the reports
to string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 now To which date to generate the reports
by string One of to following: 5min, hour, day day Group the reported elements in slots with particular time length.
zones string A zone names or a list of zone names separated with comma. Example: test-zone,test-zone-1. Required when zones_type parameter is given. All zones for this account Names of the existing zone. This way a report for a particular zone or group of zones can be made.
zones_type string Valid types: ['objects',livestream]. Required when zones parameter is given. Type of the given zone.




Examples

curl -X GET "https://api.ucdn.com/v4/reports/bytes/?from=2015-08-12&to=2015-08-13&token=acf0230d03f5b71d7252e336106f7338&zones=test-zone,test-zone-1"
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2015 13:21:35 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 602
Content-Type: application/json; charset=utf-8

{
    "element_description": [
        "unix timestamp of the time slot start",
        "bytes served in this time slot"
    ],
    "element_duration": 3600,
    "elements": [
        [
            1439337600,
            0
        ],
        [
            1439341200,
            105885510745
        ],
        [
            1439344800,
            114271292947
        ],
        [
            1439348400,
            124036006918
        ],
        [
            1439352000,
            120396189741
        ],
        [
            1439355600,
            101645584874
        ],
        [
            1439359200,
            80206732783
        ],
        [
            1439362800,
            69543285192
        ],
        [
            1439366400,
            68522904965
        ],
        [
            1439370000,
            73195626735
        ],
        [
            1439373600,
            67897186868
        ],
        [
            1439377200,
            0
        ],
        [
            1439380800,
            0
        ],
        [
            1439384400,
            0
        ],
        [
            1439388000,
            0
        ],
        [
            1439391600,
            0
        ],
        [
            1439395200,
            0
        ],
        [
            1439398800,
            0
        ],
        [
            1439402400,
            0
        ],
        [
            1439406000,
            0
        ],
        [
            1439409600,
            0
        ],
        [
            1439413200,
            0
        ],
        [
            1439416800,
            0
        ],
        [
            1439420400,
            0
        ]
    ]
}

Countries

Statistics for the traffic destination by country. It shows hits and bytes served to this country.
GET https://api.ucdn.com/v4/reports/countries?from=...&to=...&zones=...&zones_type=...&countries=...
This request returns the following information
Name Type Description
elements object A key-value pairs. The key in the pair is a ISO 3166-1 country code. The value of an array with the generated data. Every element in the array represents a time slot. See the `element_description` field for information on what it is made of.
element_duration int Lenght of tht time interval for each element. In seconds.
element_description array Every element in `elements` is an array of values. This fields says what does each value in an element mean.
This request returns one of the following messages
Status Type Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
from string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 24 hours ago From which date to generate the reports
to string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 now To which date to generate the reports
countries string Comma separated list of countries. Every country must be represented by a ISO 3166-1 country code. Examples: 'bg,vn,ru' All countries. List of countries for which to show statistics.
zones string A zone name or a list of zone names separated with comma. Example: test-zone,test-zone-1. Required when zones_type parameter is given. All zones for this account Names of the existing zone. This way a report for a particular zone or group of zones can be made.
zones_type string Valid types: ['objects', 'livestream']. Required when zones parameter is given. Type of the given zone.




Examples

curl -X GET "https://api.ucdn.com/v4/reports/countries?from=2021-01-03&to=2024-01-03&zones_type=objects&zones=test-zone&token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2015 11:04:50 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 4406
Content-Type: application/json; charset=utf-8

{
    "element_description": [
        "unix timestamp of the time slot start",
        "hits from this country",
        "bytes served to this country"
    ],
    "element_duration": 86400,
    "elements": {
        "CH": [
            [
                1439290800,
                0,
                0
            ],
            [
                1439294400,
                384465,
                19224985
            ],
            [
                1439298000,
                373860,
                18694275
            ],
            [
                1439301600,
                367775,
                18390470
            ]
        ],
        "GB": [
            [
                1439290800,
                0,
                0
            ],
            [
                1439294400,
                427190,
                21361100
            ],
            [
                1439298000,
                415390,
                20771405
            ],
            [
                1439301600,
                408645,
                20433865
            ],
            [
                1439305200,
                407865,
                20394660
            ],
            [
                1439308800,
                415540,
                20778725
            ],
            [
                1439312400,
                439510,
                21977240
            ],
            [
                1439316000,
                476520,
                23827165
            ],
            [
                1439319600,
                515800,
                25791430
            ],
            [
                1439323200,
                531010,
                26551560
            ]
        ],
        "MX": [
            [
                1439290800,
                0,
                0
            ],
            [
                1439294400,
                261435,
                13072990
            ],
            [
                1439298000,
                254210,
                12712090
            ],
            [
                1439301600,
                250090,
                12505515
            ]
        ],
        "RU": [
            [
                1439290800,
                0,
                0
            ]
        ],
        "US": [
            [
                1439290800,
                0,
                0
            ],
            [
                1439294400,
                449685,
                22485365
            ],
            [
                1439298000,
                437260,
                21864645
            ],
            [
                1439301600,
                430150,
                21509335
            ],
            [
                1439305200,
                429335,
                21468070
            ]
        ],
        "VN": [
            [
                1439290800,
                0,
                0
            ],
            [
                1439294400,
                196060,
                9804735
            ],
            [
                1439298000,
                190655,
                9534070
            ],
            [
                1439301600,
                187550,
                9379120
            ],
            [
                1439305200,
                187185,
                9361135
            ]
        ]
    }
}

Storages

Returns the used UCDN storage in bytes.
GET https://api.ucdn.com/v4/reports/storages?from=...&to=...&by=...
This request returns the following information
Name Type Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for information on what it is made of.
element_duration int Lenght of tht time interval for each element. In seconds.
element_description array Every element in `elements` is an array of values. This fields says what does each value in an element mean.
This request returns one of the following messages
Status Type Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
from string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 24 hours ago From which date to generate the reports
to string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 now To which date to generate the reports
by string Only one possible value is supported for now: hour hour Group the reported elements in slots with particular time length.




Examples

curl -X GET "https://api.ucdn.com/v4/reports/storages/?from=2015-08-12&to=2015-08-13&by=hour&token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2015 11:04:52 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 698
Content-Type: application/json; charset=utf-8

{
    "element_description": [
        "unix timestamp of the time slot start",
        "used size in bytes"
    ],
    "element_duration": 3600,
    "elements": [
        [
            1439290800,
            0
        ],
        [
            1439294400,
            2887995255
        ],
        [
            1439298000,
            2887995255
        ],
        [
            1439301600,
            2887995255
        ],
        [
            1439305200,
            2887995255
        ],
        [
            1439308800,
            2887995255
        ],
        [
            1439312400,
            2887995255
        ],
        [
            1439316000,
            2887995255
        ],
        [
            1439319600,
            2887995255
        ],
        [
            1439323200,
            2887995255
        ],
        [
            1439326800,
            2887995255
        ],
        [
            1439330400,
            2887995255
        ],
        [
            1439334000,
            2887995255
        ],
        [
            1439337600,
            2887995255
        ],
        [
            1439341200,
            2887995255
        ],
        [
            1439344800,
            2887995255
        ],
        [
            1439348400,
            2887995255
        ],
        [
            1439352000,
            2887995255
        ],
        [
            1439355600,
            2887995255
        ],
        [
            1439359200,
            2887995255
        ],
        [
            1439362800,
            2887995255
        ],
        [
            1439366400,
            2887995255
        ],
        [
            1439370000,
            2887995255
        ],
        [
            1439373600,
            0
        ],
        [
            1439377200,
            0
        ]
    ]
}

Status codes

Statistics for HTTP status codes.
GET https://api.ucdn.com/v4/reports/status/codes?from=...&to=...&zones=...&zones_type=...&by=...&code=...
This request returns the following information
Name Type Description
elements object A key-value pairs. The key in the pair is a HTTP status code. The value of an array with the generated data. Every element in the array represents a time slot. See the `element_description` field for information on what it is made of.
element_duration int Lenght of tht time interval for each element. In seconds.
element_description array Every element in `elements` is an array of values. This fields says what does each value in an element mean.
This request returns one of the following messages
Status Type Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
from string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 24 hours ago From which date to generate the reports
to string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 now To which date to generate the reports
by string One of to following: 5min, hour, day day Group the reported elements in slots with particular time length.
code string Integer. Represents a HTTP status code between 100 and 599. All status codes. Show staistics for particular HTTP status code.
zones string A zone name or a list of zone names separated with comma. Example: test-zone,test-zone-1. Required when zones_type parameter is given. All zones for this account Names of the existing zone. This way a report for a particular zone or group of zones can be made.
zones_type string Valid types: ['objects', 'livestream']. Required when zones parameter is given. Type of the given zone.




Examples

curl -X GET "https://api.ucdn.com/v4/reports/status/codes/?from=2015-08-12&to=2015-08-13&token=acf0230d03f5b71d7252e336106f7338&code=404"
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2015 13:21:34 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 643
Content-Type: application/json; charset=utf-8

{
    "element_description": [
        "unix timestamp of the time slot start",
        "hits",
        "percents of all"
    ],
    "element_duration": 3600,
    "elements": {
        "404": [
            [
                1439337600,
                0,
                0
            ],
            [
                1439341200,
                181058,
                0
            ],
            [
                1439344800,
                195398,
                0
            ],
            [
                1439348400,
                212096,
                0
            ],
            [
                1439352000,
                205871,
                0
            ],
            [
                1439355600,
                173808,
                0
            ],
            [
                1439359200,
                137148,
                0
            ],
            [
                1439362800,
                118913,
                0
            ],
            [
                1439366400,
                117169,
                0
            ],
            [
                1439370000,
                125157,
                0
            ],
            [
                1439373600,
                116099,
                0
            ],
            [
                1439377200,
                0,
                0
            ],
            [
                1439380800,
                0,
                0
            ],
            [
                1439384400,
                0,
                0
            ],
            [
                1439388000,
                0,
                0
            ],
            [
                1439391600,
                0,
                0
            ],
            [
                1439395200,
                0,
                0
            ],
            [
                1439398800,
                0,
                0
            ],
            [
                1439402400,
                0,
                0
            ],
            [
                1439406000,
                0,
                0
            ],
            [
                1439409600,
                0,
                0
            ],
            [
                1439413200,
                0,
                0
            ],
            [
                1439416800,
                0,
                0
            ],
            [
                1439420400,
                0,
                0
            ]
        ]
    }
}

Hits

Returns statistics with the number of HTTP hits
GET https://api.ucdn.com/v4/reports/hits?from=...&to=...&zones=...&zones_type=...&by=...
This request returns the following information
Name Type Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for information on what it is made of.
element_duration int Lenght of tht time interval for each element. In seconds.
element_description array Every element in `elements` is an array of values. This fields says what does each value in an element mean.
This request returns one of the following messages
Status Type Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
from string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 24 hours ago From which date to generate the reports
to string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 now To which date to generate the reports
by string One of to following: 5min, hour, day day Group the reported elements in slots with particular time length.
zones string A zone name or a list of zone names separated with comma. Example: test-zone,test-zone-1. Required when zones_type parameter is given. All zones for this account Names of the existing zone. This way a report for a particular zone or group of zones can be made.
zones_type string Valid types: ['objects', 'livestream']. Required when zones parameter is given. Type of the given zone.




Examples

curl -X GET "https://api.ucdn.com/v4/reports/hits?from=2021-01-03&to=2024-01-03&zones_type=objects&zones=test-zone&token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2015 11:04:50 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 602
Content-Type: application/json; charset=utf-8

{
    "element_description": [
        "unix timestamp of the time slot start",
        "hits"
    ],
    "element_duration": 3600,
    "elements": [
        [
            1439290800,
            0
        ],
        [
            1439294400,
            739857
        ],
        [
            1439298000,
            719431
        ],
        [
            1439301600,
            707736
        ],
        [
            1439305200,
            706384
        ],
        [
            1439308800,
            719685
        ],
        [
            1439312400,
            761199
        ],
        [
            1439316000,
            825275
        ],
        [
            1439319600,
            893314
        ],
        [
            1439323200,
            919642
        ],
        [
            1439326800,
            984416
        ],
        [
            1439330400,
            962014
        ],
        [
            1439334000,
            919178
        ],
        [
            1439337600,
            873281
        ],
        [
            1439341200,
            871015
        ],
        [
            1439344800,
            939998
        ],
        [
            1439348400,
            1020329
        ],
        [
            1439352000,
            990386
        ],
        [
            1439355600,
            836136
        ],
        [
            1439359200,
            659778
        ],
        [
            1439362800,
            572053
        ],
        [
            1439366400,
            563661
        ],
        [
            1439370000,
            602095
        ],
        [
            1439373600,
            558520
        ],
        [
            1439377200,
            0
        ]
    ]
}

Hits via HTTP2

Returns total number of hits. The data is for particular time period and grouped in time intervals.
GET https://api.ucdn.com/v4/reports/hits/http2?from=...&to=...&zones=...&zones_type=...&by=...
This request returns the following information
Name Type Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for information on what it is made of.
element_duration int Lenght of tht time interval for each element. In seconds.
element_description array Every element in `elements` is an array of values. This fields says what does each value in an element mean.
This request returns one of the following messages
Status Type Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
from string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 24 hours ago From which date to generate the reports
to string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 now To which date to generate the reports
by string One of to following: 5min, hour, day day Group the reported elements in slots with particular time length.
zones string A zone name or a list of zone names separated with comma. Example: test-zone,test-zone-1. Required when zones_type parameter is given. All zones for this account Names of the existing zone. This way a report for a particular zone or group of zones can be made.
zone_type string Type of the given zone.
zones_type Valid types: ['objects', 'livestream']. Required when zones parameter is given.




Examples

curl -X GET 'https://api.ucdn.com/v4/reports/hits/http2?from=2021-01-03&to=2024-01-03&zones_type=objects&zones=test-zone&token=acf0230d03f5b71d7252e336106f7338'
{
    "element_description": [
        "unix timestamp of the time slot start",
        "bytes served in this time slot"
    ],
    "element_duration": 3600,
    "elements": [
        [
            1609632000,
            0
        ],
        [
            1609635600,
            0
        ],
        [
            1609639200,
            0
        ],
        [
            1609642800,
            0
        ],
        [
            1609646400,
            0
        ],
        [
            1609650000,
            0
        ],
        [
            1609653600,
            0
        ],
        [
            1609657200,
            0
        ],
        [
            1609660800,
            0
        ],
        [
            1609664400,
            0
        ],
        [
            1609668000,
            0
        ],
        [
            1609671600,
            0
        ],
        [
            1609675200,
            0
        ],
        [
            1609678800,
            0
        ]
    ]
}

Bytes served via HTTP2

Returns stats with bytes served. The data is for particular time period and grouped in time intervals.
GET https://api.ucdn.com/v4/reports/bytes/http2?from=...&to=...&zones=...&zones_type=...&by=...
This request returns the following information
Name Type Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for information on what it is made of.
element_duration int Lenght of tht time interval for each element. In seconds.
element_description array Every element in `elements` is an array of values. This fields says what does each value in an element mean.
This request returns one of the following messages
Status Type Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
from string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 24 hours ago From which date to generate the reports
to string Valid formats are: YYYY-MM-DD HH:mm with optional timezone parameter or a Unix timestamp. Examples: 2014-03-12 15:32 GMT+3, 1394571600 now To which date to generate the reports
zones string A zone name or a list of zone names separated with comma. Example: test-zone,test-zone-1. Required when zones_type parameter is given. All zones for this account Filter output for user zones. This way a report for particular zone or a group of zones can be made.
zones_type string Valid types: ['objects', 'livestream']. Required when zones parameter is given. Type of the given zone.
by string One of to following: 5min, hour, day day Group the reported elements in slots with particular time length.




Examples

curl -k -X GET 'https://api.ucdn.com/v4/reports/bytes/http2?from=2021-01-03&to=2024-01-03&zones_type=objects&zones=test-zone&token=acf0230d03f5b71d7252e336106f7338'
{
    "element_description": [
        "unix timestamp of the time slot start",
        "bytes served in this time slot"
    ],
    "element_duration": 3600,
    "elements": [
        [
            1609632000,
            0
        ],
        [
            1609635600,
            0
        ],
        [
            1609639200,
            0
        ],
        [
            1609642800,
            0
        ],
        [
            1609646400,
            0
        ],
        [
            1609650000,
            0
        ],
        [
            1609653600,
            0
        ],
        [
            1609657200,
            0
        ],
        [
            1609660800,
            0
        ],
        [
            1609664400,
            0
        ],
        [
            1609668000,
            0
        ],
        [
            1609671600,
            0
        ],
        [
            1609675200,
            0
        ],
        [
            1609678800,
            0
        ]
    ]
}

Purge files

Removes files from a cache zone. This call will create a purge job which will be executed automatically.
POST https://api.ucdn.com/v4/purge/zone?zone_name=...&zone_type=.../
This request returns the following information
Name Type Description
job_id string The ID of the newly created purge job
This request returns one of the following messages
Status Type Description
204 json Success message
532 json Fail message
This request expects the following parameters
Name Type Validation Default Description
zone_name required string Existing zone name. Required when zone_type parameter is given. Name of the existing zone.
zone_type required string Valid types: ['objects', 'livestream']. Required when zone_name parameter is given. Type of the given zone.
files string You can use either http://example.com/dir/file.txt or /dir/file.txt A list of files separated by a new line




Examples

curl --include --request POST "https://api.ucdn.com/v4/purge/zone?zone_name=test-zone&zone_type=objects&token=acf0230d03f5b71d7252e336106f7338" --header "Content-Type: application/json" -d '{"files":"/example/logo.png\n/second/file"}'
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2015 13:21:34 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 80
Content-Type: application/json; charset=utf-8

{
    "message": "Purge request received",
    "job_id": "3cfb478531097f1830056a828752cbdd"
}

View purge job

Returns information for a particular purge job.
GET https://api.ucdn.com/v4/purge/job/{job_id}/
This request returns the following information
Name Type Description
job_id string The ID of this purge job
files array List of a file which make up this purge job
status string The status of this purge job. It can be "waiting", "running", "finished" or "failed"
created_at int The time this job was created in Unix timestamp
This request returns one of the following messages
Status Type Description
200 string Success message
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
job_id string - A purge job id as returned by the job creation call




Examples

curl --include "https://api.ucdn.com/v4/purge/job/2170dd23decc45691adf28987282d0bc/?token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2015 13:21:33 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 210
Content-Type: application/json; charset=utf-8

{
    "job_id": "2170dd23decc45691adf28987282d0bc",
    "files": [
        "http:\/\/a1-121.so.clients.cdn13.com\/example\/logo.png",
        "http:\/\/a1-121.so.clients.cdn13.com\/second\/file"
    ],
    "status": "finished",
    "created_at": 1435318980
}

List purge jobs

Returns an array with the latest purge jobs.
GET https://api.ucdn.com/v4/purge?status=...&count=...
This request returns one of the following messages
Status Type Description
200 array Array with purge jobs
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
status required string Supported values are "waiting", "running", "finished" and "failed" Will show "waiting", "running" and "failed" purge jobs only Return only purge jobs which are in this status.
count integer Positive integer less or equal to 500 20 How many purge jobs to return




Examples

curl --include "https://api.ucdn.com/v4/purge/?status=finished&token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2015 13:21:33 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 1900
Content-Type: application/json; charset=utf-8

[
    {
        "job_id": "ed74f89ab1469b4942fa6fee32832c31",
        "files": [
            "http:\/\/a1-121.so.clients.cdn13.com\/example\/logo.png",
            "http:\/\/a1-121.so.clients.cdn13.com\/second\/file"
        ],
        "status": "finished",
        "created_at": 1439377493
    },
    {
        "job_id": "58432bcd7c38551ab1c3552315962a39",
        "files": [
            "http:\/\/a1-121.so.clients.cdn13.com\/example\/logo.png",
            "http:\/\/a1-121.so.clients.cdn13.com\/second\/file"
        ],
        "status": "finished",
        "created_at": 1435565013
    },
    {
        "job_id": "ae2f114aa4ee1940fe960a2dca2d2d4d",
        "files": [
            "http:\/\/a1-121.so.clients.cdn13.com\/example\/logo.png",
            "http:\/\/a1-121.so.clients.cdn13.com\/second\/file"
        ],
        "status": "finished",
        "created_at": 1435564159
    },
    {
        "job_id": "e2a311eaaf6408621c6ba10d37b0a17f",
        "files": [
            "http:\/\/a1-121.so.clients.cdn13.com\/example\/logo.png",
            "http:\/\/a1-121.so.clients.cdn13.com\/second\/file"
        ],
        "status": "finished",
        "created_at": 1435564105
    },
    {
        "job_id": "2170dd23decc45691adf28987282d0bc",
        "files": [
            "http:\/\/a1-121.so.clients.cdn13.com\/example\/logo.png",
            "http:\/\/a1-121.so.clients.cdn13.com\/second\/file"
        ],
        "status": "finished",
        "created_at": 1435318980
    },
    {
        "job_id": "cd704ed605964e55a2a3c64162f94b05",
        "files": [
            "http:\/\/a1-121.so.clients.cdn13.com\/example\/logo.png",
            "http:\/\/a1-121.so.clients.cdn13.com\/second\/file"
        ],
        "status": "finished",
        "created_at": 1435317428
    },
    {
        "job_id": "a301e0571b0402a5fca1b6271612612b",
        "files": [
            "http:\/\/a1-121.so.clients.cdn13.com\/example\/logo.png",
            "http:\/\/a1-121.so.clients.cdn13.com\/second\/file"
        ],
        "status": "finished",
        "created_at": 1435317395
    },
    {
        "job_id": "9dfb57172bbbdc33abeb66862bb995d4",
        "files": [
            "http:\/\/a1-121.so.clients.cdn13.com\/example\/logo.png",
            "http:\/\/a1-121.so.clients.cdn13.com\/second\/file"
        ],
        "status": "finished",
        "created_at": 1435317350
    },
    {
        "job_id": "72709f187f5b5759d1db5055ac3c1340",
        "files": [
            "http:\/\/a1-121.so.clients.cdn13.com\/example\/logo.png",
            "http:\/\/a1-121.so.clients.cdn13.com\/second\/file"
        ],
        "status": "finished",
        "created_at": 1435317296
    }
]

Delete a purge job

Removes a purge job. Note that only purge jobs which are waiting or finished can be deleted.
DELETE https://api.ucdn.com/v4/purge/job/{job_id}
This request returns one of the following messages
Status Type Description
200 string Success message
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
job_id string - A purge job id as returned by the job creation call




Examples

curl --include --request DELETE "https://api.ucdn.com/v4/purge/job/cd704ed605964e55a2a3c64162f94b05/?token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2015 13:21:40 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 39
Content-Type: application/json; charset=utf-8

{
    "message": "The purge job was removed"
}

Create storage

Creates a new UCDN storage and returns its ID on success. The storage will be ready for uploading files and general use but still not attached to any cache zone. See zone creation and reconfiguration API calls for details on how to use a particular UCDN storage.
POST https://api.ucdn.com/v4/storage
This request returns the following information
Name Type Description
id int The id of the created storage
status string Operation success message
This request returns one of the following messages
Status Type Description
200 json Message for successful creation
532 json Error message
504 json Storage backend failed
This request expects the following parameters
Name Type Validation Default Description
name string required At least 3 characters long identifier. Name wihch will be used for the swift container.
region string required "europe" or "north-america". The geographical region of this container.




Examples

curl -X POST "https://api.ucdn.com/v4/storage/?token=acf0230d03f5b71d7252e336106f7338" --header "Content-Type: application/json" -d '{"region":"north-america", "name": "level-4-logs"}'
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:10:29 GMT
Server: Apache
X-Powered-By: PHP/5.6.8-pl0-gentoo
Vary: Accept-Encoding
Content-Length: 36
Content-Type: application/json; charset=utf-8

{
    "message": "Storage Created",
    "id": 3
}

List storages

Returns a list with all of your UCDN storages. For every storage in the list there is a object with information for it.
GET https://api.ucdn.com/v4/storages
This request returns the following information
Name Type Description
id int The identificator of this storage instance
container string The name of this storage
ftp_host string FTP host for this storage
ftp_user string FTP user for this storage
ftp_password string FTP password for this storage
region string The geo region this storage is in
synchronized_with_storage string Id of a storage which is synchronized with this one (if there is one).
This request returns one of the following messages
Status Type Description
200 array Array with information for all storages
532 json Error message

Examples

curl -X GET "https://api.ucdn.com/v4/storages/?token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:03:11 GMT
Server: Apache
X-Powered-By: PHP/5.3.10-1ubuntu3.16
X-Cache: miss
Vary: Accept-Encoding
Content-Length: 388
Content-Type: application/json; charset=utf-8

[
    {
        "id": 2,
        "container": "despensable",
        "ftp_host": "europe.upload.cdn13.com",
        "ftp_user": "1000121.1000121",
        "ftp_password": "ftppassword",
        "region": "europe",
        "synchronized_with_storage": null
    },
    {
        "id": 1,
        "container": "level-3-logs",
        "ftp_host": "north-america.upload.cdn13.com",
        "ftp_user": "1000121.1000121",
        "ftp_password": "ftppassword",
        "region": "north-america",
        "synchronized_with_storage": null
    }
]

Reconfigure storages

This API call makes possible changing the settings for all storages in particular region. Different values of the `action` parameter mean different operations to be performed.
PATCH https://api.ucdn.com/v4/storages
This request returns the following information
Name Type Description
new_ftp_password string The new FTP password which must be used with storages in the patched region. Will be returned only if the `action` request parameter is "change_ftp_password".
message string Success message
This request returns one of the following messages
Status Type Description
200 object Relevant information for the successful `action`
400 string Something wrong with the request
409 string Insufficient parameters
504 string Storage backend errors
532 string Fail message
This request expects the following parameters
Name Type Validation Default Description
region string required "europe" or "north-america". The region in which storages will be patched.
action string required Only "change_ftp_password" is supported for now. With it, all storages in the region will have their FTP passwords changed. Tells what will this reconfiguration do.




Examples

curl -X PATCH "https://api.ucdn.com/v4/storages/?token=acf0230d03f5b71d7252e336106f7338" --header "Content-Type: application/json" -d '{"action":"change_ftp_password", "region": "north-america"}'
HTTP/1.1 200 OK
Date: Tue, 24 Nov 2015 11:03:39 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.14
Content-Length: 41
Content-Type: application/json; charset=utf-8

{
    "new_ftp_password": "dd9028f5f3ed79408e"
}

Storage FTP

Returns information for a particular UCDN storage.
GET https://api.ucdn.com/v4/storage/{id}
This request returns the following information
Name Type Description
id int The identificator of this storage instance
container string The name of this storage
ftp_host string FTP host for this storage
ftp_user string FTP user for this storage
ftp_password string FTP password for this storage
region string The geo region this storage is in
synchronized_with_storage string Id of a storage which is synchronized with this one (if there is one).
This request returns one of the following messages
Status Type Description
200 json Information for this storage
404 json No active storage found message
532 json Error message

Examples

curl -X GET "https://api.ucdn.com/v4/storage/1/?token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:03:12 GMT
Server: Apache
X-Powered-By: PHP/5.6.8-pl0-gentoo
X-Cache: hit
Vary: Accept-Encoding
Content-Length: 200
Content-Type: application/json; charset=utf-8

{
    "id": 1,
    "container": "level-3-logs",
    "ftp_host": "north-america.upload.cdn13.com",
    "ftp_user": "1000121.1000121",
    "ftp_password": "ftppassword",
    "region": "north-america",
    "synchronized_with_storage": null
}

Storage consumed size

Returns utilization information for this storage. How big is it and how many objects are there.
GET https://api.ucdn.com/v4/storage/{id}/size
This request returns the following information
Name Type Description
bytes int Number of bytes consumed on this storage
objects int Number of files and folders on this storage
This request returns one of the following messages
Status Type Description
200 json Consumed size
404 json No active storage found message
532 json Error message

Examples

curl -X GET "https://api.ucdn.com/v4/storage/1/size/?token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:03:11 GMT
Server: Apache
X-Powered-By: PHP/5.3.10-1ubuntu3.16
X-Cache: miss
Vary: Accept-Encoding
Content-Length: 23
Content-Type: application/json; charset=utf-8

{
    "bytes": 0,
    "objects": 0
}

Remove storage

Removes a UCDN storage. To remove a storage there are few preconditions: it must be empty and there must be no cache zone using it as its origin.
DELETE https://api.ucdn.com/v4/storage/{id}
This request returns one of the following messages
Status Type Description
200 json Message for successful deletion
404 json No active storage found message
532 json Error message
504 json Storage backend failed

Examples

curl -X DELETE "https://api.ucdn.com/v4/storage/2/?token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:10:35 GMT
Server: Apache
X-Powered-By: PHP/5.6.8-pl0-gentoo
Vary: Accept-Encoding
Content-Length: 33
Content-Type: application/json; charset=utf-8

{
    "message": "Storage was deleted"
}

Check user credentials

Checks if an email and password pair belong to a valid user and returns its ID if they do. By saying "email" we actually mean "username or email". Both will work for logging in.
POST https://api.ucdn.com/v4/check/login/
This request returns the following information
Name Type Description
authenticated bool True if the credentials are valid or false otherwise
user_id int The user ID of the user for which the credentials matched. Only present in successful logins.
reason string Huaman readable sentence explaining the result from this call
token string The token for this user needed for authenticating against the Public API. Only present in successful logins.
This request returns one of the following messages
Status Type Description
200 string Message
401 string Invalid login credentials
532 string An error message
This request expects the following parameters
Name Type Validation Default Description
email string required The email with which this user has been registered Email supplied by the user
password string required The password for this user Password supplied by the user




Examples

curl -X POST "https://api.ucdn.com/v4/check/login/" --header "Content-Type: application/json" -d '{"email":"major@section9.co.jp", "password": "password"}'
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:03:16 GMT
Server: Apache
X-Powered-By: PHP/5.6.8-pl0-gentoo
Vary: Accept-Encoding
Content-Length: 118
Content-Type: application/json; charset=utf-8

{
    "authenticated": true,
    "user_id": 121,
    "reason": "Login credentials are valid",
    "token": "acf0230d03f5b71d7252e336106f7338"
}

Fetch account info

Returns information for your current account.
GET https://api.ucdn.com/v4/account
This request returns the following information
Name Type Description
id int Your unique user ID
username string Your username
name string Your name
email string This account contact email
timezone string Timezone for the Control Panel reports
trial int Whether this account is part of the UCDN Free trial program
This request returns one of the following messages
Status Type Description
200 object Account Information

Examples

curl -X GET "https://api.ucdn.com/v4/account/?token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:03:08 GMT
Server: Apache
X-Powered-By: PHP/5.3.10-1ubuntu3.16
X-Cache: miss
Vary: Accept-Encoding
Content-Length: 127
Content-Type: application/json; charset=utf-8

{
    "id": "121",
    "username": "kusanagi",
    "email": "major@section9.co.jp",
    "name": "Motoko Kusanagi",
    "timezone": "Asia\/Tokyo",
    "trial": "0"
}

Fetch subaccounts list

Returns all accounts with the same parent id as for your current account.
GET https://api.ucdn.com/v4/subaccounts
This request returns one of the following messages
Status Type Description
200 object Account Information

Examples

curl -X GET "https://api.ucdn.com/v4/subaccounts/?token=acf0230d03f5b71d7252e336106f7338"
{
      "address" : null,
      "api_key" : "acf0230d03f5b71d7252e336106f7338",
      "api_secret" : "e2425f9c4df5614821009bce90cc384a",
      "billing_currency" : "USD",
      "billing_methodology" : "bandwidth",
      "bonus_balance" : "0.00000000",
      "cache_objects" : "873813",
      "cache_quota" : "0",
      "can_be_suspend" : "1",
      "check_origin" : "1",
      "city" : null,
      "company_name" : null,
      "company_type" : "corporate",
      "confirmed_mail" : "1",
      "country" : null,
      "create_ts" : "1708416831",
      "delete_ts" : "0",
      "domain_base" : "cdn13.com",
      "email" : "test_email@gmail.com",
      "expiration_2fa" : null,
      "first_name" : null,
      "id" : "13956",
      "l2_cache_objects" : "500000",
      "l2_cache_objects_small" : "1000000",
      "l2_cache_quota" : "0",
      "l2_cache_quota_small" : "0",
      "l3_cache_objects" : "1000000",
      "l3_cache_objects_small" : "2000000",
      "l3_cache_quota" : "0",
      "l3_cache_quota_small" : "0",
      "last_name" : null,
      "last_updated" : "2024-02-20 08:13:51",
      "manager_id" : "0",
      "max_zones" : "512",
      "name" : "test123",
      "notes" : null,
      "origin_quota" : "0",
      "parent_id" : "13863",
      "password" : "$2y$11$y6NtNjdaeTKKx.SGAPbjm.qhECzOI5KVNcaCDxkLaHOfaeTDWbYMu",
      "payment_method" : "9",
      "secret_key_2fa" : null,
      "state" : null,
      "status" : "active",
      "storage_price" : "0.000000",
      "suspended" : "0",
      "suspended_for_payment" : "0",
      "tax_info" : null,
      "timezone" : "Europe/London",
      "traffic_bps" : "0",
      "trial" : "0",
      "type_2fa" : null,
      "type_switch_ts" : "0",
      "update_ts" : "1708416831",
      "username" : "test123",
      "zip_code" : null
}

Create zone

With this API call you can create a zone. The only required parameters are `name` and `location_of_files`. With the first one you can set the uniqe zone name and with the second one you can control the location of the files for zone. For every other parameter check their description.
POST https://api.ucdn.com/v4/account/post_zone
This request returns the following information
Name Type Description
zone_name string The newly created zone's name
This request returns one of the following messages
Status Type Description
200 string A message for successfully created zone and it's name.
400 string An error message. Problem with parameters.
401 string An error message. Problem with the authentication. Invalid token.
This request expects the following parameters
Name Type Validation Default Description
zone_config array required Valid JSON structure   This parameter is required. All parameters are described below.




Livestream Zone Parameters Livestream Zone Parameters

Zone parameters are described below.


Parameter Type Description
name string Name of the zone. Limitations: string, 1-30 characters: a-z, A-Z, 0-9, -, _. There cannot be two or more zones with the same names. (required parameter)
cnames array of strings If not specified, it is set to null. Represents an array of strings, where each element represents a domain. (optional parameter)
location_of_files structure The location_of_files structure specify the location of files. To cache resources, the CDN network needs to fetch and cache the resources from the specified backend server. There are three options - ucdn_storage, custom_location, aws_s3. Only one of these options should be selected. (required structure)
limit_access structure Contains all access limits that can be imposed. (optional structure)
cache structure The cache structure manage caching resources, in order to improve performance. Resources can be cached for a long period of time. Also there is an option for reusing cache from other zone. (optional structure)
limit_download_speed structure With the limit_download_speed structure maxmimum bandwidth can be limited. There are two options - limit by constant rate or limit by URL parameter cdn_bw. Only one of these options should be selected. (optional structure)
error_pages structure The error_pages structure represents urls for pages when error occured. (optional structure)
cors structure Describing the CORS setting for the zone. If not provided, it is sent with a null value. (optional structure)



location_of_files

Parameter Type Description
ucdn_storage structure It is used when the files are located in UCDN storage. (optional parameter)
custom_location structure It is used when the files are not located in UCDN storage, but in some other location. (optional parameter)
aws_s3 structure Used when you use AWS services and our files are there. (optional parameter)

ucdn_storage

Parameter Type Description
storage_name string Represents the name of an existing storage to the user's account. This is the name of the storage where the files are stored. Validations: Must be an existing storage name and no longer than 32 characters. (required parameter)
region string It is used when we have two storages with the same name and different regions. Valid values: “north-america|europe”. (optional parameter)

custom_location

Parameter Type Description
protocol string If not selected, it is saved with the default value - "HTTP". Possible values - “HTTP|HTTPS”. Represents the protocol that the domains use. (optional parameter)
files_at struct Contains urls of the locations from where the files will be fetched. (required parameter)
http_authentication struct It is used if the location of the files requires authentication. (optional parameter)
access_origin_host_header struct It is used when different header is needed to access the files. (optional parameter)

files_at

Parameter Type Description
primary_urls array of struct It represents an array of structures. Example: {“first-domain.com”: {“port”: “80”, “weight”: “100”}, “174.202.97.102”: {“port”: “90”, “weight”: “80”}}. The given domain is used as the key of a given structure, and it must be unique regardless of port and weight. If port is not set, it is set with the default value - 80 (If the protocol is HTTPS, then the default value is 443). Validations: port must be between 1 and 65535 inclusive. If weight is not set, it is set with a default value of 100. If you want to set both params with default values - use {} (example: {“first-domain.com”: {}}). Validations: weight must be an integer between 1-100. To remove an origin, ensure it is not the last of primary type. If it is, consider creating a new primary origin before deletion. For now if you want to edit an origin you should delete and recreate it with the new domain. When modifying the last primary origin - you should first create new origin and then delete the old one. (required parameter)
backup_urls array of struct Same as primary_urls parameter.

http_authentication

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
username string Represents the username used to access the files. Validations: maximum length 128 characters. (required parameter)
password string Represents the password used to access the files. Validations: maximum length 128 characters. (required parameter)

access_origin_host_header

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
host_header string Define different host header with which your origin will be accessed. (required parameter)

aws_s3

Parameter Type Description
protocol string If not selected, it is saved with the default value - "HTTP". Possible values - “HTTP|HTTPS”. Represents the protocol that the domains use. (optional parameter)
location string Represents the aws_s3 url where the files are located. (required parameter)
bucket_name string It is used if the location of the files requires authentication. (required parameter)
access_key string It is used when different header is needed to access the files. (required parameter)
with_signing_key struct It is used when different header is needed to access the files. Only one of the following options should be selected - with_signing_key or with_secret_key. (optional parameter)
with_secret_key struct It is used when different header is needed to access the files. Only one of the following options should be selected - with_signing_key or with_secret_key. (optional parameter)

with_signing_key

Parameter Type Description
key_scope string Represents a key required by the s3 provider. (required parameter)
signing_key string Represents a signing key required by the s3 provider. (required parameter)

with_secret_key

Parameter Type Description
secret_key string Represents a secret key required by the s3 provider. (required parameter)
region string Represents a region required by the s3 provider. (required parameter)



limit_access

Parameter Type Description
by_referer structure Contains all limits by referer that can be imposed. (optional structure)
by_country structure Contains all country limits that can be imposed. (optional structure)
by_secret_key structure Contains all secret key limits that can be imposed. (optional structure)
by_ip structure Contains all ip limits that can be imposed. (optional structure)

by_referer

Parameter Type Description
enabled bool Shows whether referer limiting is enabled. Default is false. If by_referer is enabled - at least one parameter 'use_origin_if_no_referer' or 'allowed_domains' should be configured. (optional parameter)
use_origin_if_no_referer bool Default is false. When enabled is true, allows filter to use origin if referer header is missing. (optional parameter)
allowed_domains array Array of regex strings for allowed domains. (optional parameter)

by_country

Parameter Type Description
enabled bool Shows whether country limiting is enabled. Default is false. (optional parameter)
type string Allows or denies countries listed. Values: 'allow' or 'deny'. Active only when enabled is true. Default value: 'allow'. (optional parameter)
countries array Array of allowed/denied country ISO codes. (required when enabled is true.)

by_secret_key

Parameter Type Description
enabled bool Shows whether secret key limiting is enabled. Default is false. (optional parameter)
hash_secret_key string (required if enabled is true)
hash_algorithm string Values: "md5" or "sha1". Default value: 'md5'. (required if enabled is true)
hash_time_to_live_mins int Default is 30. Must be at least 1. (optional parameter)

by_ip

Parameter Type Description
enabled bool Shows whether IP limiting is enabled. Default is false. (optional parameter)
type string Allows or blocks IPs listed. Values: 'allow' or 'block'. Active only when enabled is true. Default value: 'allow'. (optional parameter)
ip_list array Array of allowed/blocked IP addresses. (required when enabled is true)



cache

Parameter Type Description
cache_for_limited_time structure It is used when we want to cache files for a limited time only. (optional parameter)
reuse_cache_from_other_zone structure It's used when we want to reuse cache from another zone. (optional parameter)

cache_for_limited_time

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
cache_expire_time_min int Represents a time after which files will no longer be cached. Validations: integer greater than or equal to 60. (required parameter)

reuse_cache_from_other_zone

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
zone_name string Represents a zone name that we want to use caching on. Validations: must be a domain of an existing zone to the given account. (required parameter)



limit_download_speed

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter.)
by_constant_rate structure It's used when we want to limit download speed by given rate. (optional structure)
by_cdn_bw bool It's used when we want to limit download speed by URL parameter cdn_bw. Limit access by secret key should be enabled in order to enable this parameter. (optional parameter)

by_constant_rate

Parameter Type Description
unit string Represents the unit of measure of by_constant_rate. Possible values - “KB|MB”. If not submitted, there is a default value - "KB". (optional parameter)
rate int Represents the rate of measure of by_constant_rate. Limits: cannot be less than 1. (optional parameter)



error_pages

Parameter Type Description
error_pages structure Represents a structure of urls of various error pages. The keys of this structure are the status codes, and the values are the urls themselves. If not provided, it is set with [ ] (empty array). Validations: possible keys (status codes) - [402, 403, 404, 405, 500, 502]. If we want to remove the 403 url, we submit it with {“error_pages”: {“403”: “”}}. (optional parameter.)



cors

Parameter Type Description
mode string CORS mode for zone. Values: 'simple', 'advanced', 'passthrough'. Default is 'simple'. (optional parameter)
allow_origin_mode string Values: 'any', 'csv', 'regexp'. Default is 'any'. (optional parameter)
allow_origin_csv array Array of allowed origins. (required if mode is 'advanced' and allow_origin_mode is 'csv')
allow_origin_regexp string Regex for allowed origins. (required if mode is 'advanced' and allow_origin_mode is 'regexp')
allow_methods string Allowed HTTP methods separated by commas. Values: 'GET', 'HEAD', 'POST', 'OPTIONS'. (optional parameter)
allow_credentials bool Default is false if mode is 'advanced'. (optional parameter)
allow_headers string Allowed headers separated by commas. Default is empty string if mode is 'advanced'. (optional parameter)
expose_headers string Exposed headers separated by commas. Default is empty string if mode is 'advanced'. (optional parameter)
max_age int Max age in seconds for preflight requests. Default is null if mode is 'advanced'. (optional parameter)

Examples

-- with minimum params (aws_s3 location)

curl -X POST 'https://api.ucdn.com/v4/account/post_zone?token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{
    "name": "test-zone",
    "location_of_files": {
        "aws_s3": {
            "protocol": "HTTP",
            "location": "mydomain.com",
            "bucket_name": "bucketName",
            "access_key": "x4dE",
            "with_signing_key": {
                "key_scope": "key",
                "signing_key": "signing_key"
            },
            "with_secret_key": {
                "secret_key": "x4SASX42",
                "region": "region"
            }
        }
    }
}'

-- with maximum params (custom_location)

curl -X POST 'https://api.ucdn.com/v4/account/post_zone?token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{
   "name": "test-zone",
   "cnames": [
       "first.cname.name",
       "second.cname.name"
   ],
   "location_of_files": {
       "custom_location": {
           "protocol": "HTTP",
           "files_at": {
               "primary_urls": {
                   "first-domain.com": {
                       "port": "80",
                       "weight": "100"
                   },
                   "second-domain.com": {
                       "port": "90",
                       "weight": "80"
                   }
               },
               "bacckup_urls": {
                   "third-domain.com": {
                       "port": "80",
                       "weight": "100"
                   }
               }
           },
           "http_authentication": {
               "enabled": true,
               "username": "userName",
               "password": "passWord"
           },
           "access_origin_host_header": {
               "enabled": true,
               "host_header": "header"
           }
       }
   },
   "limit_access": {
       "by_referer": {
           "enabled": true,
           "use_origin_if_no_referer": true,
           "allowed_domains": [
               "test.1",
               "test.2"
           ]
       },
       "by_country": {
           "enabled": true,
           "type": "deny",
           "countries": [
               "us",
               "ru"
           ]
       },
       "by_secret_key": {
           "enabled": true,
           "hash_secret_key": "12345_key",
           "hash_algorithm": "sha1",
           "hash_time_to_live_mins": 37
       },
       "by_ip": {
           "enabled": true,
           "type": "allow",
           "ip_list": [
               "174.202.97.102"
           ]
       }
   },
   "cache": {
       "cache_for_limited_time": {
           "enabled": true,
           "cache_expire_time_min": 21
       },
       "reuse_cache_from_other_zone": {
           "enabled": true,
           "zone_name": "any-zone-name"
       }
   },
   "limit_download_speed": {
       "enabled": true,
       "by_constant_rate": {
           "unit": "MB",
           "rate": 25
       }
   },
   "error_pages": {
       "402": "http://error-402.net",
       "403": "http://error-403.net",
       "404": "http://error-404.net",
       "405": "http://error-405.net",
       "500": "http://error-500.net",
       "502": "http://error-502.net"
   },
   "cors": {
       "mode": "advanced",
       "allow_origin_mode": "csv",
       "allow_origin_csv": "http://test.test",
       "allow_origin_regexp": "",
       "allow_methods": "GET,HEAD,POST,OPTIONS",
       "allow_credentials": "true",
       "allow_headers": "HEADER-1,HEADER-2",
       "expose_headers": "HEADER-3,HEADER-4",
       "max_age": 123
   }
}'
{
    "message": "Zone created succesfully.",
    "zone_name": "test-zone"
}

Edit zone

Changes the base configuration of a zone.
PATCH https://api.ucdn.com/v4/account/patch_zone?zone_name=...
This request returns the following information
Name Type Description
zone_name string The newly created zone's name
This request returns one of the following messages
Status Type Description
200 string A message for successfully edited zone.
400 string An error message. Problem with parameters.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required. All parameters are described below.




Examples

-- change location to ucdn_storage

curl -X PATCH 'https://api.ucdn.com/v4/account/patch_zone?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{
    "location_of_files": {
       "ucdn_storage": {
           "storage_name": "TestingContainer",
           "region": "north-america"
       }
    }
}'

-- disable reuse_cache_from_other_zone

curl -X PATCH 'https://api.ucdn.com/v4/account/patch_zone?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{
    "cache": {
        "reuse_cache_from_other_zone": {
            "enabled": false,
            "zone_name": "test-zone"
        }
    }
}'

-- disable error_page for status code 403

curl -X PATCH 'https://api.ucdn.com/v4/account/patch_zone?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{
    "error_pages": {
        "403": ""
    }
}'
{
    "message": "Zone patched"
}

Get zone

Returns a config of the zone with given name.
GET https://api.ucdn.com/v4/account/get_zone?zone_name=...
This request returns the following information
Name Type Description
zone_name string The newly created zone's name
This request returns one of the following messages
Status Type Description
200 string Config of the given zone.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.




Examples

curl -X GET 'https://api.ucdn.com/v4/account/get_zone?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338'
{
   "name": "test-zone",
   "cnames": [
       "first.cname.name",
       "second.cname.name"
   ],
   "location_of_files": {
       "custom_location": {
           "protocol": "HTTP",
           "files_at": {
               "primary_urls": {
                   "first-domain.com": {
                       "port": 80,
                       "weight": 100
                   },
                   "second-domain.com": {
                       "port": 90,
                       "weight": 80
                   }
               },
               "bacckup_urls": {
                   "third-domain.com": {
                       "port": 80,
                       "weight": 100
                   }
               }
           },
           "http_authentication": {
               "enabled": true,
               "username": "userName",
               "password": "passWord"
           },
           "access_origin_host_header": {
               "enabled": true,
               "host_header": "header"
           }
       }
   },
   "limit_access": {
       "by_referer": {
           "enabled": true,
           "use_origin_if_no_referer": true,
           "allowed_domains": [
               "test.1",
               "test.2"
           ]
       },
       "by_country": {
           "enabled": true,
           "type": "deny",
           "countries": [
               "us",
               "ru"
           ]
       },
       "by_secret_key": {
           "enabled": true,
           "hash_secret_key": "12345_key",
           "hash_algorithm": "sha1",
           "hash_time_to_live_mins": 37
       },
       "by_ip": {
           "enabled": true,
           "type": "allow",
           "ip_list": [
               "174.202.97.102"
           ]
       }
   },
   "cache": {
       "cache_for_limited_time": {
           "enabled": true,
           "cache_expire_time_min": 21
       },
       "reuse_cache_from_other_zone": {
           "enabled": true,
           "zone_name": "any-zone-name"
       }
   },
   "limit_download_speed": {
       "enabled": true,
       "by_constant_rate": {
           "unit": "MB",
           "rate": 25
       }
   },
   "error_pages": {
       "402": "http://error-402.net",
       "403": "http://error-403.net",
       "404": "http://error-404.net",
       "405": "http://error-405.net",
       "500": "http://error-500.net",
       "502": "http://error-502.net"
   },
   "cors": {
       "mode": "advanced",
       "allow_origin_mode": "csv",
       "allow_origin_csv": "http://test.test",
       "allow_origin_regexp": "",
       "allow_methods": "GET,HEAD,POST,OPTIONS",
       "allow_credentials": "true",
       "allow_headers": "HEADER-1,HEADER-2",
       "expose_headers": "HEADER-3,HEADER-4",
       "max_age": 123
   }
}

Get zone status

Returns a current status of the zone with given name.
GET https://api.ucdn.com/v4/account/check_zone_status?zone_name=...
This request returns the following information
Name Type Description
zone_active string Current zone status.
This request returns one of the following messages
Status Type Description
200 string Zone status.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.




Examples

curl -X GET 'https://api.ucdn.com/v4/account/check_zone_status?token=acf0230d03f5b71d7252e336106f7338'
{
    "zone_active": "1"
}

Delete zone

Deletes the zone with given name.
DELETE https://api.ucdn.com/v4/account/delete_zone?zone_name=...
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Zone deleted succesfully.
401 string Input parameter problem - invalid token, invalid zone name.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.




Examples

curl -X DELETE 'https://api.ucdn.com/v4/account/delete_zone?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338'
{
    "message": "Zone deleted successfully."
}

Delete origin

Deletes the origin from the zone with given name.
DELETE https://api.ucdn.com/v4/account/delete_origin?zone_name=...&domain=...
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Domain deleted succesfully.
401 string Input parameter problem - invalid token, invalid zone name.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone or origin with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.
domain string required Existing domain name   This parameter is required.




Examples

curl -X DELETE 'https://api.ucdn.com/v4/account/delete_origin?zone_name=test-zone&domain=first-domain.com&token=acf0230d03f5b71d7252e336106f7338'
{
    "message": "Domain deleted succesfully."
}

Activate letsencrypt

Activates letsencrypt for zone with given name.
POST https://api.ucdn.com/v4/account/activate_letsencrypt?zone_name=...
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Successfully activated letsencrypt.
401 string Input parameter problem - invalid token, invalid zone name.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.




Examples

curl -X POST 'https://api.ucdn.com/v4/account/activate_letsencrypt?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338'
{
    "message": "Successfully activated letsencrypt."
}

Deactivate letsencrypt

Deactivates letsencrypt for zone with given name.
POST https://api.ucdn.com/v4/account/deactivate_letsencrypt?zone_name=...
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Successfully deactivated letsencrypt.
401 string Input parameter problem - invalid token, invalid zone name.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.




Examples

curl -X DELETE 'https://api.ucdn.com/v4/account/deactivate_letsencrypt?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338'
{
    "message": "Successfully deactivated letsencrypt."
}

Get letsencrypt status

Returns a config of the zone with given name.
GET https://api.ucdn.com/v4/account/check_letsencrypt_status?zone_name=...
This request returns the following information
Name Type Description
letsencrypt_active string Current letsencrypt status.
This request returns one of the following messages
Status Type Description
200 string Letsencrypt status.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.




Examples

curl -X GET 'https://api.ucdn.com/v4/account/check_letsencrypt_status?token=acf0230d03f5b71d7252e336106f7338'
{
    "letsencrypt_active": "0"
}

Activate zone

Enable or disable zone.
PATCH https://api.ucdn.com/v4/account/toggle_zone_status?zone_name=...
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Successfully enabled/disabled zone.
401 string Input parameter problem - invalid token, invalid zone name
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.
enable bool Only one paramter (enable/disable) should be passed.   This parameter enables the zone.
disable bool Only one paramter (enable/disable) should be passed.   This parameter disables the zone.




Examples

curl -X PATCH 'https://api.ucdn.com/v4/account/toggle_zone_status?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{"enable": true}'
{
    "message": "Zone enabled"
}

Deactivate zone

Enable or disable zone.
PATCH https://api.ucdn.com/v4/account/toggle_zone_status?zone_name=...
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Successfully enabled/disabled zone.
401 string Input parameter problem - invalid token, invalid zone name
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.
enable bool Only one paramter (enable/disable) should be passed.   This parameter enables the zone.
disable bool Only one paramter (enable/disable) should be passed.   This parameter disables the zone.




Examples

curl -X PATCH 'https://api.ucdn.com/v4/account/toggle_zone_status?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{"disable": true}'
{
    "message": "Zone disabled"
}

Create livestreaming zones

Creates a zone with given parameters.
POST https://api.ucdn.com/v4/livestreaming/post_livestream_zone
This request returns the following information
Name Type Description
zone_name string The newly created zone's name
This request returns one of the following messages
Status Type Description
200 string A message for successfully created zone and it's name.
400 string An error message. Problem with parameters.
401 string An error message. Problem with the authentication. Invalid token.
403 string An error message. The user is not allowed to create livestream zones or he has reached the limit of livestreaming zones.
This request expects the following parameters
Name Type Validation Default Description
zone_config array required Existing zone name This parameter is required. All parameters are described below.


Examples

-- with minimum params

curl -X POST 'https://api.ucdn.com/v4/livestreaming/post_livestream_zone?token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{"name": "any-zone-name"}'

-- with maximum params

curl -X POST 'https://api.ucdn.com/v4/livestreaming/post_livestream_zone?token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  -- data '{
    "name": "any-zone-name",
    "hls_via_cdn": true,
    "include_base_stream_in_master_playlist": true,
    "recording": {
        "keep_copy_of_base_stream_as_mp4": true,
        "storage_name": "storage EU",
        "region": "europe",
        "target_duration_per_file": 60
    },
    "dvr": {
        "enabled": true,
        "keep_full_stream": true,
        "dvr_session_timeout": "60",
        "stream_rewind_window": "720"
    },
    "streams": {
        "base": {
            "restreams": {}
        },
        "1080p-30": {
            "transcode": {
                "enabled": true,
                "upload_on": true,
                "framerate": 45,
                "video_bitrate": 1234000,
                "profile": "high",
                "resolution": "720p",
                "audio_bitrate": 120000
            },
            "restreams": {
                "youtube_restream": {
                    "enabled": true,
                    "new_name": "youtube_restream_new",
                    "publish_url": "rtmp://b.com",
                    "stream_key": "12345654321"
                }
            },
            "new_name": "1080p-30-new"
        }
    },
    "cnames": [
        "some.cname.name",
        "some1.cname.name"
    ],
    "limit_access": {
        "by_referer": {
            "enabled": true,
            "use_origin_if_no_referer": true,
            "allowed_domains": [
                "test.1",
                "test.2"
            ]
        },
        "by_country": {
            "enabled": true,
            "type": "allow|deny",
            "countries:": [
                "us",
                "ru"
            ]
        },
        "by_secret_key": {
            "enabled": true,
            "hash_secret_key": "12345_key",
            "hash_algorithm": "md5|sha1",
            "hash_time_to_live_mins": 37
        },
        "by_ip": {
            "enabled": true,
            "type": "allow|block",
            "ip_list": [
                "192.168.0.1",
                "102.102.102.102"
            ]
        }
    },
    "cors": {
        "mode": "advanced",
        "allow_origin_mode": "csv",
        "allow_origin_csv": ["http://test.test"],
        "allow_origin_regexp": "",
        "allow_methods": "GET,HEAD,POST,OPTIONS",
        "allow_credentials": "true",
        "allow_headers": "HEADER-1,HEADER-2",
        "expose_headers": "HEADER-3,HEADER-4",
        "max_age": 123
    }
}'
{
    "message": "Livestream zone created succesfully.",
    "zone_name": "any-zone-name"
}

Livestream Zone Parameters Livestream Zone Parameters

Livestream parameters are described below.


Parameter Type Description
name string Name of the livestreaming zone. Limitations: string, 1-30 characters: a-z, A-Z, 0-9, -, _. There cannot be two or more zones with the same names. (required parameter)
new_name string New name of the livestreaming zone. Limitations are the same as 'name' parameter. Can be used when editing the zone. (optional parameter)
hls_via_cdn bool If not specified, it is set to true. If enabled, it allows HTTP access to the livestreaming zone, enabling HLS over CDN. (optional parameter)
include_base_stream_in_master_playlist bool If not specified, it is not included in the data. If enabled, the index.m3u8 file of the base stream will be included in the master.m3u8. (optional parameter)
cnames array of strings If not specified, it is set to null. Represents an array of strings, where each element represents a domain. (optional parameter)
recording structure The Recording structure sets the rules for how a livestream is stored on servers. It includes options for retaining a copy of the base stream ('keep_copy_of_base_stream_as_mp4'), specifying the storage name ('storage_name'), storage region ('region'), and segment duration ('target_duration_per_file'). If not provided, it will be recorded with the default values described below. (optional structure)
DVR structure The DVR structure configures the recording and time customization options capabilities for live streams. The structure includes options to enable DVR ('enabled'), whether to keep the entire stream ('keep_full_stream'), session timeout settings ('dvr_session_timeout'), and the window size determining how far back viewer can rewind the stream ('stream_rewind_window'). If not provided, it will be recorded with the default values described below. (optional structure)
streams structure The Streams structure defines the individual streams within a livestreaming zone. It includes mandatory and optional settings for stream name ('name'), transcoding (transcode with its subparameters like 'framerate', 'video_bitrate_kbps', etc.), and restreams. The structure also allows you to impose limits on stream access ('limit_access') and configure zone CORS settings ('cors'). If not provided, it will be recorded with the default values described below. (optional structure)
limit_access structure Contains all access limits that can be imposed. (optional structure)
cors structure Describing the CORS setting for the zone. If not provided, it is sent with a null value. (optional structure)



recording

Parameter Type Description
keep_copy_of_base_stream_as_mp4 bool If not provided, it will be set to false. It represents a boolean value, if enabled - the base stream is uploaded to the storage. However, if it is marked as true, then the storage_name must be provided in the recording structure. (optional parameter)
storage_name string If not provided, it will be set to '' (empty string). It represents the name of an existing storage to the user's account. This is the name of the storage, in which the recorded stream will be uploaded. (optional parameter)
region string It represents the region of an existing storage to the user's account. Possible values: 'europe', 'north-america'. (optional parameter)
target_duration_per_file int If not provided, it will be set to 30. It represents a number showing how long the individual livestream segments should be in minutes, which are uploaded to the storage. Possible values: 30, 60, 90, 120, 150, 180, 240, 300, 360. (optional parameter)



DVR

Parameter Type Description
enabled bool Determines whether to enable/disable DVR for the zone. If DVR is enabled we should have a configured storage and the following parameters are required: (required parameter)
keep_full_stream bool Determines whether to keep the entire DVR of the stream. Default value: false. (optional parameter)
dvr_session_timeout int Determines the time duration of streaming inactivity before the DVR session is considered complete. When the session is considered complete, the system processes and uploads the remaining segments and playlists. Possible values are: 30, 60, 90, 120, 240. (If enabled is true, then the parameter is required.)
stream_rewind_window int Determines the maximum time for which a viewer can rewind within the session of a given stream. The system automatically removes older segments that are outside of this set window. Possible values are: 60, 120, 240, 360, 480, 600, 720, 1440. (If enabled is true, then the parameter is required.)



streams

Parameter Type Description
name structure Name of the transcoding. Limitations: string, 5-30 characters: a-z, A-Z, 0-9, -, _. (required parameter)
Parameter Type Description
transcode structure Contains all the settings for transcoding a given stream. (optional structure.)
restreams structure Contains all restreams for a given stream. If not provided, it is set to {}. (optional structure)
new_name string It is used to update the transcoding name. (optional parameter)

transcode

Parameter Type Description
enabled bool Indicates whether the transcode is enabled or disabled. (required parameter)
keep_copy_as_mp4 bool If not provided - has default value false. Indicates whether this transcode should be stored in storage. (optional parameter)
framerate int If not provided - has default value 30. video framerate - number from 2 to 120. (optional parameter)
video_bitrate_kbps int Video bitrate in kbps. Determined by resolution and fps if not provided. Possible values: 100 - 50,000. (optional parameter)
profile string Default is "main". Possible values: "baseline", "main", "high". (optional parameter)
resolution string Video resolution height. Possible values: 144p, 240p, 360p, 480p, 720p, 1080p, 2160p. (required parameter)
audio_bitrate_kbps int Audio bitrate in kbps. Determined by resolution and fps if not provided. Possible values: 48 - 320. (optional parameter)

restreams

Parameter Type Description
enabled bool Shows whether a given restream is enabled. (optional parameter)
name string Name of the restream. (required parameter)
new_name string Used to update restream name. (optional parameter)
publish_url string RTMP URL for restream redirection. (required parameter)
stream_key string Key for restream push to RTMP URL. (required parameter)



limit_access

Parameter Type Description
by_referer structure Contains all limits by referer that can be imposed. (optional structure)
by_country structure Contains all country limits that can be imposed. (optional structure)
by_secret_key structure Contains all secret key limits that can be imposed. (optional structure)
by_ip structure Contains all ip limits that can be imposed. (optional structure)

by_referer

Parameter Type Description
enabled bool Shows whether referer limiting is enabled. Default is false. If by_referer is enabled - at least one parameter 'use_origin_if_no_referer' or 'allowed_domains' should be configured.(optional parameter)
use_origin_if_no_referer bool Default is false. When enabled is true, allows filter to use origin if referer header is missing. (optional parameter)
allowed_domains array Array of regex strings for allowed domains.(optional parameter)

by_country

Parameter Type Description
enabled bool Shows whether country limiting is enabled. Default is false. (optional parameter)
type string Allows or denies countries listed. Values: 'allow' or 'deny'. Active only when enabled is true. Default value: 'allow'. (optional parameter)
countries array Array of allowed/denied country ISO codes. (required when enabled is true.)

by_secret_key

Parameter Type Description
enabled bool Shows whether secret key limiting is enabled. Default is false. (optional parameter)
hash_secret_key string (required if enabled is true)
hash_algorithm string Values: "md5" or "sha1". Default value: 'md5'. (required if enabled is true)
hash_time_to_live_mins int Default is 30. Must be at least 1. (optional parameter)

by_ip

Parameter Type Description
enabled bool Shows whether IP limiting is enabled. Default is false. (optional parameter)
type string Allows or blocks IPs listed. Values: 'allow' or 'block'. Active only when enabled is true. Default value: 'allow'. (optional parameter)
ip_list array Array of allowed/blocked IP addresses. (required when enabled is true)



cors

Parameter Type Description
mode string CORS mode for zone. Values: 'simple', 'advanced', 'passthrough'. Default is 'simple'. (optional parameter)
allow_origin_mode string Values: 'any', 'csv', 'regexp'. Default is 'any'. (optional parameter)
allow_origin_csv array Array of allowed origins. (required if mode is 'advanced' and allow_origin_mode is 'csv')
allow_origin_regexp string Regex for allowed origins. (required if mode is 'advanced' and allow_origin_mode is 'regexp')
allow_methods string Allowed HTTP methods separated by commas. Values: 'GET', 'HEAD', 'POST', 'OPTIONS'. (optional parameter)
allow_credentials bool Default is false if mode is 'advanced'. (optional parameter)
allow_headers string Allowed headers separated by commas. Default is empty string if mode is 'advanced'. (optional parameter)
expose_headers string Exposed headers separated by commas. Default is empty string if mode is 'advanced'. (optional parameter)
max_age int Max age in seconds for preflight requests. Default is null if mode is 'advanced'. (optional parameter)


Livestream Zone Parameters Livestream Zone Parameters

Zone parameters are described below.


Parameter Type Description
name string Name of the zone. Limitations: string, 1-30 characters: a-z, A-Z, 0-9, -, _. There cannot be two or more zones with the same names. (required parameter)
cnames array of strings If not specified, it is set to null. Represents an array of strings, where each element represents a domain. (optional parameter)
location_of_files structure The location_of_files structure specify the location of files. To cache resources, the CDN network needs to fetch and cache the resources from the specified backend server. There are three options - ucdn_storage, custom_location, aws_s3. Only one of these options should be selected. (required structure)
limit_access structure Contains all access limits that can be imposed. (optional structure)
cache structure The cache structure manage caching resources, in order to improve performance. Resources can be cached for a long period of time. Also there is an option for reusing cache from other zone. (optional structure)
limit_download_speed structure With the limit_download_speed structure maxmimum bandwidth can be limited. There are two options - limit by constant rate or limit by URL parameter cdn_bw. Only one of these options should be selected. (optional structure)
error_pages structure The error_pages structure represents urls for pages when error occured. (optional structure)
cors structure Describing the CORS setting for the zone. If not provided, it is sent with a null value. (optional structure)



location_of_files

Parameter Type Description
ucdn_storage structure It is used when the files are located in UCDN storage. (optional parameter)
custom_location structure It is used when the files are not located in UCDN storage, but in some other location. (optional parameter)
aws_s3 structure Used when you use AWS services and our files are there. (optional parameter)

ucdn_storage

Parameter Type Description
storage_name string Represents the name of an existing storage to the user's account. This is the name of the storage where the files are stored. Validations: Must be an existing storage name and no longer than 32 characters. (required parameter)
region string It is used when we have two storages with the same name and different regions. Valid values: “north-america|europe”. (optional parameter)

custom_location

Parameter Type Description
protocol string If not selected, it is saved with the default value - "HTTP". Possible values - “HTTP|HTTPS”. Represents the protocol that the domains use. (optional parameter)
files_at struct Contains urls of the locations from where the files will be fetched. (required parameter)
http_authentication struct It is used if the location of the files requires authentication. (optional parameter)
access_origin_host_header struct It is used when different header is needed to access the files. (optional parameter)

files_at

Parameter Type Description
primary_urls array of struct It represents an array of structures. Example: {“first-domain.com”: {“port”: “80”, “weight”: “100”}, “174.202.97.102”: {“port”: “90”, “weight”: “80”}}. The given domain is used as the key of a given structure, and it must be unique regardless of port and weight. If port is not set, it is set with the default value - 80 (If the protocol is HTTPS, then the default value is 443). Validations: port must be between 1 and 65535 inclusive. If weight is not set, it is set with a default value of 100. If you want to set both params with default values - use {} (example: {“first-domain.com”: {}}). Validations: weight must be an integer between 1-100. To remove an origin, ensure it is not the last of primary type. If it is, consider creating a new primary origin before deletion. For now if you want to edit an origin you should delete and recreate it with the new domain. When modifying the last primary origin - you should first create new origin and then delete the old one. (required parameter)
backup_urls array of struct Same as primary_urls parameter.

http_authentication

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
username string Represents the username used to access the files. Validations: maximum length 128 characters. (required parameter)
password string Represents the password used to access the files. Validations: maximum length 128 characters. (required parameter)

access_origin_host_header

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
host_header string Define different host header with which your origin will be accessed. (required parameter)

aws_s3

Parameter Type Description
protocol string If not selected, it is saved with the default value - "HTTP". Possible values - “HTTP|HTTPS”. Represents the protocol that the domains use. (optional parameter)
location string Represents the aws_s3 url where the files are located. (required parameter)
bucket_name string It is used if the location of the files requires authentication. (required parameter)
access_key string It is used when different header is needed to access the files. (required parameter)
with_signing_key struct It is used when different header is needed to access the files. Only one of the following options should be selected - with_signing_key or with_secret_key. (optional parameter)
with_secret_key struct It is used when different header is needed to access the files. Only one of the following options should be selected - with_signing_key or with_secret_key. (optional parameter)

with_signing_key

Parameter Type Description
key_scope string Represents a key required by the s3 provider. (required parameter)
signing_key string Represents a signing key required by the s3 provider. (required parameter)

with_secret_key

Parameter Type Description
secret_key string Represents a secret key required by the s3 provider. (required parameter)
region string Represents a region required by the s3 provider. (required parameter)



limit_access

Parameter Type Description
by_referer structure Contains all limits by referer that can be imposed. (optional structure)
by_country structure Contains all country limits that can be imposed. (optional structure)
by_secret_key structure Contains all secret key limits that can be imposed. (optional structure)
by_ip structure Contains all ip limits that can be imposed. (optional structure)

by_referer

Parameter Type Description
enabled bool Shows whether referer limiting is enabled. Default is false. If by_referer is enabled - at least one parameter 'use_origin_if_no_referer' or 'allowed_domains' should be configured. (optional parameter)
use_origin_if_no_referer bool Default is false. When enabled is true, allows filter to use origin if referer header is missing. (optional parameter)
allowed_domains array Array of regex strings for allowed domains. (optional parameter)

by_country

Parameter Type Description
enabled bool Shows whether country limiting is enabled. Default is false. (optional parameter)
type string Allows or denies countries listed. Values: 'allow' or 'deny'. Active only when enabled is true. Default value: 'allow'. (optional parameter)
countries array Array of allowed/denied country ISO codes. (required when enabled is true.)

by_secret_key

Parameter Type Description
enabled bool Shows whether secret key limiting is enabled. Default is false. (optional parameter)
hash_secret_key string (required if enabled is true)
hash_algorithm string Values: "md5" or "sha1". Default value: 'md5'. (required if enabled is true)
hash_time_to_live_mins int Default is 30. Must be at least 1. (optional parameter)

by_ip

Parameter Type Description
enabled bool Shows whether IP limiting is enabled. Default is false. (optional parameter)
type string Allows or blocks IPs listed. Values: 'allow' or 'block'. Active only when enabled is true. Default value: 'allow'. (optional parameter)
ip_list array Array of allowed/blocked IP addresses. (required when enabled is true)



cache

Parameter Type Description
cache_for_limited_time structure It is used when we want to cache files for a limited time only. (optional parameter)
reuse_cache_from_other_zone structure It's used when we want to reuse cache from another zone. (optional parameter)

cache_for_limited_time

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
cache_expire_time_min int Represents a time after which files will no longer be cached. Validations: integer greater than or equal to 60. (required parameter)

reuse_cache_from_other_zone

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
zone_name string Represents a zone name that we want to use caching on. Validations: must be a domain of an existing zone to the given account. (required parameter)



limit_download_speed

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter.)
by_constant_rate structure It's used when we want to limit download speed by given rate. (optional structure)
by_cdn_bw bool It's used when we want to limit download speed by URL parameter cdn_bw. Limit access by secret key should be enabled in order to enable this parameter. (optional parameter)

by_constant_rate

Parameter Type Description
unit string Represents the unit of measure of by_constant_rate. Possible values - “KB|MB”. If not submitted, there is a default value - "KB". (optional parameter)
rate int Represents the rate of measure of by_constant_rate. Limits: cannot be less than 1. (optional parameter)



error_pages

Parameter Type Description
error_pages structure Represents a structure of urls of various error pages. The keys of this structure are the status codes, and the values are the urls themselves. If not provided, it is set with [ ] (empty array). Validations: possible keys (status codes) - [402, 403, 404, 405, 500, 502]. If we want to remove the 403 url, we submit it with {“error_pages”: {“403”: “”}}. (optional parameter.)



cors

Parameter Type Description
mode string CORS mode for zone. Values: 'simple', 'advanced', 'passthrough'. Default is 'simple'. (optional parameter)
allow_origin_mode string Values: 'any', 'csv', 'regexp'. Default is 'any'. (optional parameter)
allow_origin_csv array Array of allowed origins. (required if mode is 'advanced' and allow_origin_mode is 'csv')
allow_origin_regexp string Regex for allowed origins. (required if mode is 'advanced' and allow_origin_mode is 'regexp')
allow_methods string Allowed HTTP methods separated by commas. Values: 'GET', 'HEAD', 'POST', 'OPTIONS'. (optional parameter)
allow_credentials bool Default is false if mode is 'advanced'. (optional parameter)
allow_headers string Allowed headers separated by commas. Default is empty string if mode is 'advanced'. (optional parameter)
expose_headers string Exposed headers separated by commas. Default is empty string if mode is 'advanced'. (optional parameter)
max_age int Max age in seconds for preflight requests. Default is null if mode is 'advanced'. (optional parameter)


Edit livestreaming zones

Changes the base configuration of a zone.
PATCH https://api.ucdn.com/v4/livestreaming/patch_livestream_zone/?zone_name=...
This request returns the following information
Name Type Description
message array The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Message for success.
400 string Input parameter problem - invalid token, invalid zone name, invalid transcoding_name.
401 string Problem with the authentication. Invalid token.
403 string The user does not have livestreaming turned on for their account.
404 string Given zone does not exists.
409 string There is currently an active livestream running on the zone, or there is another restriction that prevents the change from going through.
This request expects the following parameters
Name Type Validation Default Description
zone_config array required Existing zone name This parameter is required. All parameters are described in post livestreaming zones.




Livestream Zone Parameters Livestream Zone Parameters

Zone parameters are described below.


Parameter Type Description
name string Name of the zone. Limitations: string, 1-30 characters: a-z, A-Z, 0-9, -, _. There cannot be two or more zones with the same names. (required parameter)
cnames array of strings If not specified, it is set to null. Represents an array of strings, where each element represents a domain. (optional parameter)
location_of_files structure The location_of_files structure specify the location of files. To cache resources, the CDN network needs to fetch and cache the resources from the specified backend server. There are three options - ucdn_storage, custom_location, aws_s3. Only one of these options should be selected. (required structure)
limit_access structure Contains all access limits that can be imposed. (optional structure)
cache structure The cache structure manage caching resources, in order to improve performance. Resources can be cached for a long period of time. Also there is an option for reusing cache from other zone. (optional structure)
limit_download_speed structure With the limit_download_speed structure maxmimum bandwidth can be limited. There are two options - limit by constant rate or limit by URL parameter cdn_bw. Only one of these options should be selected. (optional structure)
error_pages structure The error_pages structure represents urls for pages when error occured. (optional structure)
cors structure Describing the CORS setting for the zone. If not provided, it is sent with a null value. (optional structure)



location_of_files

Parameter Type Description
ucdn_storage structure It is used when the files are located in UCDN storage. (optional parameter)
custom_location structure It is used when the files are not located in UCDN storage, but in some other location. (optional parameter)
aws_s3 structure Used when you use AWS services and our files are there. (optional parameter)

ucdn_storage

Parameter Type Description
storage_name string Represents the name of an existing storage to the user's account. This is the name of the storage where the files are stored. Validations: Must be an existing storage name and no longer than 32 characters. (required parameter)
region string It is used when we have two storages with the same name and different regions. Valid values: “north-america|europe”. (optional parameter)

custom_location

Parameter Type Description
protocol string If not selected, it is saved with the default value - "HTTP". Possible values - “HTTP|HTTPS”. Represents the protocol that the domains use. (optional parameter)
files_at struct Contains urls of the locations from where the files will be fetched. (required parameter)
http_authentication struct It is used if the location of the files requires authentication. (optional parameter)
access_origin_host_header struct It is used when different header is needed to access the files. (optional parameter)

files_at

Parameter Type Description
primary_urls array of struct It represents an array of structures. Example: {“first-domain.com”: {“port”: “80”, “weight”: “100”}, “174.202.97.102”: {“port”: “90”, “weight”: “80”}}. The given domain is used as the key of a given structure, and it must be unique regardless of port and weight. If port is not set, it is set with the default value - 80 (If the protocol is HTTPS, then the default value is 443). Validations: port must be between 1 and 65535 inclusive. If weight is not set, it is set with a default value of 100. If you want to set both params with default values - use {} (example: {“first-domain.com”: {}}). Validations: weight must be an integer between 1-100. To remove an origin, ensure it is not the last of primary type. If it is, consider creating a new primary origin before deletion. For now if you want to edit an origin you should delete and recreate it with the new domain. When modifying the last primary origin - you should first create new origin and then delete the old one. (required parameter)
backup_urls array of struct Same as primary_urls parameter.

http_authentication

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
username string Represents the username used to access the files. Validations: maximum length 128 characters. (required parameter)
password string Represents the password used to access the files. Validations: maximum length 128 characters. (required parameter)

access_origin_host_header

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
host_header string Define different host header with which your origin will be accessed. (required parameter)

aws_s3

Parameter Type Description
protocol string If not selected, it is saved with the default value - "HTTP". Possible values - “HTTP|HTTPS”. Represents the protocol that the domains use. (optional parameter)
location string Represents the aws_s3 url where the files are located. (required parameter)
bucket_name string It is used if the location of the files requires authentication. (required parameter)
access_key string It is used when different header is needed to access the files. (required parameter)
with_signing_key struct It is used when different header is needed to access the files. Only one of the following options should be selected - with_signing_key or with_secret_key. (optional parameter)
with_secret_key struct It is used when different header is needed to access the files. Only one of the following options should be selected - with_signing_key or with_secret_key. (optional parameter)

with_signing_key

Parameter Type Description
key_scope string Represents a key required by the s3 provider. (required parameter)
signing_key string Represents a signing key required by the s3 provider. (required parameter)

with_secret_key

Parameter Type Description
secret_key string Represents a secret key required by the s3 provider. (required parameter)
region string Represents a region required by the s3 provider. (required parameter)



limit_access

Parameter Type Description
by_referer structure Contains all limits by referer that can be imposed. (optional structure)
by_country structure Contains all country limits that can be imposed. (optional structure)
by_secret_key structure Contains all secret key limits that can be imposed. (optional structure)
by_ip structure Contains all ip limits that can be imposed. (optional structure)

by_referer

Parameter Type Description
enabled bool Shows whether referer limiting is enabled. Default is false. If by_referer is enabled - at least one parameter 'use_origin_if_no_referer' or 'allowed_domains' should be configured. (optional parameter)
use_origin_if_no_referer bool Default is false. When enabled is true, allows filter to use origin if referer header is missing. (optional parameter)
allowed_domains array Array of regex strings for allowed domains. (optional parameter)

by_country

Parameter Type Description
enabled bool Shows whether country limiting is enabled. Default is false. (optional parameter)
type string Allows or denies countries listed. Values: 'allow' or 'deny'. Active only when enabled is true. Default value: 'allow'. (optional parameter)
countries array Array of allowed/denied country ISO codes. (required when enabled is true.)

by_secret_key

Parameter Type Description
enabled bool Shows whether secret key limiting is enabled. Default is false. (optional parameter)
hash_secret_key string (required if enabled is true)
hash_algorithm string Values: "md5" or "sha1". Default value: 'md5'. (required if enabled is true)
hash_time_to_live_mins int Default is 30. Must be at least 1. (optional parameter)

by_ip

Parameter Type Description
enabled bool Shows whether IP limiting is enabled. Default is false. (optional parameter)
type string Allows or blocks IPs listed. Values: 'allow' or 'block'. Active only when enabled is true. Default value: 'allow'. (optional parameter)
ip_list array Array of allowed/blocked IP addresses. (required when enabled is true)



cache

Parameter Type Description
cache_for_limited_time structure It is used when we want to cache files for a limited time only. (optional parameter)
reuse_cache_from_other_zone structure It's used when we want to reuse cache from another zone. (optional parameter)

cache_for_limited_time

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
cache_expire_time_min int Represents a time after which files will no longer be cached. Validations: integer greater than or equal to 60. (required parameter)

reuse_cache_from_other_zone

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter)
zone_name string Represents a zone name that we want to use caching on. Validations: must be a domain of an existing zone to the given account. (required parameter)



limit_download_speed

Parameter Type Description
enabled bool Indicates whether the option is enabled or not. (required parameter.)
by_constant_rate structure It's used when we want to limit download speed by given rate. (optional structure)
by_cdn_bw bool It's used when we want to limit download speed by URL parameter cdn_bw. Limit access by secret key should be enabled in order to enable this parameter. (optional parameter)

by_constant_rate

Parameter Type Description
unit string Represents the unit of measure of by_constant_rate. Possible values - “KB|MB”. If not submitted, there is a default value - "KB". (optional parameter)
rate int Represents the rate of measure of by_constant_rate. Limits: cannot be less than 1. (optional parameter)



error_pages

Parameter Type Description
error_pages structure Represents a structure of urls of various error pages. The keys of this structure are the status codes, and the values are the urls themselves. If not provided, it is set with [ ] (empty array). Validations: possible keys (status codes) - [402, 403, 404, 405, 500, 502]. If we want to remove the 403 url, we submit it with {“error_pages”: {“403”: “”}}. (optional parameter.)



cors

Parameter Type Description
mode string CORS mode for zone. Values: 'simple', 'advanced', 'passthrough'. Default is 'simple'. (optional parameter)
allow_origin_mode string Values: 'any', 'csv', 'regexp'. Default is 'any'. (optional parameter)
allow_origin_csv array Array of allowed origins. (required if mode is 'advanced' and allow_origin_mode is 'csv')
allow_origin_regexp string Regex for allowed origins. (required if mode is 'advanced' and allow_origin_mode is 'regexp')
allow_methods string Allowed HTTP methods separated by commas. Values: 'GET', 'HEAD', 'POST', 'OPTIONS'. (optional parameter)
allow_credentials bool Default is false if mode is 'advanced'. (optional parameter)
allow_headers string Allowed headers separated by commas. Default is empty string if mode is 'advanced'. (optional parameter)
expose_headers string Exposed headers separated by commas. Default is empty string if mode is 'advanced'. (optional parameter)
max_age int Max age in seconds for preflight requests. Default is null if mode is 'advanced'. (optional parameter)

Examples

-- change the resolution of the stream 'my-transcode'

curl -X PATCH 'https://api.ucdn.com/v4/livestreaming/patch_livestream_zone/?zone_name=any-zone-name&token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{"streams":{"my-transcode":{"transcode":{"resolution":"360p"}}}}'


-- add a restream to stream 'my-transcode'

curl -X PATCH 'https://api.ucdn.com/v4/livestreaming/patch_livestream_zone/?zone_name=any-zone-name&token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{"streams": {"my-transcode": {"restreams": {"third-restream": {"enabled": false,"publish_url": "rtmp://test-url-new.com","stream_key": "12345678"}}}}}'
{
    "message": "Zone patched"
}

Get livestreaming zones

Returns a config of the given zone name.
GET https://api.ucdn.com/v4/livestreaming/get_livestream_zone?zone_name=...
This request returns the following information
Name Type Description
config array Fetched zone config
This request returns one of the following messages
Status Type Description
200 string Livestream zone config.
401 string Problem with the authentication. Invalid token.
403 string The user does not have livestreaming turned on for their account.
404 string Given zone does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name This parameter is required.




Examples

curl -X GET 'https://api.ucdn.com/v4/livestreaming/get_livestream_zone?zone_name=any-zone-name&token=acf0230d03f5b71d7252e336106f7338'
{
    "name": "any-zone-name",
    "hls_via_cdn": true,
    "include_base_stream_in_master_playlist": true,
    "recording": {
        "keep_copy_of_base_stream_as_mp4": true,
        "storage_name": "TestingContainer",
        "target_duration_per_file": "60"
    },
    "dvr": {
        "enabled": true,
        "keep_full_stream": true,
        "dvr_session_timeout": "30",
        "stream_rewind_window": "120"
    },
    "streams": {
        "base": {
            "restreams": []
        },
        "1080p-60": {
            "transcode": {
                "enabled": true,
                "keep_copy_as_mp4": false,
                "framerate": 60,
                "video_bitrate_kbps": 25000000,
                "profile": "high",
                "resolution": "1080p",
                "audio_bitrate_kbps": 256000
            },
            "restreams": {
                "youtube_restream": {
                    "enabled": true,
                    "publish_url": "rtmp:\/\/b.com",
                    "stream_key": "123321"
                }
            }
        }
    },
    "cnames": [
        "my-domain.com"
    ],
    "limit_access": {
        "by_referer": {
            "enabled": true,
            "use_origin_if_no_referer": true,
            "allowed_domains": [
                "test-domain.com"
            ]
        },
        "by_country": {
            "enabled": true,
            "type": "deny",
            "countries": [
                "ro"
            ]
        },
        "by_secret_key": {
            "enabled": true,
            "hash_secret_key": "myKey2",
            "hash_algorithm": "md5",
            "hash_time_to_live_mins": "30"
        },
        "by_ip": {
            "enabled": true,
            "type": "deny",
            "ip_list": [
                "111.151.161.171"
            ]
        }
    },
    "cors": {
        "mode": "advanced",
        "allow_origin_mode": "any",
        "allow_origin_csv": "",
        "allow_origin_regexp": "",
        "allow_methods": "",
        "allow_credentials": "false",
        "allow_headers": "",
        "expose_headers": "",
        "max_age": ""
    }
}

Get livestreaming zone status

Returns a current status of the zone with given name.
GET https://api.ucdn.com/v4/livestreaming/check_zone_status?zone_name=...
This request returns the following information
Name Type Description
zone_active string Current zone status.
This request returns one of the following messages
Status Type Description
200 string Zone status.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.




Examples

curl -X GET 'https://api.ucdn.com/v4/livestreaming/check_zone_status?token=acf0230d03f5b71d7252e336106f7338'
{
    "zone_active": "1"
}

Delete livestreaming zones

Deletes given zone.
DELETE https://api.ucdn.com/v4/livestreaming/delete_livestream_zone?zone_name=...
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Livestream zone deleted succesfully.
400 string Input parameter problem - invalid token, invalid zone name, invalid transcoding_name.
401 string Problem with the authentication. Invalid token.
403 string The user does not have livestreaming turned on for their account.
404 string Given zone does not exists.
409 string There is currently an active livestream running on the zone, or there is another restriction that prevents the change from going through.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.




Examples

curl -X DELETE 'https://api.ucdn.com/v4/livestreaming/delete_livestream_zone?zone_name=any-zone-name&token=acf0230d03f5b71d7252e336106f7338'
{
    "messgae": "Zone deleted succesfully",
}

Delete transcodings

Deletes given transcoding.
DELETE https://api.ucdn.com/v4/livestreaming/delete_transcoding?zone_name=...&transcoding_name...
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Transcode deleted succesfully.
400 string Input parameter problem - invalid token, invalid zone name, invalid transcoding_name.
401 string Problem with the authentication. Invalid token.
403 string The user does not have livestreaming turned on for their account.
404 string Given zone or transcoding does not exists.
409 string There is currently an active livestream running on the zone, or there is another restriction that prevents the change from going through.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name This parameter is required.
transcoding_name string required Existing transcoding name This parameter is required.




Examples

curl -X DELETE 'https://api.ucdn.com/v4/livestreaming/delete_transcoding?zone_name=any-zone-name&transcoding_name=my-transcode&token=acf0230d03f5b71d7252e336106f7338'
{
    "message": "Transcode deleted succesfully."
}

Delete restreams

Deletes given restream.
DELETE https://api.ucdn.com/v4/livestreaming/delete_restream?zone_name=...&restream_name=...&transcoding_name=...
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Restream deleted succesfully.
400 string Input parameter problem - invalid token, invalid zone name, invalid transcoding_name.
401 string Problem with the authentication. Invalid token.
403 string The user does not have livestreaming turned on for their account.
404 string Given zone or transcoding does not exists.
409 string There is currently an active livestream running on the zone, or there is another restriction that prevents the change from going through.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.
restream_name string required Existing restream name   This parameter is required.
transcoding_name string required Existing transcoding name   This parameter is required.




Examples

curl -X DELETE 'https://api.ucdn.com/v4/livestreaming/delete_restream?zone_name=any-zone-name&restream_name=first-restream&transcoding_name=my-transcoding&token=acf0230d03f5b71d7252e336106f7338'
{
    "message": "Restream deleted succesfully."
}

Get all livestreaming zones

Returns a list with all of your livestream zones.
GET https://api.ucdn.com/v4/livestreaming/get_zones?[zone_name=...]
This request returns the following information
Name Type Description
account_id integer Your account id
zone_id integer The newly created zone's id
config array Fetched zone config
This request returns one of the following messages
Status Type Description
200 string A list of livestream zones
401 string User api key not specified
532 string An error message
This request expects the following parameters
Name Type Validation Default Description
zone_name string Existing zone name This parameter is optional. The name of the zone.




Examples

curl -X GET "https://api.ucdn.com/v4/livestreaming/get_zones/?zone_name=any-zone-name&token=acf0230d03f5b71d7252e336106f7338"
[
    {
        "account_id": 11,
        "zone_id": 1,
        "config": {
            "name": "test_livestream",
            "publish_pop": "US-DAL",
            "enable_http_access": true,
            "upload": {
                "on": false,
                "max_file_duration_mins": 30
            },
            "dvr": {
                "on": false
            },
            "streams": {
                "base": {
                    "type": "base",
                    "transcode": [],
                    "upload": {
                        "on": false
                    },
                    "restreams": {
                        "c1a430c40d200d4015b1": {
                            "on": true,
                            "name": "test_base_restream",
                            "url": "rtmp:\/\/baserestream.com",
                            "key": "mlliasjdakbdakosixakdsfnalfjaf"
                        }
                    }
                },
                "360p-30": {
                    "type": "sub",
                    "transcode": {
                        "on": true,
                        "v_c": "h264",
                        "v_fps": 30,
                        "v_prof": "high",
                        "v_w": 640,
                        "v_h": 360,
                        "a_c": "aac",
                        "v_br": 500000,
                        "preset": "medium",
                        "a_br": 128000,
                        "v_kf": 2,
                        "v_cq": 23,
                        "f_mr": 550000
                    },
                    "upload": {
                        "on": false
                    },
                    "restreams": {
                        "179fb1a3a3a2b222cfe6": {
                            "on": true,
                            "name": "test_transc_restream",
                            "url": "rtmp:\/\/transc_restream.com",
                            "key": "lkjiasudkadmaslkjaslfjsalkfmasldkasldasmas"
                        }
                    }
                }
            },
            "publish_domains": [
                {
                    "domain": "11-1-0.lsp.cdn13.com"
                }
            ],
            "streamkey": "4fa7a28adb5b3380b0544d8bb2d9f4ba11ee031c",
            "rtmp_port": "2113",
            "http_port": "2114",
            "publish_rtmp_app": "ulive",
            "play_uri_prefix": "hls\/2b78db2098.ulive",
            "publish_hosts": [
                61
            ]
        }
    }
]

Get livestream events

Returns a list with all of livestreaming events for the zone, grouped by sessions that the events belong to.
GET https://api.ucdn.com/v4/livestreaming/get_events?[zone_name=...]
This request returns the following information
Name Type Description
events array A list of livestreaming events for the given zone
This request returns one of the following messages
Status Type Description
200 string A list of livestreaming events
400 string An error message
401 string User api key not specified
532 string An error message
This request expects the following parameters
Name Type Validation Default Description
zone_name string required The name of the zone.
type string Filter events by the type of event. Valid types are 'publish', 'transcode', 'restream', 'upload'.
session_id string/integer Include events from all streams within a specific session. Useful for retrieving grouped events related to the same session.
stream_id string/integer Filter events to include only those that match the given stream ID.
start_ts timestamp/integer Filter events to include only those that have started on or after this timestamp.
stop_ts timestamp/integer Filter events to include only those that have stopped on or before this timestamp.




Examples

curl -X GET "https://api.ucdn.com/v4/livestreaming/get_events?zone_name=any-zone-name&token=acf0230d03f5b71d7252e336106f7338"
{
    "events": {
        "33a4e61a9f151497c9a92200cb75a2a7": [
            {
                "id": "1",
                "session_id": "33a4e61a9f151497c9a92200cb75a2a7",
                "session_group_id": "7c7728bdcce89cc609fee3c922746780",
                "stream_id": "base",
                "sub_id": "base",
                "event": "publish",
                "start_ts": "1688716033",
                "stop_ts": "0",
                "host_id": "1479",
                "pop_id": "4",
                "meta_info": {
                    "dvr": {
                        "on": false
                    }
                }
            },
            {
                "id": "2",
                "session_id": "33a4e61a9f151497c9a92200cb75a2a7",
                "session_group_id": "7c7728bdcce89cc609fee3c922746780",
                "stream_id": "360p-30",
                "sub_id": "base",
                "event": "transcode",
                "start_ts": "1688716033",
                "stop_ts": "0",
                "host_id": "1479",
                "pop_id": "4",
                "meta_info": {
                    "v_c": "h264",
                    "v_fps": 60,
                    "v_prof": "main",
                    "v_w": 1920,
                    "v_h": 1080,
                    "a_c": "aac",
                    "v_br": 3000000,
                    "preset": "medium",
                    "a_br": 128000,
                    "v_kf": 2,
                    "v_cq": 23,
                    "f_mr": 3300001
                }
            }
        ]
    }
}

Get current active session

Fetch information for the active livestreaming session. Contains timestamps of when it started and ended. If the session is ongoing the end timestamp is '0'
GET https://api.ucdn.com/v4/livestreaming/get_active_session?zone_name=...include_session_group=true|false
This request returns the following information
Name Type Description
* array A list of active sessions for the given zone
This request returns one of the following messages
Status Type Description
200 string Information about the requested livestreaming session
400 string An error message
401 string User api key not specified
532 string An error message
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name The name of the zone.
include_session_group bool Include session_group info in the response.




Examples

curl -X GET "https://api.ucdn.com/v4/livestreaming/get_active_session?zone_name=any-zone-name&include_session_group=true&token=acf0230d03f5b71d7252e336106f7338"
{
    "1": {
        "id": "ec0331bcfee0a6e3165063bc952cdb66",
        "session_group_id": "2b41dd9f1dccf81fc0ef56842635dd55",
        "transcode": {
            "first-transcode": {
                "base": {
                    "id": "8",
                    "session_id": "ec0331bcfee0a6e3165063bc952cdb66",
                    "account_id": "1",
                    "event": "transcode",
                    "start_ts": "1695126124",
                    "stop_ts": "0",
                    "host_id": "1479",
                    "pop_id": "4",
                    "meta_info": {
                        "v_c": "h264",
                        "v_fps": 60,
                        "v_prof": "main",
                        "v_w": 1920,
                        "v_h": 1080,
                        "a_c": "aac",
                        "v_br": 3000000,
                        "preset": "medium",
                        "a_br": 128000,
                        "v_kf": 2,
                        "v_cq": 23,
                        "f_mr": 3300001
                    }
                }
            },
            "second-transcode": {
                "base": {
                    "id": "7",
                    "session_id": "ec0331bcfee0a6e3165063bc952cdb66",
                    "account_id": "1",
                    "event": "transcode",
                    "start_ts": "1695126124",
                    "stop_ts": "0",
                    "host_id": "1479",
                    "pop_id": "4",
                    "meta_info": {
                        "v_c": "h264",
                        "v_fps": 60,
                        "v_prof": "main",
                        "v_w": 1920,
                        "v_h": 1080,
                        "a_c": "aac",
                        "v_br": 3000000,
                        "preset": "medium",
                        "a_br": 128000,
                        "v_kf": 2,
                        "v_cq": 23,
                        "f_mr": 3300001
                    }
                }
            }
        },
        "publish": {
            "base": {
                "base": {
                    "id": "6",
                    "session_id": "ec0331bcfee0a6e3165063bc952cdb66",
                    "account_id": "1",
                    "event": "publish",
                    "start_ts": "1695126124",
                    "stop_ts": "0",
                    "host_id": "1479",
                    "pop_id": "4",
                    "meta_info": {
                        "dvr": {
                            "on": true,
                            "session_distinction_interval_mins": "240",
                            "max_window_duration_mins": "60",
                            "keep_full_playlist": false
                        }
                    }
                }
            }
        },
        "statuses": {
            "streams": {
                "base": {
                    "status": "live"
                },
                "first-transcode": {
                    "status": "live"
                },
                "second-transcode": {
                    "status": "live"
                }
            }
        },
        "session_group_active": true
    }
}

Get session group

Fetch session group information. Contains timestamps of when it started and ended. If the session is ongoing the end timestamp is '0'
GET https://api.ucdn.com/v4/livestreaming/get_session_group?[zone_name=...]&[session_group_id=...]
This request returns the following information
Name Type Description
session_group_id string ID of the requested DVR session
account_id string ID of the ZONE
start_ts string UNIX timestamp of when the requested DVR session started
stop_ts string UNIX timestamp of when the requested DVR session ended
This request returns one of the following messages
Status Type Description
200 string Information about the requested session group, contains timestamps of when it started and ended. If the session is ongoing the end timestamp is '0'
400 string An error message
401 string User api key not specified
532 string An error message
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name The name of the zone.
session_group_id integer required Existing session group id The id of this sessoin group.




Examples

curl -X GET " https://api.ucdn.com/v4/livestreaming/get_session_group?zone_name=any-zone-name&session_group_id=621c21d50c340a26f6ea8806b82aea87&token=acf0230d03f5b71d7252e336106f7338"
{
    "session_group_id": "7c7728bdcce89cc609fee3c922746780",
    "account_id": "1",
    "start_ts": "1688716033",
    "stop_ts": "0"
}

Reset active session group

Reset a specified session group. If the session group is ongoing - set its end timestamp to now, otherwise does nothing
POST https://api.ucdn.com/v4/livestreaming/post_active_session_group_reset?[zone_name=...]
This request returns one of the following messages
Status Type Description
200 string Success message
400 string An error message
401 string User api key not specified
532 string An error message
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name The name of the zone.




Examples

curl -X POST "https://api.ucdn.com/v4/livestreaming/post_active_session_group_reset?zone_name=any-zone-name&token=acf0230d03f5b71d7252e336106f7338" --header "Content-Type: application/json" --data ''
{
    "message": "OK"
}

Activate livestreaming zone

Enable or disable zone.
PATCH https://api.ucdn.com/v4/livestreaming/toggle_zone_status?[zone_name=...]
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Successfully enabled/disabled zone.
401 string Input parameter problem - invalid token, invalid zone name
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.
enable bool Only one paramter (enable/disable) should be passed.   This parameter enables the zone.




Examples

curl -X PATCH 'https://api.ucdn.com/v4/livestreaming/toggle_zone_status?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{"enable": true}'
{
    "message": "Zone enabled"
}

Deactivate livestreaming zone

Enable or disable zone.
PATCH https://api.ucdn.com/v4/livestreaming/toggle_zone_status?[zone_name=...]
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Successfully enabled/disabled zone.
401 string Input parameter problem - invalid token, invalid zone name
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.
disable bool Only one paramter (enable/disable) should be passed.   This parameter disables the zone.




Examples

curl -X PATCH 'https://api.ucdn.com/v4/livestreaming/toggle_zone_status?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338' \
  --header "Content-Type: application/json" \
  --data '{"disable": true}'
{
    "message": "Zone disabled"
}

Activate letsencrypt

Activates letsencrypt for zone with given name.
POST https://api.ucdn.com/v4/livestreaming/activate_letsencrypt?zone_name=...
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Successfully activated letsencrypt.
401 string Input parameter problem - invalid token, invalid zone name.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.




Examples

curl -X POST 'https://api.ucdn.com/v4/livestreaming/activate_letsencrypt?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338'
{
    "message": "Successfully activated letsencrypt."
}

Deactivate letsencrypt

Deactivates letsencrypt for zone with given name.
POST https://api.ucdn.com/v4/livestreaming/deactivate_letsencrypt?zone_name=...
This request returns the following information
Name Type Description
message string The message returned from the api call.
This request returns one of the following messages
Status Type Description
200 string Successfully deactivated letsencrypt.
401 string Input parameter problem - invalid token, invalid zone name.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.




Examples

curl -X DELETE 'https://api.ucdn.com/v4/livestreaming/deactivate_letsencrypt?zone_name=test-zone&token=acf0230d03f5b71d7252e336106f7338'
{
    "message": "Successfully deactivated letsencrypt."
}

Get letsencrypt status

Returns a config of the zone with given name.
GET https://api.ucdn.com/v4/livestreaming/check_letsencrypt_status?zone_name=...
This request returns the following information
Name Type Description
letsencrypt_active string Current letsencrypt status.
This request returns one of the following messages
Status Type Description
200 string Letsencrypt status.
401 string An error message. Problem with the authentication. Invalid token.
404 string Zone with given name does not exists.
This request expects the following parameters
Name Type Validation Default Description
zone_name string required Existing zone name   This parameter is required.




Examples

curl -X GET 'https://api.ucdn.com/v4/livestreaming/check_letsencrypt_status?token=acf0230d03f5b71d7252e336106f7338'

{
    "letsencrypt_active": "0"
}