Complete content delivery control from any application in any language.
The KeyCDN API allows you to manage your Zones, Zone Aliases, Zone Referrers, or generate reports. This documentation provides you the required information to successfully make use of the API. The KeyCDN API is organized around REST.
Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, such as HTTP authentication and HTTP terminology, which can be understood by off-the-shelf HTTP clients.
JSON will be returned in all responses from the API, including errors.
3xx
and 5xx
to status statistics.name
parameter.api.keycdn.com
.You authenticate to the KeyCDN API by providing your API key in the request. Keep your credentials secret. Authentication to the API occurs via HTTP Basic Auth.
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. You must authenticate for all requests.
$ curl https://api.keycdn.com/zones.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
Parameter | Description |
---|---|
status | Status code of the current API call. |
description | Description of an API call. |
data | The response data of the API call. |
{
"status": "success",
"description": "Data successfully received.",
"data": {
...
}
}
KeyCDN uses conventional HTTP response codes to indicate success or failure of an API request. In general, codes in the 2xx
range indicate success, codes in the 4xx
range indicate an error that resulted from the provided information (e.g. a required parameter was missing or invalid), and codes in the 5xx
range indicate an error with KeyCDN's edge servers.
Not all errors map cleanly onto HTTP response codes.
Status | Description |
---|---|
200 OK | Everything worked as expected. |
400 Bad Request | Often missing a required parameter. |
403 Forbidden | Access denied. |
404 Not Found | The requested item does not exist. |
413 Request Entity Too Large | Maximum body size is 64 KB. |
429 Too Many Requests | Rate limit exceeded. |
451 Illegal | Illegal or malicious request. |
500 , 502 , 503 , or 504 | Something went wrong on KeyCDN's end. |
API requests are currently rate limited at 60 queries per 60 seconds window. Purge requests are limited to 1 request per second. Ensure that you inspect the following HTTP response headers, as they provide pertinent data on where your utilization is at for the given rate limit. The calling IP will be blocked if the X-Rate-Limit-Remaining
value reaches 0
.
Header | Description |
---|---|
X-Rate-Limit-Limit | The rate limit ceiling for that given request. |
X-Rate-Limit-Remaining | The number of requests left for the 60 seconds window. |
429 Too Many Requests
response status when you exceed the rate limit.Parameter | Description | ||||||
---|---|---|---|---|---|---|---|
id | Zone ID | ||||||
name | Zone name | ||||||
status | Zone status | ||||||
type | Zone type | ||||||
forcedownload | Forces content to download instead of opening. The following response header will be set: Content-Disposition: Attachment | ||||||
cors | Allow unrestricted Cross-Origin Resource Sharing (CORS). The following response header will be set: Access-Control-Allow-Origin: \* | ||||||
gzip | Gzip compression on content 1 KB or larger. | ||||||
imgproc | Transform and optimize images in real time with simple query parameters. Image Processing incurs an additional cost. | ||||||
expire | Adding or modifying the Cache-Control and Expires response headers that are sent to the client if the HTTP response status code equals 200 , 201 , 204 , 206 , 301 , 302 , 303 , 304 , or 307 :
If cacheignorecachecontrol is enabled the expire value will only have an impact on the browser cache and not on the KeyCDN cache. | ||||||
blockbadbots | Block bad bots (returns a 451 Unavailable For Legal Reasons response status). | ||||||
allowemptyreferrer | Allow requests with an empty Referer request header value if one or more Zone Referrer is active. | ||||||
blockreferrer | Block requests with a Referer request header value matching a Zone Referrer (returns a 403 Forbidden response status). | ||||||
securetoken | Restrict access to all content within Zone by Secure Token. | ||||||
securetokenkey | Secret used to check authenticity of request if securetoken is enabled. | ||||||
securetokenip | The IP of the client will be part of Secure Token if enabled. | ||||||
sslcert | Add SSL/TLS certificate to be used for HTTPS requests:
You must remove an exising Zone Alias before enabling the letsencrypt option (or recreate the Zone Alias afterwards). | ||||||
customsslkey | The custom SSL/TLS certificate private key. Include the -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- statements. | ||||||
customsslcert | The custom SSL/TLS certificate. The required format is PEM (Base64 encoded ASCII), which is the most common format that Certificate Authorities issue. Include the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- statements and optionally include the intermediate certificate:
| ||||||
forcessl | Redirects HTTP requests to HTTPS (returns a 301 Moved Permanently response status). | ||||||
originurl | URL of the origin server where content is pulled from. Include only the scheme and hostname (e.g. https://www.example.com ). Do not include a file path (e.g. ). | ||||||
originshield | Predefined shield servers will pull content from the origin server instead of our edge servers. This will reduce traffic on the origin server but adds an additional request from the edge server to the shield server if the content has not been cached yet. The following response header will be set: X-Shield: active | ||||||
cachemaxexpire | Define the maximum time in minutes that cacheable content will be retained in the KeyCDN cache without checking the origin server. Applies only if not defined by the origin server X-Accel-Expires , Cache-Control , or Expires response headers. | ||||||
cacheignorecachecontrol | Ignores processing of X-Accel-Expires , Cache-Control , and Expires response headers received from the origin server. If enabled the cachemaxexpire value has precedence. | ||||||
cacheignorequerystring | Ignores the presence of query strings. The KeyCDN cache will respond with a cached response even if the query string differs. | ||||||
cachehostheader | Forwards the Host request header (e.g. Host: cdn.example.com ) to the origin server as received from the client instead of the Host request header defined by the originurl hostname. | ||||||
cachekeyscheme | Scheme based caching (http:// or https:// ) as requested by the client. | ||||||
cachekeyhost | Host request header based caching that matches the Zone Alias. | ||||||
cachekeycookie | Cookie variable based caching as received in the Cookie request header. | ||||||
cachekeydevice | Device based caching (desktop , tablet , or mobile ) as received in the User-Agent request header.The default device type is desktop . | ||||||
cachekeywebp | WebP image format based caching as received in the Accept request header. | ||||||
cachekeycountry | Country code based caching derived from the client IP address. | ||||||
cachebr | Brotli based caching as requested by the client. The origin server must support the Brotli compression format. | ||||||
cachecookies | Ignore the presence of cookies. By default content with cookies are not cacheable, but when cookies are ignored content becomes cacheable. | ||||||
cachestripcookies | Strip the Set-Cookie response header received from the origin server. | ||||||
cachexpullkey | Set a custom X-Pull request header value (e.g. X-Pull: example ). This is a custom request header that can serve multiple purposes, such as restricting access to the origin server or allowing all KeyCDN edge server requests through a firewall. | ||||||
cachecanonical | Add a canonical response header with the originurl as the reference to consolidate duplicate content. The following response header will be set: | ||||||
cacherobots | Adding or modifying the robots.txt to prevent content from being indexed: | ||||||
cacheerrorpages | Deliver generic error pages for 4xx and 5xx errors instead of the error pages received from the origin server. | ||||||
dirlist | Generates directory indexes automatically (similar to the Unix ls command or the Win32 dir shell command). |
Returns a list of all Zones on the specified account.
GEThttps://api.keycdn.com/zones.json
Returns a list of Zones as defined in View Zone.
$ curl https://api.keycdn.com/zones.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
{
"status": "success",
"description": "Data successfully received.",
"data": {
"zones": [
{
"id": "1000",
"name": "examplepull",
"status": "active",
"type": "pull",
"forcedownload": "disabled",
"cors": "disabled",
"gzip": "disabled",
"imgproc": "disabled",
"expire": "0",
"blockbadbots": "enabled",
"allowemptyreferrer": "enabled",
"blockreferrer": "disabled",
"securetoken": "disabled",
"securetokenkey": null,
"securetokenip": "disabled",
"sslcert": "shared",
"customsslkey": null,
"customsslcert": null,
"forcessl": "disabled",
"originurl": "https://example.com",
"cachemaxexpire": "1440",
"cacheignorecachecontrol": "enabled",
"cacheignorequerystring": "enabled",
"cachehostheader": "disabled",
"cachekeyscheme": "disabled",
"cachekeyhost": "disabled",
"cachekeycookie": null,
"cachekeydevice": "disabled",
"cachekeywebp": "disabled",
"cachekeycountry": "disabled",
"cachebr": "disabled",
"cachecookies": "disabled",
"cachestripcookies": "disabled",
"cachexpullkey": "KeyCDN",
"cachecanonical": "disabled",
"cacherobots": "disabled",
"cacheerrorpages": "enabled"
},
{
"id": "1001",
"name": "examplepush",
"status": "active",
"type": "push",
"forcedownload": "disabled",
"cors": "disabled",
"gzip": "disabled",
"imgproc": "disabled",
"expire": "0",
"blockbadbots": "enabled",
"allowemptyreferrer": "enabled",
"blockreferrer": "disabled",
"securetoken": "disabled",
"securetokenkey": null,
"securetokenip": "disabled",
"sslcert": "shared",
"customsslkey": null,
"customsslcert": null,
"forcessl": "disabled",
"dirlist": "disabled"
},
...
]
}
}
Returns a Zone specified by the {zone_id}
parameter.
GEThttps://api.keycdn.com/zones/{zone_id}.json
Parameter | Pull | Push |
---|---|---|
id | ||
name | ||
status | ||
type | ||
forcedownload | ||
cors | ||
gzip | ||
imgproc | ||
expire | ||
blockbadbots | ||
allowemptyreferrer | ||
blockreferrer | ||
securetoken | ||
securetokenkey | ||
securetokenip | ||
sslcert | ||
customsslkey | ||
customsslcert | ||
forcessl | ||
originurl | ||
originshield | ||
cachemaxexpire | ||
cacheignorecachecontrol | ||
cacheignorequerystring | ||
cachehostheader | ||
cachekeyscheme | ||
cachekeyhost | ||
cachekeycookie | ||
cachekeydevice | ||
cachekeywebp | ||
cachekeycountry | ||
cachebr | ||
cachecookies | ||
cachestripcookies | ||
cachexpullkey | ||
cachecanonical | ||
cacherobots | ||
cacheerrorpages | ||
dirlist |
$ curl https://api.keycdn.com/zones/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
{
"status": "success",
"description": "Data successfully received.",
"data": {
"zone": {
"id": "1000",
"name": "examplepull",
"status": "active",
"type": "pull",
"forcedownload": "disabled",
"cors": "disabled",
"gzip": "disabled",
"imgproc": "disabled",
"expire": "0",
"blockbadbots": "enabled",
"allowemptyreferrer": "enabled",
"blockreferrer": "disabled",
"securetoken": "disabled",
"securetokenkey": null,
"securetokenip": "disabled",
"sslcert": "shared",
"customsslkey": null,
"customsslcert": null,
"forcessl": "disabled",
"originurl": "https://example.com",
"originshield": "disabled",
"cachemaxexpire": "1440",
"cacheignorecachecontrol": "enabled",
"cacheignorequerystring": "enabled",
"cachehostheader": "disabled",
"cachekeyscheme": "disabled",
"cachekeyhost": "disabled",
"cachekeycookie": null,
"cachekeydevice": "disabled",
"cachekeywebp": "disabled",
"cachekeycountry": "disabled",
"cachebr": "disabled",
"cachecookies": "disabled",
"cachestripcookies": "disabled",
"cachexpullkey": "KeyCDN",
"cachecanonical": "disabled",
"cacherobots": "disabled",
"cacheerrorpages": "enabled"
}
}
}
Add a new Zone with the specified parameters for the accessing user.
POSThttps://api.keycdn.com/zones.json
Parameter | Value | Default | Pull | Push |
---|---|---|---|---|
name required | {alphanumeric} max length: 20 | |||
status optional | active or inactive | active | ||
type required | pull or push | push | ||
forcedownload optional | enabled or disabled | disabled | ||
cors optional | enabled or disabled | disabled | ||
gzip optional | enabled or disabled | disabled | ||
imgproc optional | enabled or disabled | disabled | ||
expire optional | {numeric} range: -1 to 525949 | 0 | ||
blockbadbots optional | enabled or disabled | disabled | ||
allowemptyreferrer optional | enabled or disabled | enabled | ||
blockreferrer optional | enabled or disabled | disabled | ||
securetoken optional | enabled or disabled | disabled | ||
securetokenkey optional | {alphanumeric} length: 4-15 | |||
securetokenip optional | enabled or disabled | disabled | ||
sslcert optional | shared ,custom ,letsencrypt or disabled | shared | ||
customsslkey optional | {valid key} | |||
customsslcert optional | {valid cert} | |||
forcessl optional | enabled or disabled | disabled | ||
originurl required | {url} max length: 128 | |||
originshield optional | enabled or disabled | disabled | ||
cachemaxexpire optional | {numeric} range: 1 to 525949 | 1440 | ||
cacheignorecachecontrol optional | enabled or disabled | enabled | ||
cacheignorequerystring optional | enabled or disabled | enabled | ||
cachehostheader optional | enabled or disabled | disabled | ||
cachekeyscheme optional | enabled or disabled | disabled | ||
cachekeyhost optional | enabled or disabled | disabled | ||
cachekeycookie optional | {alphanumeric} max length: 32 | |||
cachekeydevice optional | enabled or disabled | disabled | ||
cachekeywebp optional | enabled or disabled | disabled | ||
cachekeycountry optional | enabled or disabled | disabled | ||
cachebr optional | enabled or disabled | disabled | ||
cachecookies optional | enabled or disabled | disabled | ||
cachestripcookies optional | enabled or disabled | disabled | ||
cachexpullkey optional | {alphanumeric} length: 4-15 | KeyCDN | ||
cachecanonical optional | enabled or disabled | disabled | ||
cacherobots optional | enabled or disabled | disabled | ||
cacheerrorpages optional | enabled or disabled | enabled | ||
dirlist optional | enabled or disabled | disabled |
Returns the newly created Zone according to View Zone.
$ curl https://api.keycdn.com/zones.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X POST \
-d name=examplepull \
-d type=pull \
-d originurl=https://example.com
{
"status": "success",
"description": "Zone successfully added.",
"data": {
"zone": {
"id": "1000",
"name": "examplepull",
"status": "active",
"type": "pull",
"forcedownload": "disabled",
"cors": "disabled",
"gzip": "disabled",
"imgproc": "disabled",
"expire": "0",
"blockbadbots": "enabled",
"allowemptyreferrer": "enabled",
"blockreferrer": "disabled",
"securetoken": "disabled",
"securetokenkey": null,
"securetokenip": "disabled",
"sslcert": "shared",
"customsslkey": null,
"customsslcert": null,
"forcessl": "disabled",
"originurl": "https://example.com",
"originshield": "disabled",
"cachemaxexpire": "1440",
"cacheignorecachecontrol": "enabled",
"cacheignorequerystring": "enabled",
"cachehostheader": "disabled",
"cachekeyscheme": "disabled",
"cachekeyhost": "disabled",
"cachekeycookie": null,
"cachekeydevice": "disabled",
"cachekeywebp": "disabled",
"cachekeycountry": "disabled",
"cachebr": "disabled",
"cachecookies": "disabled",
"cachestripcookies": "disabled",
"cachexpullkey": "KeyCDN",
"cachecanonical": "disabled",
"cacherobots": "disabled",
"cacheerrorpages": "enabled"
}
}
}
Edit the given Zone specified by the parameter {zone_id}
with the specified request parameters.
PUThttps://api.keycdn.com/zones/{zone_id}.json
Same request parameters as in Add Zone (but all are optional).
Returns the edited Zone according to View Zone.
$ curl https://api.keycdn.com/zones/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X PUT \
-d expire=43200
{
"status": "success",
"description": "Zone successfully changed.",
"data": {
"zone": {
"id": "1000",
"name": "examplepull",
"status": "active",
"type": "pull",
"forcedownload": "disabled",
"cors": "disabled",
"gzip": "disabled",
"imgproc": "disabled",
"expire": "43200",
"blockbadbots": "enabled",
"allowemptyreferrer": "enabled",
"blockreferrer": "disabled",
"securetoken": "disabled",
"securetokenkey": null,
"securetokenip": "disabled",
"sslcert": "shared",
"customsslkey": null,
"customsslcert": null,
"forcessl": "disabled",
"originurl": "https://example.com",
"originshield": "disabled",
"cachemaxexpire": "1440",
"cacheignorecachecontrol": "enabled",
"cacheignorequerystring": "enabled",
"cachehostheader": "disabled",
"cachekeyscheme": "disabled",
"cachekeyhost": "disabled",
"cachekeycookie": null,
"cachekeydevice": "disabled",
"cachekeywebp": "disabled",
"cachekeycountry": "disabled",
"cachebr": "disabled",
"cachecookies": "disabled",
"cachestripcookies": "disabled",
"cachexpullkey": "KeyCDN",
"cachecanonical": "disabled",
"cacherobots": "disabled",
"cacheerrorpages": "enabled"
}
}
}
Delete the given Zone specified by the parameter {zone_id}
.
DELETEhttps://api.keycdn.com/zones/{zone_id}.json
$ curl https://api.keycdn.com/zones/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE
{
"status": "success",
"description": "Zone successfully deleted.",
"data": []
}
Clears the entire cache of a Pull Zone specified by the {zone_id}
parameter.
GEThttps://api.keycdn.com/zones/purge/{zone_id}.json
$ curl https://api.keycdn.com/zones/purge/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
{
"status": "success",
"description": "Cache has been cleared for zone examplepull."
}
Clears the cache for the defined URL(s) by the {zone_id}
parameter.
DELETEhttps://api.keycdn.com/zones/purgeurl/{zone_id}.json
Parameter | Value | Default | Pull | Push |
---|---|---|---|---|
urls required | {array of URLs} without scheme |
$ curl https://api.keycdn.com/zones/purgeurl/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE \
-H "Content-Type: application/json" \
--data '{"urls":["examplepull-hexid.kxcdn.com/css/style.css","examplepull-hexid.kxcdn.com/js/app.js","examplepull-hexid.kxcdn.com/img/logo.svg"]}'
{
"status": "success",
"description": "Cache has been cleared for URL(s)."
}
cachekeyscheme
is enabled prepend the scheme.
$ curl https://api.keycdn.com/zones/purgeurl/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE \
-H "Content-Type: application/json" \
--data '{"urls":["http://examplepull-hexid.kxcdn.com/css/style.css","https://examplepull-hexid.kxcdn.com/css/style.css"]}'
{
"status": "success",
"description": "Cache has been cleared for URL(s)."
}
cachekeyhost
is enabled use the Zone Alias instead of the Zone URL.
$ curl https://api.keycdn.com/zones/purgeurl/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE \
-H "Content-Type: application/json" \
--data '{"urls":["cdnpull.example.com/css/style.css","cdnpull.example.com/js/app.js","cdnpull.example.com/img/logo.svg"]}'
{
"status": "success",
"description": "Cache has been cleared for URL(s)."
}
cacheignorequerystring
is disabled append the query string.
$ curl https://api.keycdn.com/zones/purgeurl/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE \
-H "Content-Type: application/json" \
--data '{"urls":["examplepull-hexid.kxcdn.com/css/style.css","examplepull-hexid.kxcdn.com/css/style.css?name=value"]}'
{
"status": "success",
"description": "Cache has been cleared for URL(s)."
}
cachekeycookie
is enabled append the cookie variable.
$ curl https://api.keycdn.com/zones/purgeurl/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE \
-H "Content-Type: application/json" \
--data '{"urls":["examplepull-hexid.kxcdn.com/css/style.css","examplepull-hexid.kxcdn.com/css/style.csscookie"]}'
{
"status": "success",
"description": "Cache has been cleared for URL(s)."
}
cachekeydevice
is enabled append the device type.
$ curl https://api.keycdn.com/zones/purgeurl/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE \
-H "Content-Type: application/json" \
--data '{"urls":["examplepull-hexid.kxcdn.com/css/style.cssdesktop","examplepull-hexid.kxcdn.com/css/style.csstablet","examplepull-hexid.kxcdn.com/css/style.cssmobile"]}'
{
"status": "success",
"description": "Cache has been cleared for URL(s)."
}
cachekeywebp
is enabled append webp
.
$ curl https://api.keycdn.com/zones/purgeurl/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE \
-H "Content-Type: application/json" \
--data '{"urls":["examplepull-hexid.kxcdn.com/img/logo.png", "examplepull-hexid.kxcdn.com/img/logo.pngwebp"]}'
{
"status": "success",
"description": "Cache has been cleared for URL(s)."
}
cachekeycountry
is enabled append the two-letter country code (e.g. US).
$ curl https://api.keycdn.com/zones/purgeurl/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE \
-H "Content-Type: application/json" \
--data '{"urls":["examplepull-hexid.kxcdn.com/img/logo.png", "examplepull-hexid.kxcdn.com/img/logo.pngUS"]}'
{
"status": "success",
"description": "Cache has been cleared for URL(s)."
}
cachebr
is enabled append br
.
$ curl https://api.keycdn.com/zones/purgeurl/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE \
-H "Content-Type: application/json" \
--data '{"urls":["examplepull-hexid.kxcdn.com/css/style.css","examplepull-hexid.kxcdn.com/css/style.cssbr"]}'
{
"status": "success",
"description": "Cache has been cleared for URL(s)."
}
scheme
host
querystring
cookie
br
device
webp
country
$ curl https://api.keycdn.com/zones/purgeurl/1000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE \
-H "Content-Type: application/json" \
--data '{"urls":["https://cdnpull.example.com/css/style.css?name=valuecookiebrdesktop"]}'
{
"status": "success",
"description": "Cache has been cleared for URL(s)."
}
Parameter | Description |
---|---|
id | Zone Alias ID |
zone_id | Associated Zone ID |
name | Zone Alias hostname |
Returns a list of all Zone Aliases on the specified account.
GEThttps://api.keycdn.com/zonealiases.json
Parameter | Pull | Push |
---|---|---|
id | ||
zone_id | ||
name |
$ curl https://api.keycdn.com/zonealiases.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
{
"status": "success",
"description": "Data successfully received.",
"data": {
"zonealiases": [
{
"id": "2000",
"zone_id": "1000",
"name": "cdnpull.example.com"
},
{
"id": "2001",
"zone_id": "1001",
"name": "cdnpush.example.com"
}
]
}
}
Adds a Zone Aliases for a given Zone.
POSThttps://api.keycdn.com/zonealiases.json
Parameter | Value | Default | Pull | Push |
---|---|---|---|---|
zone_id required | {numeric} | |||
name required | {hostname} max length: 128 |
Returns the added Zone Alias with the same parameters as in List Zone Aliases.
$ curl https://api.keycdn.com/zonealiases.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X POST \
-d name=cdnpull.example.com \
-d zone_id=1000
{
"status": "success",
"description": "Zone Alias successfully added.",
"data": {
"zonealias": {
"id": "2000",
"name": "cdnpull.example.com",
"zone_id": "1000"
}
}
}
Edit the given Zone Alias specified by the parameter {zonealias_id}
with the speciefied request parameters.
PUThttps://api.keycdn.com/zonealiases/{zonealias_id}.json
Same request parameters as in Add Zone Alias.
Returns the changed Zone Alias with the same parameters as in List Zone Aliases.
$ curl https://api.keycdn.com/zonealiases/2000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X PUT \
-d name=cdn-pull.example.com \
-d zone_id=1000
{
"status": "success",
"description": "Zone Alias successfully changed.",
"data": {
"zonealias": {
"id": "2000",
"name": "cdn-pull.example.com",
"zone_id": "1000"
}
}
}
Delete the given Zone Alias specified by the parameter {zonealias_id}
.
DELETEhttps://api.keycdn.com/zonealiases/{zonealias_id}.json
$ curl https://api.keycdn.com/zonealiases/2000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE
{
"status": "success",
"description": "Zone Alias successfully deleted.",
"data": []
}
Parameter | Description |
---|---|
id | Zone Referrer ID |
zone_id | Associated Zone ID |
name | Zone Referrer hostname |
Returns a list of all Zone Referrers on the specified account.
GEThttps://api.keycdn.com/zonereferrers.json
Parameter | Pull | Push |
---|---|---|
id | ||
zone_id | ||
name |
$ curl https://api.keycdn.com/zonereferrers.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
{
"status": "success",
"description": "Data successfully received.",
"data": {
"zonereferrers": [
{
"id": "3000",
"zone_id": "1000",
"name": "example.com"
},
{
"id": "3001",
"zone_id": "1000",
"name": "cdnpull.example.com"
},
{
"id": "3002",
"zone_id": "1000",
"name": "examplepull-hexid.kxcdn.com"
}
]
}
}
Adds a Zone Referrers for a given Zone.
POSThttps://api.keycdn.com/zonereferrers.json
Parameter | Value | Default | Pull | Push |
---|---|---|---|---|
zone_id required | {numeric} | |||
name required | {hostname} max length: 46 |
Returns the added Zone Referrer with the same parameters as in List Zone Referrers.
$ curl https://api.keycdn.com/zonereferrers.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X POST \
-d name=example.com \
-d zone_id=1000
{
"status": "success",
"description": "Zone Referrer successfully added.",
"data": {
"zonereferrer": {
"id": "3000",
"name": "example.com",
"zone_id": "1000"
}
}
}
Edit the given Zone Referrer specified by the parameter {zonereferrer_id}
with the speciefied request parameters.
PUThttps://api.keycdn.com/zonereferrers/{zonereferrer_id}.json
Same request parameters as in Add Zone Referrer.
Returns the changed Zone Referrer with the same parameters as in List Zone Referrers.
$ curl https://api.keycdn.com/zonereferrers/3000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X PUT \
-d name=example.net \
-d zone_id=1000
{
"status": "success",
"description": "Zone Referrer successfully changed.",
"data": {
"zonereferrer": {
"id": "3000",
"name": "example.net",
"zone_id": "1000"
}
}
}
Delete the given Zone Referrer specified by the parameter {zonereferrer_id}
.
DELETEhttps://api.keycdn.com/zonereferrers/{zonereferrer_id}.json
$ curl https://api.keycdn.com/zonereferrers/3000.json \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86: \
-X DELETE
{
"status": "success",
"description": "Zone Referrer successfully deleted.",
"data": []
}
Returns a list of traffic statistics for a given time range.
GEThttps://api.keycdn.com/reports/traffic.json
Parameter | Value | Default | Pull | Push |
---|---|---|---|---|
zone_id optional | {numeric} | |||
start required | {timestamp} unix | |||
end required | {timestamp} unix | |||
region optional | a , b or c |
Parameter | Pull | Push |
---|---|---|
amount bytes | ||
timestamp unix |
$ curl "https://api.keycdn.com/reports/traffic.json?start=1541030400&end=1541203200" \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
{
"status":"success",
"description":"Data successfully received.",
"data":{
"stats":[
{
"amount":"6822186",
"timestamp":"1541030400"
},
{
"amount":"9327251",
"timestamp":"1541116800"
},
{
"amount":"6104220",
"timestamp":"1541203200"
}
]
}
}
Returns a list of storage statistics for a given time range.
GEThttps://api.keycdn.com/reports/storage.json
Parameter | Value | Default | Pull | Push |
---|---|---|---|---|
zone_id optional | {numeric} | |||
start required | {timestamp} unix | |||
end required | {timestamp} unix |
Parameter | Pull | Push |
---|---|---|
amount bytes | ||
timestamp unix |
$ curl "https://api.keycdn.com/reports/storage.json?start=1541030400&end=1541203200" \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
{
"status":"success",
"description":"Data successfully received.",
"data":{
"stats":[
{
"amount":"538923008",
"timestamp":"1541030400"
},
{
"amount":"538923008",
"timestamp":"1541116800"
},
{
"amount":"538923008",
"timestamp":"1541203200"
}
]
}
}
Returns a list of Image Processing statistics for a given time range.
GEThttps://api.keycdn.com/reports/ip.json
Parameter | Value | Default | Pull | Push |
---|---|---|---|---|
zone_id optional | {numeric} | |||
start required | {timestamp} unix | |||
end required | {timestamp} unix |
Parameter | Pull | Push |
---|---|---|
amount ops | ||
timestamp unix |
$ curl "https://api.keycdn.com/reports/ip.json?start=1541030400&end=1541203200" \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
{
"status":"success",
"description":"Data successfully received.",
"data":{
"stats":[
{
"amount":"1208",
"timestamp":"1541030400"
},
{
"amount":"1234",
"timestamp":"1541116800"
},
{
"amount":"1062",
"timestamp":"1541203200"
}
]
}
}
Returns a list of state statistics for a given time range.
GEThttps://api.keycdn.com/reports/statestats.json
Parameter | Value | Default | Pull | Push |
---|---|---|---|---|
zone_id optional | {numeric} | |||
start required | {timestamp} unix | |||
end required | {timestamp} unix |
Parameter | Pull | Push |
---|---|---|
totalcachehit | ||
totalcachemiss | ||
total2xx | ||
total3xx | ||
total4xx | ||
total5xx | ||
timestamp unix |
$ curl "https://api.keycdn.com/reports/statestats.json?start=1541030400&end=1541203200" \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
{
"status":"success",
"description":"Data successfully received.",
"data":{
"stats":[
{
"totalcachehit":"313",
"totalcachemiss":"18",
"totalsuccess":"329",
"totalerror":"5",
"timestamp":"1541030400"
},
{
"totalcachehit":"219",
"totalcachemiss":"4",
"totalsuccess":"220",
"totalerror":"2",
"timestamp":"1541116800"
},
{
"totalcachehit":"284",
"totalcachemiss":"11",
"totalsuccess":"302",
"totalerror":"4",
"timestamp":"1541203200"
}
]
}
}
Returns a list of credit bookings for a given time range.
GEThttps://api.keycdn.com/reports/credits.json
Parameter | Value | Default |
---|---|---|
start required | {timestamp} unix | |
end required | {timestamp} unix |
Parameter |
---|
amount credits |
type traffic, storage, zones, initial, or payment |
timestamp unix |
$ curl "https://api.keycdn.com/reports/credits.json?start=?start=1541030400&end=1541203200" \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
{
"status":"success",
"description":"Data successfully received.",
"data":{
"stats":[
{
"amount":"-0.01",
"type":"storage",
"timestamp":"1541030400"
},
{
"amount":"-0.02",
"type":"traffic",
"timestamp":"1541030400"
},
{
"amount":"-0.01",
"type":"traffic",
"timestamp":"1541116800"
},
{
"amount":"-0.01",
"type":"storage",
"timestamp":"1541116800"
},
{
"amount":"-0.01",
"type":"storage",
"timestamp":"1541203200"
},
{
"amount":"-0.02",
"type":"traffic",
"timestamp":"1541203200"
}
]
}
}
Returns the credit balance.
GEThttps://api.keycdn.com/reports/creditbalance.json
Parameter |
---|
amount credits |
$ curl "https://api.keycdn.com/reports/creditbalance.json" \
-u sk_prod_zbSVNe8gVUMT4KjYcJWuyC86:
{
"status":"success",
"description":"Data successfully received.",
"data":{
"amount":"100"
}
}