Pull Zones API
A pull zone puts the CDN in front of an origin you already have. CDNShark fetches from origin_url, caches at the edge, and serves at {name}.cdn.cdnshark.com, or at your own hostname. Needs an active paid service.
List pull zones
GET /api/pullzones (pullzones:read). Returns {"data": [zone, ...]}, newest first. A zone includes id, name, label, cdn_hostname, custom_hostname, origin_url, status and its cache and security settings. It also includes sign_key, the secret for signed URLs: keep it private.
Create a pull zone
POST /api/pullzones (pullzones:write)
| Field | Required | Notes |
|---|---|---|
label | yes | Your name for it, up to 100 characters. |
name | yes | Lowercase letters, digits and hyphens, up to 63 characters, unique. Becomes {name}.cdn.cdnshark.com. Cannot be changed later. |
origin_url | yes | Where to fetch from, for example https://origin.example.com. |
custom_hostname | no | Your own hostname, for example cdn.example.com. CNAME it to the zone's cdn_hostname. |
cache_ttl | no | Seconds, 0 to 31536000. Default 3600. |
is_cached | no | Default true. |
perma_cache | no | Keep objects until purged (turns caching on). |
ignore_query_strings | no | Treat /a.png?x=1 and /a.png as the same object. |
geo_block_mode, geo_countries | no | disabled, block or allow, plus comma-separated country codes. |
cors_mode | no | disabled, permissive (default) or custom, with cors_origins, cors_methods, cors_headers. |
ip_blocking_mode, ip_list | no | disabled, allow or block, plus IPs or CIDRs. |
rate_limit_mode | no | off (default), relaxed, normal, strict. |
waf_mode | no | disabled, basic, strict. |
curl -X POST https://cdnshark.com/api/pullzones \
-H "Authorization: Bearer YOUR_TOKEN" -H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"label": "Site images", "name": "site-images", "origin_url": "https://origin.example.com"}'
Returns 201 {"data": zone} with status: "pending". The zone is pushed to every edge within seconds, and then it serves traffic.
Change a pull zone
PUT /api/pullzones/{id} (pullzones:write). Send only the fields to change: any of the fields above except name. The zone is re-pushed to the edges. Returns {"data": zone}. status cannot be changed through the API (422).
Purge the cache
POST /api/pullzones/{id}/purge. See Purge Cache via API.
Delete a pull zone
DELETE /api/pullzones/{id} (pullzones:write). Removes the zone from every edge. Returns {"message": "Pull zone deleted."}.
Creating and deleting pull zones fires the pullzone.created and pullzone.deleted webhooks. See Webhooks API.