Create Rule
Creates a new edge rule for the zone. The body must include "_METHOD": "PUT" alongside the standard rule payload. On success the server returns result: "success" with a human-readable message.
curl -X POST "https://api.5centscdn.com/v2/zones/vod/pull/12345/rules/rule" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"_METHOD": "PUT",
"name": "Cache Segments",
"rule": "/stream/*",
"options": {
"edge_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"midgress_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"browser_cache_settings": {
"enabled": null,
"control": "default",
"value": "345600s",
"custom": {
"value": ""
}
},
"ignore_cookie": {
"enabled": null
},
"ignoreQueryString": {
"enabled": null,
"control": null,
"value": null
},
"query_params_blacklist": {
"enabled": null,
"value": null
},
"query_params_whitelist": {
"enabled": null,
"value": null
},
"country_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": []
},
"ip_address_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": []
},
"user_agent_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": [],
"casesensitive": false
},
"referrer_acl": {
"enabled": null,
"policy_type": "allow",
"noreferer": false,
"excepted_values": [],
"ip_whitelists": []
},
"secure_key": {
"enabled": null,
"policy_type": 0,
"session": 0,
"key": "",
"ip_whitelists": [],
"type": false
},
"limit_bandwidth": {
"enabled": null,
"limit_type": "static",
"speed": 12000,
"buffer": 1024
},
"limit_request": {
"enabled": null,
"rate": 9,
"burst": 98,
"delay": 96,
"ip_whitelists": []
},
"rewrite": {
"enabled": null,
"body": "",
"flag": "break"
},
"host_redirect": {
"enabled": null,
"to": "",
"value": []
},
"redirect_http_to_https": {
"enabled": null
},
"follow_origin_redirect": {
"enabled": null,
"codes": []
},
"hsts": {
"enabled": null,
"referrerPolicy": "no-referrer",
"includeSubDomains": true,
"preload": true
},
"xff": {
"enabled": null
},
"sni": {
"enabled": null,
"sni_type": "dynamic",
"custom_hostname": ""
},
"force_return": {
"enabled": null,
"code": 200,
"body": ""
},
"stale": {
"enabled": null,
"value": ""
},
"staticHeaders": {
"enabled": null,
"keys": [],
"values": []
},
"staticRequestHeaders": {
"enabled": null,
"keys": [],
"values": []
},
"response_headers_hiding_policy": {
"enabled": null,
"mode": "hide",
"expected": {
"hide": [],
"show": []
}
},
"hostHeader": {
"enabled": null,
"control": "forward",
"custom": ""
},
"forward_host_header": {
"enabled": null
},
"cors": {
"enabled": null,
"control": "*",
"always": false,
"value": "*",
"custom": ""
}
}
}'
import requests
import json
url = "https://api.5centscdn.com/v2/zones/vod/pull/12345/rules/rule"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"_METHOD": "PUT",
"name": "Cache Segments",
"rule": "/stream/*",
"options": {
"edge_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"midgress_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"browser_cache_settings": {
"enabled": null,
"control": "default",
"value": "345600s",
"custom": {
"value": ""
}
},
"ignore_cookie": {
"enabled": null
},
"ignoreQueryString": {
"enabled": null,
"control": null,
"value": null
},
"query_params_blacklist": {
"enabled": null,
"value": null
},
"query_params_whitelist": {
"enabled": null,
"value": null
},
"country_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": []
},
"ip_address_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": []
},
"user_agent_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": [],
"casesensitive": false
},
"referrer_acl": {
"enabled": null,
"policy_type": "allow",
"noreferer": false,
"excepted_values": [],
"ip_whitelists": []
},
"secure_key": {
"enabled": null,
"policy_type": 0,
"session": 0,
"key": "",
"ip_whitelists": [],
"type": false
},
"limit_bandwidth": {
"enabled": null,
"limit_type": "static",
"speed": 12000,
"buffer": 1024
},
"limit_request": {
"enabled": null,
"rate": 9,
"burst": 98,
"delay": 96,
"ip_whitelists": []
},
"rewrite": {
"enabled": null,
"body": "",
"flag": "break"
},
"host_redirect": {
"enabled": null,
"to": "",
"value": []
},
"redirect_http_to_https": {
"enabled": null
},
"follow_origin_redirect": {
"enabled": null,
"codes": []
},
"hsts": {
"enabled": null,
"referrerPolicy": "no-referrer",
"includeSubDomains": true,
"preload": true
},
"xff": {
"enabled": null
},
"sni": {
"enabled": null,
"sni_type": "dynamic",
"custom_hostname": ""
},
"force_return": {
"enabled": null,
"code": 200,
"body": ""
},
"stale": {
"enabled": null,
"value": ""
},
"staticHeaders": {
"enabled": null,
"keys": [],
"values": []
},
"staticRequestHeaders": {
"enabled": null,
"keys": [],
"values": []
},
"response_headers_hiding_policy": {
"enabled": null,
"mode": "hide",
"expected": {
"hide": [],
"show": []
}
},
"hostHeader": {
"enabled": null,
"control": "forward",
"custom": ""
},
"forward_host_header": {
"enabled": null
},
"cors": {
"enabled": null,
"control": "*",
"always": false,
"value": "*",
"custom": ""
}
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.5centscdn.com/v2/zones/vod/pull/12345/rules/rule", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"_METHOD": "PUT",
"name": "Cache Segments",
"rule": "/stream/*",
"options": {
"edge_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"midgress_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"browser_cache_settings": {
"enabled": null,
"control": "default",
"value": "345600s",
"custom": {
"value": ""
}
},
"ignore_cookie": {
"enabled": null
},
"ignoreQueryString": {
"enabled": null,
"control": null,
"value": null
},
"query_params_blacklist": {
"enabled": null,
"value": null
},
"query_params_whitelist": {
"enabled": null,
"value": null
},
"country_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": []
},
"ip_address_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": []
},
"user_agent_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": [],
"casesensitive": false
},
"referrer_acl": {
"enabled": null,
"policy_type": "allow",
"noreferer": false,
"excepted_values": [],
"ip_whitelists": []
},
"secure_key": {
"enabled": null,
"policy_type": 0,
"session": 0,
"key": "",
"ip_whitelists": [],
"type": false
},
"limit_bandwidth": {
"enabled": null,
"limit_type": "static",
"speed": 12000,
"buffer": 1024
},
"limit_request": {
"enabled": null,
"rate": 9,
"burst": 98,
"delay": 96,
"ip_whitelists": []
},
"rewrite": {
"enabled": null,
"body": "",
"flag": "break"
},
"host_redirect": {
"enabled": null,
"to": "",
"value": []
},
"redirect_http_to_https": {
"enabled": null
},
"follow_origin_redirect": {
"enabled": null,
"codes": []
},
"hsts": {
"enabled": null,
"referrerPolicy": "no-referrer",
"includeSubDomains": true,
"preload": true
},
"xff": {
"enabled": null
},
"sni": {
"enabled": null,
"sni_type": "dynamic",
"custom_hostname": ""
},
"force_return": {
"enabled": null,
"code": 200,
"body": ""
},
"stale": {
"enabled": null,
"value": ""
},
"staticHeaders": {
"enabled": null,
"keys": [],
"values": []
},
"staticRequestHeaders": {
"enabled": null,
"keys": [],
"values": []
},
"response_headers_hiding_policy": {
"enabled": null,
"mode": "hide",
"expected": {
"hide": [],
"show": []
}
},
"hostHeader": {
"enabled": null,
"control": "forward",
"custom": ""
},
"forward_host_header": {
"enabled": null
},
"cors": {
"enabled": null,
"control": "*",
"always": false,
"value": "*",
"custom": ""
}
}
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"_METHOD": "PUT",
"name": "Cache Segments",
"rule": "/stream/*",
"options": {
"edge_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"midgress_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"browser_cache_settings": {
"enabled": null,
"control": "default",
"value": "345600s",
"custom": {
"value": ""
}
},
"ignore_cookie": {
"enabled": null
},
"ignoreQueryString": {
"enabled": null,
"control": null,
"value": null
},
"query_params_blacklist": {
"enabled": null,
"value": null
},
"query_params_whitelist": {
"enabled": null,
"value": null
},
"country_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": []
},
"ip_address_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": []
},
"user_agent_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": [],
"casesensitive": false
},
"referrer_acl": {
"enabled": null,
"policy_type": "allow",
"noreferer": false,
"excepted_values": [],
"ip_whitelists": []
},
"secure_key": {
"enabled": null,
"policy_type": 0,
"session": 0,
"key": "",
"ip_whitelists": [],
"type": false
},
"limit_bandwidth": {
"enabled": null,
"limit_type": "static",
"speed": 12000,
"buffer": 1024
},
"limit_request": {
"enabled": null,
"rate": 9,
"burst": 98,
"delay": 96,
"ip_whitelists": []
},
"rewrite": {
"enabled": null,
"body": "",
"flag": "break"
},
"host_redirect": {
"enabled": null,
"to": "",
"value": []
},
"redirect_http_to_https": {
"enabled": null
},
"follow_origin_redirect": {
"enabled": null,
"codes": []
},
"hsts": {
"enabled": null,
"referrerPolicy": "no-referrer",
"includeSubDomains": true,
"preload": true
},
"xff": {
"enabled": null
},
"sni": {
"enabled": null,
"sni_type": "dynamic",
"custom_hostname": ""
},
"force_return": {
"enabled": null,
"code": 200,
"body": ""
},
"stale": {
"enabled": null,
"value": ""
},
"staticHeaders": {
"enabled": null,
"keys": [],
"values": []
},
"staticRequestHeaders": {
"enabled": null,
"keys": [],
"values": []
},
"response_headers_hiding_policy": {
"enabled": null,
"mode": "hide",
"expected": {
"hide": [],
"show": []
}
},
"hostHeader": {
"enabled": null,
"control": "forward",
"custom": ""
},
"forward_host_header": {
"enabled": null
},
"cors": {
"enabled": null,
"control": "*",
"always": false,
"value": "*",
"custom": ""
}
}
}`)
req, err := http.NewRequest("POST", "https://api.5centscdn.com/v2/zones/vod/pull/12345/rules/rule", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.5centscdn.com/v2/zones/vod/pull/12345/rules/rule')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-Key'] = 'YOUR_API_KEY'
request.body = '{
"_METHOD": "PUT",
"name": "Cache Segments",
"rule": "/stream/*",
"options": {
"edge_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"midgress_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"browser_cache_settings": {
"enabled": null,
"control": "default",
"value": "345600s",
"custom": {
"value": ""
}
},
"ignore_cookie": {
"enabled": null
},
"ignoreQueryString": {
"enabled": null,
"control": null,
"value": null
},
"query_params_blacklist": {
"enabled": null,
"value": null
},
"query_params_whitelist": {
"enabled": null,
"value": null
},
"country_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": []
},
"ip_address_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": []
},
"user_agent_acl": {
"enabled": null,
"policy_type": "allow",
"excepted_values": [],
"ip_whitelists": [],
"casesensitive": false
},
"referrer_acl": {
"enabled": null,
"policy_type": "allow",
"noreferer": false,
"excepted_values": [],
"ip_whitelists": []
},
"secure_key": {
"enabled": null,
"policy_type": 0,
"session": 0,
"key": "",
"ip_whitelists": [],
"type": false
},
"limit_bandwidth": {
"enabled": null,
"limit_type": "static",
"speed": 12000,
"buffer": 1024
},
"limit_request": {
"enabled": null,
"rate": 9,
"burst": 98,
"delay": 96,
"ip_whitelists": []
},
"rewrite": {
"enabled": null,
"body": "",
"flag": "break"
},
"host_redirect": {
"enabled": null,
"to": "",
"value": []
},
"redirect_http_to_https": {
"enabled": null
},
"follow_origin_redirect": {
"enabled": null,
"codes": []
},
"hsts": {
"enabled": null,
"referrerPolicy": "no-referrer",
"includeSubDomains": true,
"preload": true
},
"xff": {
"enabled": null
},
"sni": {
"enabled": null,
"sni_type": "dynamic",
"custom_hostname": ""
},
"force_return": {
"enabled": null,
"code": 200,
"body": ""
},
"stale": {
"enabled": null,
"value": ""
},
"staticHeaders": {
"enabled": null,
"keys": [],
"values": []
},
"staticRequestHeaders": {
"enabled": null,
"keys": [],
"values": []
},
"response_headers_hiding_policy": {
"enabled": null,
"mode": "hide",
"expected": {
"hide": [],
"show": []
}
},
"hostHeader": {
"enabled": null,
"control": "forward",
"custom": ""
},
"forward_host_header": {
"enabled": null
},
"cors": {
"enabled": null,
"control": "*",
"always": false,
"value": "*",
"custom": ""
}
}
}'
response = http.request(request)
puts response.body
{
"result": "success",
"message": "Zone EdgeRule Created. Please wait till the rules validation & deployment completes.",
"ruleid": 8421
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
/zones/vod/pull/{zoneId}/rules/ruleTarget server for requests. Edit to use your own host.
API key (sent in header)
Numeric ID of the zone
The media type of the request body
HTTP method override. Always "PUT" for create.
Human-readable label for the rule.
URL pattern or regex applied to incoming requests. Validated via /validate/rule.
Container for all behavior option groups.
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Provide your API key in the header.
Path Parameters
Body
URL pattern or regex applied to incoming requests. Validated via /validate/rule.
/stream/*Container for all behavior option groups.
Controls how long the edge CDN caches content.
Per-path-pattern cache overrides.
Controls midgress (mid-tier) cache duration. Identical structure to edge_cache_settings.
[][]Controls Cache-Control headers sent to the client browser.
"default" uses default duration; "no-cache" disables browser caching; "custom" uses custom.value.
defaultno-cachecustomControls whether query strings are considered when caching. Mutually exclusive with query_params_blacklist and query_params_whitelist. Pull only.
"ignore" = strip all query strings before caching; "cache" = include full query string in cache key.
nullExclude specific query parameters from the cache key. Mutually exclusive with ignoreQueryString and query_params_whitelist. Pull only.
Include only specific query parameters in the cache key. Mutually exclusive with ignoreQueryString and query_params_blacklist. Pull only.
Comma-separated query parameter names to keep in the cache key. All others are stripped.
nullAllow or block requests from specific countries.
"allow" = whitelist mode (only listed countries allowed); "deny" = blacklist mode.
allowdenyAllow or block requests from specific IP addresses.
Allow or block requests based on the User-Agent header.
Allow or block requests based on the Referer header.
Protect content with signed URL tokens.
Per-connection download speed throttling.
"static" = fixed speed; "dynamic" = after an initial burst buffer.
staticdynamicInitial buffer in KB before speed limit kicks in (used with limit_type "dynamic").
1024Per-IP request rate limiting.
URL rewrite rule applied before forwarding to origin.
"break" stops further processing, "last" re-evaluates, "redirect" returns 302, "permanent" returns 301.
breaklastredirectpermanentRedirect requests to a different hostname.
Permanently redirect all HTTP requests to HTTPS (301).
Follow HTTP redirects returned by the origin. Pull only.
HTTP redirect status codes from origin that the CDN should follow and cache the result.
[]HTTP Strict Transport Security configuration.
Sets the Referrer-Policy header.
no-referrerno-referrer-when-downgradeoriginorigin-when-cross-originsame-originstrict-originstrict-origin-when-cross-originunsafe-urlAdd the X-Forwarded-For header with the client IP when forwarding to origin. Pull only.
SNI hostname used in TLS handshake toward origin. Pull only.
"dynamic" = use the incoming request hostname as SNI; "custom" = use custom_hostname.
dynamiccustomReturn a fixed HTTP status code for matched requests.
Serve stale cached content if origin is unreachable.
Add or override response headers.
Adds or overrides headers on the request forwarded to origin. Pull only.
Header names to add/override in the request to origin. Parallel-indexed with values.
[]Suppress specific response headers before delivery to the client. Pull only.
"hide" = remove listed headers from response; "show" = remove all except listed.
hideshowControls the Host header sent to origin. Pull only. Send alongside forward_host_header which is its legacy alias.
"forward" = forward the client original Host header; "custom" = use the custom value below.
forwardcustomLegacy alias for the Host Header setting. Send alongside hostHeader. Pull only.
CORS header support.
Responses
Status of the API response.
successThe numeric ID of the newly created edge rule.
errorerror