Skip to content
REST API · CDN

REST API

CDN API

Manage CDN deployments, domains, SSL, caching, and analytics under /api/cdn.

On this page5 sections

All endpoints require authentication.

Quick start#

A deployment is a container for one or more domains, each with its own origin and cache settings:

Terminal
# Create a deployment
curl -X POST https://edge.network/api/cdn/deployments \
  -H "Authorization: Bearer ek_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "name": "my-site" }'

# Add a domain with an origin
curl -X POST https://edge.network/api/cdn/deployments/DEPLOYMENT_ID/domains \
  -H "Authorization: Bearer ek_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "cdn.example.com",
    "originType": "url",
    "origin": "https://origin.example.com",
    "cacheTtlSeconds": 3600
  }'

Deployments#

Endpoint Description
GET /api/cdn/deployments List deployments
POST /api/cdn/deployments Create. Body: { "name": "..." }. Returns 201.
GET /api/cdn/deployments/:id Get one deployment with its domains
DELETE /api/cdn/deployments/:id Delete a deployment
GET | POST /api/cdn/deployments/:id/pause Get / toggle cache pause. Body: { "paused": true }
GET /api/cdn/usage Account-wide requests, bytes served and cache hit rate
GET /api/cdn/edge-nodes Status of the edge node network

Domains and SSL#

Endpoint Description
POST /api/cdn/deployments/:id/domains Add a domain. Body: { domain, originType?, origin?, storageBucket?, cacheTtlSeconds?, jitImageEnabled? }
PATCH /api/cdn/deployments/:id/domains/:domainId Update origin, TTL, image optimisation, root-path behaviour and custom config
DELETE /api/cdn/deployments/:id/domains/:domainId Remove a domain
POST .../domains/:domainId/check-dns Verify the CNAME is pointing at Edge
POST .../domains/:domainId/retry-ssl Re-attempt SSL certificate issuance
POST | DELETE .../domains/:domainId/watermark Upload (raw PNG/WebP body) or remove a watermark image
PUT .../domains/:domainId/protection Enable or disable password protection (HTTP Basic Auth). Body: enabled, username, password
GET .../domains/:domainId/stats Per-domain traffic stats

originType is url (default, requires origin) or storage (requires storageBucket; serves directly from Edge Storage).

Cache purging#

Terminal
curl -X POST https://edge.network/api/cdn/deployments/DEPLOYMENT_ID/purge \
  -H "Authorization: Bearer ek_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "type": "prefix", "path": "/images/" }'
Purge type Required field Effect
single url Purge one exact URL
prefix path Purge everything under a path prefix
regex pattern Purge URLs matching a regular expression
everything None Purge the whole deployment

Purge history is available at GET /api/cdn/deployments/:id/purge-history.

Analytics#

Endpoint Description
GET /api/cdn/deployments/:id/stats Live stats snapshot
GET .../stats/history?range=24h History. range is 1h, 24h, 7d, 30d or 1y
GET .../region-stats?range=24h Traffic by region across the edge network
GET .../top-content?limit=100 Most-requested paths
GET .../cache-stats Cached object count and size
GET .../events?limit=50 Deployment activity log