CDNShark Documentation

Customer API

← Back to Documentation

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)

FieldRequiredNotes
labelyesYour name for it, up to 100 characters.
nameyesLowercase letters, digits and hyphens, up to 63 characters, unique. Becomes {name}.cdn.cdnshark.com. Cannot be changed later.
origin_urlyesWhere to fetch from, for example https://origin.example.com.
custom_hostnamenoYour own hostname, for example cdn.example.com. CNAME it to the zone's cdn_hostname.
cache_ttlnoSeconds, 0 to 31536000. Default 3600.
is_cachednoDefault true.
perma_cachenoKeep objects until purged (turns caching on).
ignore_query_stringsnoTreat /a.png?x=1 and /a.png as the same object.
geo_block_mode, geo_countriesnodisabled, block or allow, plus comma-separated country codes.
cors_modenodisabled, permissive (default) or custom, with cors_origins, cors_methods, cors_headers.
ip_blocking_mode, ip_listnodisabled, allow or block, plus IPs or CIDRs.
rate_limit_modenooff (default), relaxed, normal, strict.
waf_modenodisabled, 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.