API reference

Automate sites, cache purges and security settings. All requests use HTTPS; requests and responses are JSON.

Base URL: https://api.cdnen.com/v1 Available on Advanced plans and above.

Authentication

Create a token in the console under Account → API Token and send it in every request:

Authorization: Bearer cdn_xxxxxxxx…
curl https://api.cdnen.com/v1/me \ -H "Authorization: Bearer $TOKEN"
Tokens can be limited by scope, sites, client IPs and expiry. Never put a token in front-end code or public repositories; if it leaks, regenerate or delete it in the console.

Scopes

ScopeAllowed
Purge only purgeList sites (id and domain only), purge, preheat
Read only readRead sites, analytics, attacks, IP rules, SSL
Security securityRead + purge + security level, WAF, IP rules
Full fullEverything above + create, update, delete sites (no billing or account changes)

Errors & rate limits

Errors return { "error": "…" }.

HTTPMeaning
400Invalid parameters
401Token invalid, disabled or expired
403Scope not allowed, IP not allowed, or plan has no API
404Site not found or not allowed for this token
429Too many requests (600 per minute per token)

List & get sites

GET/v1/sites
GET/v1/sites/{id}
curl https://api.cdnen.com/v1/sites \ -H "Authorization: Bearer $TOKEN"
{ "data": [ { "id": 12, "domain": "www.example.com", "cname": "3ae2ec.g1.cdnen.net", "status": "active", "level": "normal", "waf": true, "origins": [{ "addr": "203.0.113.10", "weight": 10 }], "ssl": { "status": "ok" } } ] }

status:pending waiting for DNS/active active/stopped paused/suspended plan expired

Create a site

POST/v1/sites
FieldDescription
domainDomain, e.g. www.example.com; use a domains array for several
originsOrigin IPs or hostnames, e.g. ["203.0.113.10"]
add_wwwtrue to also add www
plan_idPlan subscription to use (optional)
protoOrigin protocol: follow / http / https
levelSecurity level (see below)
curl -X POST https://api.cdnen.com/v1/sites \ -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -d '{"domain":"www.example.com","origins":["203.0.113.10"]}'

Point your DNS CNAME to the cname in the response.

Update & delete

PATCH/v1/sites/{id}
DELETE/v1/sites/{id}
FieldDescription
originsReplace origins
statusactive / paused
proto, http_port, https_portOrigin protocol and ports
waf, auto_ssltrue/false

Purge cache

POST/v1/sites/{id}/purge
FieldDescription
urlsURLs to purge, max 100; full URL or /path
dirsDirectories, e.g. /images/
alltrue purges the whole site
curl -X POST https://api.cdnen.com/v1/sites/12/purge \ -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -d '{"urls":["/css/app.css","/js/app.js"]}'

Daily limits are the same as in the console (2,000 URLs, 100 directories, 50 full purges).

Preheat

POST/v1/sites/{id}/preheat

Field urls:URLs to fetch into edge cache, max 100.

Security level

PATCH/v1/sites/{id}/security
FieldDescription
levelloose / normal / strict / attack (under attack)
waftrue/false

IP rules

GET/v1/sites/{id}/ip-rules
POST/v1/sites/{id}/ip-rules
DELETE/v1/sites/{id}/ip-rules/{rule_id}
FieldDescription
actionblock or allow
ip / ipsOne IP or an array; CIDR allowed, e.g. 198.51.100.0/24
noteNote (optional)

rule_id looks like block:198.51.100.7 or allow:203.0.113.0/24; use the id from the list.

Traffic

GET/v1/sites/{id}/stats?range=24h

range:1h/24h/7d/30d. Returns totals (requests, bytes, cache hits, blocked) and a time series.

Attacks

GET/v1/sites/{id}/attacks?secs=3600&limit=100

Recently blocked requests: time, IP, country, type, rule, URL. secs up to 30 days, limit up to 300; filter with ip.

SSL status

GET/v1/sites/{id}/ssl

status:ok issued/pending pending/renew renewing/error failed, see error/none no certificate

Human verification: verify a tokenNEW

After the form is submitted, verify cdnen-hv-token on your server with the widget secret (Console → Human verification). No API token needed; JSON or form encoding both work.

POSThttps://www.cdnen.com/api/hv/verify
{ "secret": "hvs_…", "token": "cdnen-hv-token", "remoteip": "visitor IP (optional)" } → { "ok": true, "score": 0.9, "hostname": "shop.example.com", "ts": 1795280000 }

Do not process the form unless ok is true. On failure, error is invalid-secret, invalid-token, expired (older than 5 minutes), already-used or ip-mismatch.

In the page: <script src="https://www.cdnen.com/hv.js" async></script> plus <div class="cdnen-hv" data-key="hv_…"></div> inside your form. Optional data-callback (function name called on success) and data-theme="dark".

SaaS custom hostnamesNEW

GET/v1/sites/{id}/saas
POST/v1/sites/{id}/saas {"hosts":["www.amy-shop.com","shop.bobtea.tw"]}
DELETE/v1/sites/{id}/saas/{host_id}

Ask your customer to CNAME their hostname to this site's domain; SSL is issued automatically once verified. status: pending waiting for CNAME / active / lost CNAME removed, disabled. Up to 100 per site.

SDKSDKs coming soon