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/v2/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.

Swagger Specification

You can see the swagger specification of our API here. Using the swagger tools you can create your own API clients in many programming languages. We've setup this web client for our API using the swagger tools. You can use it as a learning resource or a debugging tool.

Usage report

Returns served bytes and requests satisfied for particular zone or this account as a whole when `zone_id` is omitted or 0.
GET https://api.ucdn.com/v2/reports/[{zone_id}]/[?date_from=...][&date_to=...]
This item returns the following information
Name Flags 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 Flags Description
200 json data
400 json Fail message
404 json Fail message
532 json Fail message
This request expects the following parameters
Name Flags Validation Default Description
date_from required
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 required
string
GMT date in format YYYY-MM-DD or a Unix timestamp Now To which date to generate the reports. Exclusive.

Examples

curl --include "https://api.ucdn.com/v2/reports/1/?date_from=2015-08-12&date_to=2015-08-13&token=a1cceef964910f10947c09257e87ca40"
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
}

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/v2/reports/hits/http2[?from=...][&to=...][&zones=1,2,3][&by=hour]
This item returns the following information
Name Flags Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for 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 Flags Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Flags 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 id or a list of zone ids separated with comma. Example: 1,2,3,4 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.
by string
One of to following: 5min, hour, day hour Group the reported elements in slots with particular time length.

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/v2/reports/bytes/ssl[?from=...][&to=...][&zones=1,2,3][&by=hour]
This item returns the following information
Name Flags Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for 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 Flags Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Flags 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 id or a list of zone ids separated with comma. Example: 1,2,3,4 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.
by string
One of to following: 5min, hour, day hour Group the reported elements in slots with particular time length.

Hits SSL

Returns total number of hits. The data is for particular time period and grouped in time intervals.
GET https://api.ucdn.com/v2/reports/hits/ssl[?from=...][&to=...][&zones=1,2,3][&by=hour]
This item returns the following information
Name Flags Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for 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 Flags Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Flags 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 id or a list of zone ids separated with comma. Example: 1,2,3,4 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.
by string
One of to following: 5min, hour, day hour Group the reported elements in slots with particular time length.

Hits

Returns statistics with the number of HTTP hits
GET https://api.ucdn.com/v2/reports/hits/[?from=...][&to=...][&zones=1,2,3][&by=hour]
This item returns the following information
Name Flags Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for 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 Flags Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Flags 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 id or a list of zone ids separated with comma. Example: 1,2,3,4 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.
by string
One of to following: 5min, hour, day hour Group the reported elements in slots with particular time length.

Examples

curl --include "https://api.ucdn.com/v2/reports/hits/?token=a1cceef964910f10947c09257e87ca40"
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
        ]
    ]
}

Countries

Statistics for the traffic destination by country. It shows hits and bytes served to this country.
GET https://api.ucdn.com/v2/reports/countries/[?from=...][&to=...][&zones=1,2,3][&by=hour][&countries=de,ru,jp]
This item returns the following information
Name Flags Description
elements object A key-value pairs. The key in the pair is a ISO 3166-1 country code. The value an array with the generated data. Every element in the array represents a time slot. See the `element_description` field for 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 Flags Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Flags 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 id or a list of zone ids separated with comma. Example: 1,2,3,4 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.
by string
One of to following: 5min, hour, day hour Group the reported elements in slots with particular time length.
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.

Examples

curl --include "https://api.ucdn.com/v2/reports/countries/?token=a1cceef964910f10947c09257e87ca40"
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": 3600,
    "elements": {
        "CH": [
            [
                1439290800,
                0,
                0
            ],
            [
                1439294400,
                384465,
                19224985
            ],
            [
                1439298000,
                373860,
                18694275
            ],
            [
                1439301600,
                367775,
                18390470
            ],
            [
                1439305200,
                367080,
                18355200
            ],
            [
                1439308800,
                373990,
                18700850
            ],
            [
                1439312400,
                395555,
                19779515
            ],
            [
                1439316000,
                428855,
                21444440
            ],
            [
                1439319600,
                464220,
                23212285
            ],
            [
                1439323200,
                477890,
                23896410
            ],
            [
                1439326800,
                511555,
                25579590
            ],
            [
                1439330400,
                499925,
                24997345
            ],
            [
                1439334000,
                477660,
                23884405
            ],
            [
                1439337600,
                453815,
                22691905
            ],
            [
                1439341200,
                452635,
                22632990
            ],
            [
                1439344800,
                488485,
                24425460
            ],
            [
                1439348400,
                530235,
                26512670
            ],
            [
                1439352000,
                514665,
                25734655
            ],
            [
                1439355600,
                434510,
                21726715
            ],
            [
                1439359200,
                342845,
                17144165
            ],
            [
                1439362800,
                297270,
                14864850
            ],
            [
                1439366400,
                292910,
                14646740
            ],
            [
                1439370000,
                312875,
                15645535
            ],
            [
                1439373600,
                290240,
                14513000
            ],
            [
                1439377200,
                0,
                0
            ]
        ],
        "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
            ],
            [
                1439326800,
                568410,
                28421770
            ],
            [
                1439330400,
                555470,
                27774840
            ],
            [
                1439334000,
                530735,
                26538230
            ],
            [
                1439337600,
                504230,
                25213225
            ],
            [
                1439341200,
                502930,
                25147775
            ],
            [
                1439344800,
                542765,
                27139400
            ],
            [
                1439348400,
                589135,
                29458515
            ],
            [
                1439352000,
                571850,
                28594060
            ],
            [
                1439355600,
                482785,
                24140800
            ],
            [
                1439359200,
                380950,
                19049070
            ],
            [
                1439362800,
                330290,
                16516505
            ],
            [
                1439366400,
                325450,
                16274160
            ],
            [
                1439370000,
                347645,
                17383935
            ],
            [
                1439373600,
                322490,
                16125560
            ],
            [
                1439377200,
                0,
                0
            ]
        ],
        "MX": [
            [
                1439290800,
                0,
                0
            ],
            [
                1439294400,
                261435,
                13072990
            ],
            [
                1439298000,
                254210,
                12712090
            ],
            [
                1439301600,
                250090,
                12505515
            ],
            [
                1439305200,
                249605,
                12481520
            ],
            [
                1439308800,
                254305,
                12716565
            ],
            [
                1439312400,
                268970,
                13450060
            ],
            [
                1439316000,
                291615,
                14582210
            ],
            [
                1439319600,
                315660,
                15784340
            ],
            [
                1439323200,
                324955,
                16249550
            ],
            [
                1439326800,
                347845,
                17394115
            ],
            [
                1439330400,
                339935,
                16998190
            ],
            [
                1439334000,
                324800,
                16241380
            ],
            [
                1439337600,
                308580,
                15430480
            ],
            [
                1439341200,
                307775,
                15390430
            ],
            [
                1439344800,
                332155,
                16609305
            ],
            [
                1439348400,
                360550,
                18028610
            ],
            [
                1439352000,
                349965,
                17499560
            ],
            [
                1439355600,
                295450,
                14774155
            ],
            [
                1439359200,
                233140,
                11658020
            ],
            [
                1439362800,
                202135,
                10108085
            ],
            [
                1439366400,
                199170,
                9959775
            ],
            [
                1439370000,
                212745,
                10638965
            ],
            [
                1439373600,
                197355,
                9868830
            ],
            [
                1439377200,
                0,
                0
            ]
        ],
        "RU": [
            [
                1439290800,
                0,
                0
            ],
            [
                1439294400,
                326800,
                16341240
            ],
            [
                1439298000,
                317775,
                15890115
            ],
            [
                1439301600,
                312615,
                15631895
            ],
            [
                1439305200,
                312020,
                15601915
            ],
            [
                1439308800,
                317880,
                15895725
            ],
            [
                1439312400,
                336225,
                16812575
            ],
            [
                1439316000,
                364530,
                18227770
            ],
            [
                1439319600,
                394585,
                19730440
            ],
            [
                1439323200,
                406205,
                20311945
            ],
            [
                1439326800,
                434830,
                21742650
            ],
            [
                1439330400,
                424925,
                21247740
            ],
            [
                1439334000,
                406010,
                20301735
            ],
            [
                1439337600,
                385735,
                19288100
            ],
            [
                1439341200,
                384725,
                19238045
            ],
            [
                1439344800,
                415190,
                20761630
            ],
            [
                1439348400,
                450685,
                22535765
            ],
            [
                1439352000,
                437460,
                21874445
            ],
            [
                1439355600,
                369335,
                18467715
            ],
            [
                1439359200,
                291435,
                14572525
            ],
            [
                1439362800,
                252685,
                12635120
            ],
            [
                1439366400,
                248960,
                12449735
            ],
            [
                1439370000,
                265945,
                13298700
            ],
            [
                1439373600,
                246695,
                12336040
            ],
            [
                1439377200,
                0,
                0
            ]
        ],
        "US": [
            [
                1439290800,
                0,
                0
            ],
            [
                1439294400,
                449685,
                22485365
            ],
            [
                1439298000,
                437260,
                21864645
            ],
            [
                1439301600,
                430150,
                21509335
            ],
            [
                1439305200,
                429335,
                21468070
            ],
            [
                1439308800,
                437415,
                21872345
            ],
            [
                1439312400,
                462655,
                23133930
            ],
            [
                1439316000,
                501595,
                25081230
            ],
            [
                1439319600,
                542950,
                27148880
            ],
            [
                1439323200,
                558955,
                27949025
            ],
            [
                1439326800,
                598325,
                29917650
            ],
            [
                1439330400,
                584710,
                29236665
            ],
            [
                1439334000,
                558665,
                27934990
            ],
            [
                1439337600,
                530770,
                26540240
            ],
            [
                1439341200,
                529400,
                26471355
            ],
            [
                1439344800,
                571320,
                28567790
            ],
            [
                1439348400,
                620150,
                31008980
            ],
            [
                1439352000,
                601955,
                30099015
            ],
            [
                1439355600,
                508200,
                25411365
            ],
            [
                1439359200,
                400995,
                20051655
            ],
            [
                1439362800,
                347695,
                17385790
            ],
            [
                1439366400,
                342585,
                17130695
            ],
            [
                1439370000,
                365945,
                18298885
            ],
            [
                1439373600,
                339460,
                16974280
            ],
            [
                1439377200,
                0,
                0
            ]
        ],
        "VN": [
            [
                1439290800,
                0,
                0
            ],
            [
                1439294400,
                196060,
                9804735
            ],
            [
                1439298000,
                190655,
                9534070
            ],
            [
                1439301600,
                187550,
                9379120
            ],
            [
                1439305200,
                187185,
                9361135
            ],
            [
                1439308800,
                190730,
                9537415
            ],
            [
                1439312400,
                201715,
                10087535
            ],
            [
                1439316000,
                218700,
                10936660
            ],
            [
                1439319600,
                236740,
                11838255
            ],
            [
                1439323200,
                243710,
                12187150
            ],
            [
                1439326800,
                260885,
                13045570
            ],
            [
                1439330400,
                254950,
                12748630
            ],
            [
                1439334000,
                243590,
                12181035
            ],
            [
                1439337600,
                231425,
                11572860
            ],
            [
                1439341200,
                230825,
                11542820
            ],
            [
                1439344800,
                249110,
                12456965
            ],
            [
                1439348400,
                270395,
                13521445
            ],
            [
                1439352000,
                262465,
                13124655
            ],
            [
                1439355600,
                221585,
                11080610
            ],
            [
                1439359200,
                174850,
                8743510
            ],
            [
                1439362800,
                151590,
                7581045
            ],
            [
                1439366400,
                149365,
                7469825
            ],
            [
                1439370000,
                159550,
                7979210
            ],
            [
                1439373600,
                148010,
                7401615
            ],
            [
                1439377200,
                0,
                0
            ]
        ]
    }
}

Storages

Returns the used UCDN storage in bytes.
GET https://api.ucdn.com/v2/reports/storages/[?from=...][&to=...][&by=hour]
This item returns the following information
Name Flags Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for 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 Flags Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Flags 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 --include "https://api.ucdn.com/v2/reports/storages/?token=a1cceef964910f10947c09257e87ca40"
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
        ]
    ]
}

Cache hits

Returns information for cache hits and misses
GET https://api.ucdn.com/v2/reports/cache/hits/[?from=...][&to=...][&zones=1,2,3][&by=hour]
This item returns the following information
Name Flags Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for 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 Flags Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Flags 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 id or a list of zone ids separated with comma. Example: 1,2,3,4 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.
by string
One of to following: 5min, hour, day hour Group the reported elements in slots with particular time length.

Examples

curl --include "https://api.ucdn.com/v2/reports/cache/hits/?token=a1cceef964910f10947c09257e87ca40"
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2015 11:04:50 GMT
Server: Apache
Vary: Accept-Encoding
Content-Length: 960
Content-Type: application/json; charset=utf-8

{
    "element_description": [
        "unix timestamp of the time slot start",
        "cache hits",
        "cache misses"
    ],
    "element_duration": 3600,
    "elements": [
        [
            1439290800,
            0,
            0
        ],
        [
            1439294400,
            5396496593,
            899416094
        ],
        [
            1439298000,
            5247521743,
            874586953
        ],
        [
            1439301600,
            5162247017,
            860374498
        ],
        [
            1439305200,
            5152343919,
            858723984
        ],
        [
            1439308800,
            5249369554,
            874894920
        ],
        [
            1439312400,
            5552153129,
            925358850
        ],
        [
            1439316000,
            6019501815,
            1003250298
        ],
        [
            1439319600,
            6515737416,
            1085956233
        ],
        [
            1439323200,
            6707771973,
            1117961992
        ],
        [
            1439326800,
            7180243032,
            1196707169
        ],
        [
            1439330400,
            7016808093,
            1169468011
        ],
        [
            1439334000,
            6704402747,
            1117400453
        ],
        [
            1439337600,
            6369665676,
            1061610943
        ],
        [
            1439341200,
            6353130634,
            1058855104
        ],
        [
            1439344800,
            6856277563,
            1142712923
        ],
        [
            1439348400,
            7442160406,
            1240360064
        ],
        [
            1439352000,
            7223771374,
            1203961891
        ],
        [
            1439355600,
            6098735079,
            1016455844
        ],
        [
            1439359200,
            4812403956,
            802067323
        ],
        [
            1439362800,
            4172597099,
            695432846
        ],
        [
            1439366400,
            4111374288,
            685229044
        ],
        [
            1439370000,
            4391737590,
            731956260
        ],
        [
            1439373600,
            4073831201,
            678971863
        ],
        [
            1439377200,
            0,
            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/v2/reports/bytes/http2[?from=...][&to=...][&zones=1,2,3][&by=hour]
This item returns the following information
Name Flags Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for 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 Flags Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Flags 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 id or a list of zone ids separated with comma. Example: 1,2,3,4 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.
by string
One of to following: 5min, hour, day hour Group the reported elements in slots with particular time length.

Status codes

Statistics for HTTP status codes.
GET https://api.ucdn.com/v2/reports/status/codes/[?from=...][&to=...][&zones=1,2,3][&by=hour][&code=301]
This item returns the following information
Name Flags Description
elements object A key-value pairs. The key in the pair is a HTTP status code. The value an array with the generated data. Every element in the array represents a time slot. See the `element_description` field for 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 Flags Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Flags 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 id or a list of zone ids separated with comma. Example: 1,2,3,4 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.
by string
One of to following: 5min, hour, day hour 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.

Examples

curl --include "https://api.ucdn.com/v2/reports/status/codes/?from=2015-08-12&to=2015-08-13&token=a1cceef964910f10947c09257e87ca40&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
            ]
        ]
    }
}

Bytes served

Returns stats with bytes served. The data is for particular time period and grouped in time intervals.
GET https://api.ucdn.com/v2/reports/bytes/[?from=...][&to=...][&zones=1,2,3][&by=hour]
This item returns the following information
Name Flags Description
elements array An array with the generated data. Every element in the array represents a time slot. See the `element_description` field for 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 Flags Description
200 object Reports data
400 string Fail message
532 string Fail message
This request expects the following parameters
Name Flags 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 id or a list of zone ids separated with comma. Example: 1,2,3,4 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.
by string
One of to following: 5min, hour, day hour Group the reported elements in slots with particular time length.

Examples

curl --include "https://api.ucdn.com/v2/reports/bytes/?from=2015-08-12&to=2015-08-13&token=a1cceef964910f10947c09257e87ca40&zones=1,3"
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
        ]
    ]
}

Check user credentials

Checks if a 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/v2/check/login/
This item returns the following information
Name Flags 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 Flags Description
200 string Message
401 string Invalid login credentials
532 string An error message
This request expects the following parameters
Name Flags 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 --include --request POST "https://api.ucdn.com/v2/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"
}

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/v2/certificates
This item returns the following information
Name Flags Description
*** array All certificates for this account.
This request returns one of the following messages
Status Flags Description
200 array success message

Examples

curl --include --request GET "https://api.ucdn.com/v2/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/v2/certificate/{crt_id}
This item returns the following information
Name Flags 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 Flags Description
200 object success message
404 string certificate did not exists

Examples

curl --include --request GET "https://api.ucdn.com/v2/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/v2/certificate/
This request returns one of the following messages
Status Flags Description
200 string success message
409 string Error message
This request expects the following parameters
Name Flags Validation Default Description
hostname string
required
It should be valid host name. Such as domain or IP. Examples: example.com, 234.234.234.234, *.example.com Show even if the zone has been deleted.
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 --include --request POST "https://api.ucdn.com/v2/certificate/?token=acf0230d03f5b71d7252e336106f7338" --header "Content-Type: application/json" -d '{"hostname": "cdn2.section9.com", "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/v2/certificate/{crt_id}
This request returns one of the following messages
Status Flags Description
200 string success message
404 string certificate did not exists

Examples

curl --include --request DELETE "https://api.ucdn.com/v2/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"
}

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/v2/storages
This item returns the following information
Name Flags 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 Flags Description
200 array Array with information for all storages
532 json Error message

Examples

curl --include --request GET "https://api.ucdn.com/v2/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
    }
]

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 particular UCDN storage.
POST https://api.ucdn.com/v2/storage
This item returns the following information
Name Flags Description
id int The id of the created storage
status string Operation success message
This request returns one of the following messages
Status Flags Description
200 json Message for successful creation
532 json Error message
504 json Storage backend failed
This request expects the following parameters
Name Flags 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 --include --request POST "https://api.ucdn.com/v2/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
}

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/v2/storages
This item returns the following information
Name Flags 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 Flags 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 Flags Validation Default Description
region string
required
"europe" or "north-america". The region in which will storages 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 --include --request PATCH "https://api.ucdn.com/v2/storages/?token=jasdhjshad234234jh" --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/v2/storage/{id}
This item returns the following information
Name Flags 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 Flags Description
200 json Information for this storage
404 json No active storage found message
532 json Error message

Examples

curl --include --request GET "https://api.ucdn.com/v2/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 utilisation information for this storage. How big it is and how many objects there are.
GET https://api.ucdn.com/v2/storage/{id}/size
This item returns the following information
Name Flags Description
bytes int Number of bytes consumed on this storage
objects int Number files and folders on this storage
This request returns one of the following messages
Status Flags Description
200 json Consumed size
404 json No active storage found message
532 json Error message

Examples

curl --include --request GET "https://api.ucdn.com/v2/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 an 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/v2/storage/{id}
This request returns one of the following messages
Status Flags 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 --include --request DELETE "https://api.ucdn.com/v2/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"
}

Sync storages

You can sychronize two storages with this API call. Once synced the two storages will be identical. Adding or deleting files from one of them will result in the same files being added or deleted in the syched storage. This is true the both directions. In addition cache zones which use either of them as an origin will start to use the closest one automatically. Note that adding or deleting files will have a minimum delay before being replicated on the synched origin.
PATCH https://api.ucdn.com/v2/storage/{id}/sync
This request returns one of the following messages
Status Flags Description
200 json Message for successful synchronization
532 json Error message
504 json Storage backend failed
This request expects the following parameters
Name Flags Validation Default Description
synchronize_with integer
required
Valid id of an other storage container. Identifies the container with which this one will be synchronized.

Examples

curl --include --request PATCH "https://api.ucdn.com/v2/storage/1/sync/?token=acf0230d03f5b71d7252e336106f7338" --header "Content-Type: application/json" -d '{"synchronize_with": 2}'
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:10:32 GMT
Server: Apache
X-Powered-By: PHP/5.6.8-pl0-gentoo
Vary: Accept-Encoding
Content-Length: 40
Content-Type: application/json; charset=utf-8

{
    "message": "Storages were synchronized"
}

Remove synchronization

Remove synchronization between storages while leaving the both of the them the same in any other way. This means you will have two separate storages after this API call. You need to call this method only once for just one of the two synchronized storages.
DELETE https://api.ucdn.com/v2/storage/{id}/sync
This request returns one of the following messages
Status Flags Description
200 json Message for success
404 json No such storage found message
532 json Error message
504 json Storage backend failed

Examples

curl --include --request DELETE --header "X-UCDN-Token: jasdhjshad234234jh" "https://api.ucdn.com/v2/storage/2/sync/"
HTTP/1.1 200 OK
Date: Tue, 24 Nov 2015 11:09:05 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.14
Content-Length: 63
Content-Type: application/json; charset=utf-8

{
    "message": "Synchronization between storages has been removed"
}

Purge files

Removes files from a cache zone. This call will create a purge job which will be executed atomically.
POST https://api.ucdn.com/v2/purge/zone/{zone_id}/
This item returns the following information
Name Flags Description
job_id string The ID of the newly created purge job
This request returns one of the following messages
Status Flags Description
204 json Success message
532 json Fail message
This request expects the following parameters
Name Flags Validation Default Description
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
This item has the following deprecated URIs:
POST https://api.ucdn.com/v2/purge/{zone_id}/

They will be supported as long as it is technically possible. Regardless, consider them deprecated and make sure you are using the new URI.

Examples

curl --include --request POST "https://api.ucdn.com/v2/purge/1/?token=a1cceef964910f10947c09257e87ca40" --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 particular purge job.
GET https://api.ucdn.com/v2/purge/job/{job_id}/
This item returns the following information
Name Flags Description
job_id string The ID of this purge job
files array List of 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 Flags Description
200 string Success message
532 string Fail message
This request expects the following parameters
Name Flags Validation Default Description
job_id string
- A purge job id as returned by the job creation call
This item has the following deprecated URIs:
GET https://api.ucdn.com/v2/purge/{job_id}/

They will be supported as long as it is technically possible. Regardless, consider them deprecated and make sure you are using the new URI.

Examples

curl --include "https://api.ucdn.com/v2/purge/2170dd23decc45691adf28987282d0bc/?token=a1cceef964910f10947c09257e87ca40"
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/v2/purge/[?status=...][&count=...]
This request returns one of the following messages
Status Flags Description
200 array Array with purge jobs
532 string Fail message
This request expects the following parameters
Name Flags Validation Default Description
status string
Supporeted 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/v2/purge/?token=a1cceef964910f10947c09257e87ca40&status=finished"
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/v2/purge/job/{job_id}
This request returns one of the following messages
Status Flags Description
200 string Success message
532 string Fail message
This request expects the following parameters
Name Flags Validation Default Description
job_id string
- A purge job id as returned by the job creation call
This item has the following deprecated URIs:
DELETE https://api.ucdn.com/v2/purge/{job_id}

They will be supported as long as it is technically possible. Regardless, consider them deprecated and make sure you are using the new URI.

Examples

curl --include --request DELETE "https://api.ucdn.com/v2/purge/cd704ed605964e55a2a3c64162f94b05/?token=a1cceef964910f10947c09257e87ca40"
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"
}

Fetch account info

Returns information for your current account.
GET https://api.ucdn.com/v2/account
This item returns the following information
Name Flags 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 Flags Description
200 object Account Information

Examples

curl --include --request GET "https://api.ucdn.com/v2/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 all zones

Returns a list with all of your zones. Every zone in the list is a object with the same informations as the Fetch a zone call.
GET https://api.ucdn.com/v2/zones
This item returns the following information
Name Flags Description
* array A list of your zones
This request returns one of the following messages
Status Flags Description
200 array A list of zones
This request supports the following helpers
Name Description
count Returns the count of your zones

Examples

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

[
    {
        "id": "1",
        "cdn_domain": "a1-121.so.clients.cdn13.com",
        "object_size": "small",
        "is_active": "1",
        "create_ts": "1423139335",
        "update_ts": "1435564990",
        "storage_id": null,
        "error_pages": [],
        "referers": [],
        "geo_filter": [],
        "limit_rate": [],
        "origins": [
            "example.com"
        ],
        "ssl": "no",
        "custom_domains": [
            "cdn.section9.com"
        ],
        "cache_reuse_from": null,
        "expiration": 3600,
        "ssl_type": "shared",
        "origins_host_header": "example.com",
        "origins_auth_username": null,
        "origins_auth_password": null,
        "hash_secret": null,
        "hash_algorithm": null,
        "hash_ttl": null,
        "reconfig_status": "reconfiguring"
    },
    {
        "id": "3",
        "cdn_domain": "a3-121.so.clients.cdn13.com",
        "object_size": "small",
        "is_active": "1",
        "create_ts": "1429620438",
        "update_ts": "1429620438",
        "storage_id": null,
        "error_pages": [],
        "referers": [],
        "geo_filter": [],
        "limit_rate": [],
        "origins": [
            "so00-nl0.cdn-project.info"
        ],
        "ssl": "no",
        "custom_domains": [],
        "cache_reuse_from": null,
        "expiration": null,
        "ssl_type": "shared",
        "origins_host_header": "client_1.ucdn.com",
        "origins_auth_username": null,
        "origins_auth_password": null,
        "hash_secret": null,
        "hash_algorithm": null,
        "hash_ttl": null,
        "reconfig_status": "ready"
    },
    {
        "id": "4",
        "cdn_domain": "a4-121.so.clients.cdn13.com",
        "object_size": "small",
        "is_active": "1",
        "create_ts": "1435316148",
        "update_ts": "1435316148",
        "storage_id": null,
        "error_pages": [],
        "referers": [],
        "geo_filter": [],
        "limit_rate": [],
        "origins": [
            "inv.bg"
        ],
        "ssl": "no",
        "custom_domains": [],
        "cache_reuse_from": null,
        "expiration": null,
        "ssl_type": "shared",
        "origins_host_header": "inv.bg",
        "origins_auth_username": null,
        "origins_auth_password": null,
        "hash_secret": null,
        "hash_algorithm": null,
        "hash_ttl": null,
        "reconfig_status": "ready"
    }
]

Fetch a zone

Returns information for a particular cache zone as an object. Few of the fields can be `null`. This indicates that the feature they signify is off. For example `origins_host_header` set to `null` means that no special Host header is sent to your origins but the one from the request is used.
GET https://api.ucdn.com/v2/zone/{zone_id}
This item returns the following information
Name Flags Description
id int This zone ID
cdn_domain string Unique domain name with which you can access your files
object_size string File size for this zone. Small (= 20MB)
is_active int Whether this zone is enabled (1) or disabled (0)
error_pages object Custom error pages activated for this zone
referers array Allowed referers for files in this zone
geo_filter object Geo filtering configuration
limit_rate object Limit rates configuration
origins array Origin server(s). A special value "ucdn_storage" is returned when this zone uses the UCDN storage
origins_host_header string The heade UCDN uses while accessing your origin server
origins_auth_username string Origin authentication username
origins_auth_password string Origin authentication password
ssl string Whether or not shared ssl is enabled
ssl_type string What kind of ssl certificate is used - "own" or "shared"
custom_domains array Array with custom domains for this zone. They must be CNAMEs this zone's cdn_domain
cache_reuse_from int zone_id of the zone this account reuses cache from
expiration int Forced expiration time of files in this zone
hash_secret string Security token's secret key
hash_algorithm string They hashing algorithm with which the security token is hashed
hash_ttl int Number of seconds for which URLs generated with security token work
create_ts int Unix time of the moment this zone was created
update_ts int Unix time. Last time this zone was edited in any way
storage_id int If this zone uses UCDN Storage as its origin, this is the ID of this storage
This request returns one of the following messages
Status Flags Description
200 object Information for thsi zone

Examples

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

{
    "id": "1",
    "cdn_domain": "a1-121-so.ssl.cdn13.com",
    "object_size": "small",
    "is_active": "1",
    "create_ts": "1423139335",
    "update_ts": "1435564989",
    "storage_id": null,
    "error_pages": {},
    "referers": [],
    "geo_filter": [],
    "limit_rate": [],
    "origins": [
        "example.com"
    ],
    "ssl": "yes",
    "custom_domains": [
        "cdn.section9.com"
    ],
    "cache_reuse_from": null,
    "expiration": 3600,
    "ssl_type": "own",
    "origins_host_header": "example.com",
    "origins_auth_username": null,
    "origins_auth_password": null,
    "hash_secret": null,
    "hash_algorithm": null,
    "hash_ttl": null,
    "reconfig_status": "reconfiguring"
}

Create a new zone

With this API call you can create a new cache zone. The only required parameters are `origins` and `object_size`. With the first one you can control the origin of the files for this cache zone and with the second you tell us if they are big files or small. Picking good `object_size` may be the difference between fast cache and almost no cache at all. For every other parameter check their description.
POST https://api.ucdn.com/v2/zone
This item returns the following information
Name Flags Description
zone_id int The ID of the newly created zone
This request returns one of the following messages
Status Flags Description
200 json The new zone's id
532 json An error message
This request expects the following parameters
Name Flags Validation Default Description
object_size required
string
big
small
File size for this zone. Small objects are those less than 20MB
origins required
array
string
host[:port],host[:port]...
ucdn_storage
Origins (or upstream) servers or the special value "ucdn_storage" in case you want to use your UCDN Storage
ssl string
yes
no
no Whether to use shared SSL or not.
ssl_type string
own
shared
shared What kind of SSL certificate to be used. Your own or UCDN shared.
ucdn_storage_region string
Name of a storage region returned in /storage/regions europe Only meaningful if origins is "ucdn_storage". Geographical region in which the UCDN storage will be created.
storage_id integer
Existing storage id Only meaningful if origins is "ucdn_storage". Zone will use this storage instead of creating new one.
origins_auth_username string
valid HTTP username HTTP-based authentication username. Ignored when ucdn_storage is used in the origins parameter
origins_auth_password string
valid HTTP password HTTP-based authentication password. Ignored when ucdn_storage is used in the origins parameter
origins_host_header string
valid header string Origin's domain name Host header UCDN will use while accessing your origin. Ignored when ucdn_storage is used in the origins parameter
custom_domains string
array
domain,domain,domain... Custom domains for your zone. They must be CNAMEs to this zone's cdn_domain. This field does not have any effect when using shared SSL.
error_pages string
array
status:url Custom URLs to besed for redirecting from various HTTP error statuses (e.g. 404)
referers string
array
valid domains Allow access only from certain referers
geo_filter_allow string
array
ISO 3166-1 country code Allow access only from certain countries
geo_filter_deny string
array
ISO 3166-1 country code Deny access to certain countries
limit_rate_global string
NNk, e.g. 20k Limit rate for every connection in this zone. It is mutually exclusive with limit_rate_security
limit_rate_security string
on
off
Use security token's limit rate. It is mutually exclusive with limit_rate_global
hash_secret string
valid url query string Access security token, used in conjuction with hash_algorithm and hash_ttl
hash_algorithm string
md5
sha1
Hashing algorithm of the security token
hash_ttl integer
in seconds Time to live of the security token hash
cache_reuse_from integer
valid zone id Zone id of another zone. You cane use it to force this zone into using the other's cache.
expiration integer
in seconds Forced cache expiration in seconds. When this is set expire and cache-control headers from the origin are ignored

Examples

curl --include --request POST "https://api.ucdn.com/v2/zone/?token=acf0230d03f5b71d7252e336106f7338" --header "Content-Type: application/json" -d '{"object_size":"small", "origins": "example.com"}'
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:10:37 GMT
Server: Apache
X-Powered-By: PHP/5.3.10-1ubuntu3.16
X-Cache: miss
Vary: Accept-Encoding
Content-Length: 13
Content-Type: application/json; charset=utf-8

{
    "zone_id": 5
}

Replace a zone configuration

Using this API call you can completely replace a zone configuration. It work just like creating new zone but instead of creating the zone it replaces the configuration for an already existing one. No cache is lost after this call. The only limitation when using this call is that you cannot change the zone object size type.
PUT https://api.ucdn.com/v2/zone/{zone_id}
This request returns one of the following messages
Status Flags Description
200 json Success message
532 json Fail message
This request expects the following parameters
Name Flags Validation Default Description
origins required
array
string
host[:port],host[:port]...
ucdn_storage
Origins (or upstream) servers or the special value "ucdn_storage" in case you want to use your UCDN Storage
ssl string
yes
no
no Whether to use shared SSL or not.
ssl_type string
own
shared
shared What kind of SSL certificate to be used. Your own or UCDN shared.
ucdn_storage_region string
Name of a storage region returned in /storage/regions europe Only meaningful if origins is "ucdn_storage". Geographical region in which the UCDN storage will be created.
storage_id integer
Existing storage id Only meaningful if origins is "ucdn_storage". Zone will use this storage instead of creating new one.
origins_auth_username string
valid HTTP username HTTP-based authentication username. Ignored when ucdn_storage is used in the origins parameter
origins_auth_password string
valid HTTP password HTTP-based authentication password. Ignored when ucdn_storage is used in the origins parameter
origins_host_header string
valid header string Origin's domain name Host header UCDN will use while accessing your origin. Ignored when ucdn_storage is used in the origins parameter
custom_domains string
array
domain,domain,domain... Custom domains for your zone. They must be CNAMEs to this zone's cdn_domain. This field does not have any effect when using shared SSL.
error_pages string
array
status:url Custom URLs to besed for redirecting from various HTTP error statuses (e.g. 404)
referers string
array
valid domains Allow access only from certain referers
geo_filter_allow string
array
ISO 3166-1 country code Allow access only from certain countries
geo_filter_deny string
array
ISO 3166-1 country code Deny access to certain countries
limit_rate_global string
NNk, e.g. 20k Limit rate for every connection in this zone. It is mutually exclusive with limit_rate_security
limit_rate_security string
on
off
Use security token's limit rate. It is mutually exclusive with limit_rate_global
hash_secret string
valid url query string Access security token, used in conjuction with hash_algorithm and hash_ttl
hash_algorithm string
md5
sha1
Hashing algorithm of the security token
hash_ttl integer
in seconds Time to live of the security token hash
cache_reuse_from integer
valid zone id Zone id of another zone. You cane use it to force this zone into using the other's cache.
expiration integer
in seconds Forced cache expiration in seconds. When this is set expire and cache-control headers from the origin are ignored

Examples

curl --include --request PUT "https://api.ucdn.com/v2/zone/1/?token=acf0230d03f5b71d7252e336106f7338" --header "Content-Type: application/json" -d '{"object_size": "small", "origins": "example.com", "expiration": 3600, "custom_domains": ["cdn.section9.com"]}'
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:03:09 GMT
Server: Apache
X-Powered-By: PHP/5.3.10-1ubuntu3.16
X-Cache: miss
Vary: Accept-Encoding
Content-Length: 27
Content-Type: application/json; charset=utf-8

{
    "message": "Zone replaced"
}

Replace a single zone parameter

You can edit the configuration for a particular zone with this API call. You may pass one or many of the parameters from the following.
PATCH https://api.ucdn.com/v2/zone/{zone_id}
This request returns one of the following messages
Status Flags Description
200 json Success message
532 json Fail message
This request supports the following helpers
Name Description
enable Enable the zone
disable Disable the zone
clear_security_token Unset the security token
clear_geo_filters Unset the geo filters
clear_limit_rates Unset the limit rates
clear_origins_auth Unset origin authentication
clear_referers Unset referers filter
clear_custom_domains Unset all additional domains
clear_origins_header Unset the origin "Host:" header
clear_reuse_cache Stop reusing another zone's cache
This request expects the following parameters
Name Flags Validation Default Description
origins array
string
host[:port],host[:port]...
ucdn_storage
Origins (or upstream) servers or the special value "ucdn_storage" in case you want to use your UCDN Storage
ssl string
yes
no
no Whether to use shared SSL or not.
ssl_type string
own
shared
shared What kind of SSL certificate to be used. Your own or UCDN shared.
ucdn_storage_region string
Name of a storage region returned in /storage/regions europe Only meaningful if origins is "ucdn_storage". Geographical region in which the UCDN storage will be created.
storage_id integer
Existing storage id Only meaningful if origins is "ucdn_storage". Zone will use this storage instead of creating new one.
origins_auth_username string
valid HTTP username HTTP-based authentication username. Ignored when ucdn_storage is used in the origins parameter
origins_auth_password string
valid HTTP password HTTP-based authentication password. Ignored when ucdn_storage is used in the origins parameter
origins_host_header string
valid header string Origin's domain name Host header UCDN will use while accessing your origin. Ignored when ucdn_storage is used in the origins parameter
custom_domains string
array
domain,domain,domain... Custom domains for your zone. They must be CNAMEs to this zone's cdn_domain. This field does not have any effect when using shared SSL.
error_pages string
array
status:url Custom URLs to besed for redirecting from various HTTP error statuses (e.g. 404)
referers string
array
valid domains Allow access only from certain referers
geo_filter_allow string
array
ISO 3166-1 country code Allow access only from certain countries
geo_filter_deny string
array
ISO 3166-1 country code Deny access to certain countries
limit_rate_global string
NNk, e.g. 20k Limit rate for every connection in this zone. It is mutually exclusive with limit_rate_security
limit_rate_security string
on
off
Use security token's limit rate. It is mutually exclusive with limit_rate_global
hash_secret string
valid url query string Access security token, used in conjuction with hash_algorithm and hash_ttl
hash_algorithm string
md5
sha1
Hashing algorithm of the security token
hash_ttl integer
in seconds Time to live of the security token hash
cache_reuse_from integer
valid zone id Zone id of another zone. You cane use it to force this zone into using the other's cache.
expiration integer
in seconds Forced cache expiration in seconds. When this is set expire and cache-control headers from the origin are ignored

Examples

curl --include --request PATCH "https://api.ucdn.com/v2/zone/1/?token=acf0230d03f5b71d7252e336106f7338" --header "Content-Type: application/json" -d '{"ssl": "on", "ssl_type": "own"}'
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: 26
Content-Type: application/json; charset=utf-8

{
    "message": "Zone patched"
}

Delete a zone

Removes a cache zone. Once removed a cache zone cannot be restored and all of its cache is lost.
DELETE https://api.ucdn.com/v2/zone/{zone_id}
This request returns one of the following messages
Status Flags Description
200 json Success message
406 json Fail message
532 json Fail message

Examples

curl --include --request DELETE "https://api.ucdn.com/v2/zone/4/?token=acf0230d03f5b71d7252e336106f7338"
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2015 08:10:38 GMT
Server: Apache
X-Powered-By: PHP/5.3.10-1ubuntu3.16
X-Cache: miss
Vary: Accept-Encoding
Content-Length: 26
Content-Type: application/json; charset=utf-8

{
    "message": "Zone deleted"
}