CDN API
Manage CDN deployments, domains, SSL, caching, and analytics under
/api/cdn.
All endpoints require authentication.
Quick Start
A deployment is a container for one or more domains, each with its own origin and cache settings:
# 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 & SSL
| Endpoint | Description |
|---|---|
| POST /api/cdn/deployments/:id/domains | Add a domain — { domain, originType?, origin?, storageBucket?, cacheTtlSeconds?, jitImageEnabled? } |
| PATCH /api/cdn/deployments/:id/domains/:domainId | Update origin, TTL, image optimization, 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 |
| GET .../domains/:domainId/stats | Per-domain traffic stats |
originType is url (default, requires origin)
or storage (requires storageBucket — serve directly from
Edge Storage).
Cache Purging
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 | — | 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 |