CDN, cache & logs
Per-site CDN configuration, cache layers, edge rules, and access logs. All endpoints are nested under a site and backed by Bunny.
OAuth scopes: reads require sites:read, writes require sites:write.
On top of the scope, every write on this page requires the can_modify
(edit) role on the site, and deletes generally require can_destroy —
purging a cache layer is the exception, gated on can_modify
despite being a DELETE. Without the required role the request is rejected
with 403. Endpoints that talk to Bunny return
409 cdn_not_active when the site has no pull zone, and 502 on an
upstream Bunny error.
Like all per-site endpoints, these also inherit the site-level guards — a
dunning-suspended site returns 402 service_suspended and a site pending
deletion returns 403 pending_delete. See Sites.
CDN Status
GET /api/sites/:site_id/cdn
Bunny pull-zone status & configuration. Returns 409 cdn_not_active if there
is no pull zone.
Returned Params
- active: Boolean
- cdn_type: String | "premium" or "volume"
- optimizer_enabled: Boolean
- origin_url: String
- origin_type: Integer
- enable_logging: Boolean
- origin_shield_enabled: Boolean
- auto_ssl: Boolean
- cache_control_max_age_override: Integer
- smart_cache: Boolean
- cache_enabled: Boolean
- hostnames:
Array<Object>- value: String
- force_ssl: Boolean
- has_certificate: Boolean
- is_system_hostname: Boolean
Caching Settings
The pull-zone caching configuration (smart cache, expirations, vary toggles,
stale-while-). Distinct from the Cache layer management below (which
enables/disables redis/nginx/bunny). Requires CDN active*
(409 cdn_not_active). Synchronous; upstream failures return 502.
Get Caching Settings
GET /api/sites/:site_id/cdn/caching
Scope sites:read.
Returned Params
- smart_cache: Boolean
- cache_expiration: Integer | edge cache TTL seconds;
-1= respect origin,0= cache nothing - browser_cache_expiration: Integer | browser cache TTL seconds
- query_string_ordering: Boolean
- cache_error_responses: Boolean
- vary_avif / vary_webp / vary_mobile / vary_hostname: Boolean
- vary_country_code / vary_country_state_code / vary_cookie: Boolean
- cookie_vary_parameters:
Array<String> - query_string_vary_parameters:
Array<String> - disable_cookies: Boolean
- cache_slice: Boolean
- stale_while_offline / stale_while_updating: Boolean
Update Caching Settings
PATCH /api/sites/:site_id/cdn/caching
Scope sites:write (and the can_modify role). Partial update — only the
keys you send are written. Returns the refreshed settings (same shape as the GET
above).
Params
- Any of the fields returned above. Scalars and booleans are sent as-is;
cookie_vary_parametersandquery_string_vary_parametersareArray<String>.
Purge the Cache
POST /api/sites/:site_id/cdn/caching/purge
Scope sites:write (and the can_modify role). Purges the entire pull-zone
cache. Synchronous.
A site can also request its own purge
A site's hosting container can trigger a purge from the inside — e.g. a
WordPress caching plugin flushing after a publish — through the inbound
CDN cache webhook. That path is
infrastructure-only (system API key, no OAuth) and asynchronous; the purge
shows up in the site's task history as site.cache.cdn_purge attributed to
System. As an integrator, use the endpoints on this page instead.
Cache
The :type segment is the cache layer: redis, nginx, bunny, or all
(fans out to every layer). An unknown type returns 422
{"error":"unknown_cache_type","allowed":[...]}. A layer the site's plan does
not include (some plans have no Redis, for example) returns 422
{"error":"cache_type_unavailable","cache_type":"redis"}.
Cache Status
GET /api/sites/:site_id/cache
Returned Params
- bunny: Boolean | Bunny CDN cache enabled
- nginx: Boolean
- redis: Boolean
Enable a Cache Layer
PATCH /api/sites/:site_id/cache/:type
Async — returns 202 with the task to poll. Requires the can_modify
(edit) role.
Returned Params
- task_id: Integer
- status: String |
"PENDING" - cache_type: String
Disable a Cache Layer
DELETE /api/sites/:site_id/cache/:type
Async — returns 202 (same shape as enable). Requires the can_destroy role.
Purge a Cache Layer
DELETE /api/sites/:site_id/cache/:type/purge
Async — returns 202 (same shape as enable). Requires the can_modify
(edit) role.
Edge Rules
Bunny edge rules for the site. Requires CDN active (409 cdn_not_active).
All actions are synchronous and pass through Bunny's response. :id is the rule
Guid.
List Edge Rules
GET /api/sites/:site_id/edge_rules
Create an Edge Rule
POST /api/sites/:site_id/edge_rules
Returns 201. Requires the can_modify (edit) role. Omit Guid to create;
a retried create is not idempotent (Bunny creates a duplicate) — send a
Guid (or use PATCH) to update in place.
Params (wrapped in edge_rule)
- Guid: String | omit to create
- ActionType: Integer | 0–34 (e.g. 0 = ForceSSL, 1 = Redirect, 2 = OriginUrl, 4 = BlockRequest, 5 = SetResponseHeader, 23 = DisableWAF, 28 = DisableShield)
- ActionParameter1 / ActionParameter2 / ActionParameter3: String
- TriggerMatchingType: Integer | how the rule's triggers combine: 0 = match any, 1 = match all, 2 = match none
- Description: String
- Enabled: Boolean
- OrderIndex: Integer
- Triggers:
Array<Object>| up to 5 conditions per rule (Bunny's per-rule maximum)- Type: Integer | 0 = Url, 1 = RequestHeader, 2 = ResponseHeader, 3 = UrlExtension, 4 = CountryCode, 5 = RemoteIP, 6 = UrlQueryString, 7 = RandomChance, 8 = StatusCode, 9 = RequestMethod, 10 = CookieValue, 11 = CountryStateCode, 12 = OriginRetryAttemptCount, 13 = OriginConnectionError
- PatternMatchingType: Integer | how this condition's values combine: 0 = match any, 1 = match all, 2 = match none
- Parameter1: String
- PatternMatches:
Array<String>| up to 5 values per condition (Bunny's per-condition maximum)
- ExtraActions:
Array<Object>- ActionType: Integer
- ActionParameter1 / ActionParameter2 / ActionParameter3: String
Two separate limits of 5
Bunny caps a rule at 5 Triggers (conditions) and each condition at
5 PatternMatches (values). It validates the per-rule condition count
first. Bunny's own error text inverts the vocabulary — its rejection for too
many values reads "Maximum 5 triggers are allowed per condition" — so read
the message against the rule you sent, not literally.
System-managed rules (Description prefixed CPRESS -) are filtered from the
list and are not customer-editable.
ActionType is passed straight through to Bunny, so the API accepts the full
0–34 range. A handful of those action types drive Bunny products CloudPress
does not resell (perma-cache bypass, Bunny Storage / Magic Containers origins,
edge scripting, request coalescing) and are not offered in the dashboard's
edge-rule editor; an existing rule that already uses one stays editable there.
Stick to the action types you can select in the dashboard unless you have
confirmed the underlying Bunny service is available to your zone.
Update an Edge Rule
PATCH /api/sites/:site_id/edge_rules/:id
The Guid is taken from the URL. Returns 200. Requires the can_modify
(edit) role. Full replace — fields you omit are cleared, so send the complete
rule.
Toggle an Edge Rule
PATCH /api/sites/:site_id/edge_rules/:id/enabled
Requires the can_modify (edit) role.
Params
- enabled: Boolean
Delete an Edge Rule
DELETE /api/sites/:site_id/edge_rules/:id
Returns 204. Requires the can_destroy role.
Logs
Require CDN active (409 cdn_not_active).
CDN Access Logs
GET /api/sites/:site_id/logs/cdn
Params (all optional)
- from: String | ISO8601 datetime (default: 24 hours ago)
- to: String | ISO8601 datetime (default: now)
- period: String | preset window —
1h,6h,24h,72h. Used only when bothfromandtoare blank. Unknown values → 422. - status: String | HTTP status code filter
- cache_status: String | cache status filter
- country: String | two-letter country code filter
- url_contains: String | filter by URL substring
- limit: Integer | max results (default: 100, max: 1000)
- offset: Integer | pagination offset (default: 0)
- order: String |
ascordesc(default:desc)
Errors
- 422 |
invalid_period,invalid_range, orrange_exceeds_3_days - 502 | upstream error
CDN Log Summary
GET /api/sites/:site_id/logs/cdn/summary
Aggregated statistics over the same filters as the CDN access logs endpoint.
Origin Logs
GET /api/sites/:site_id/logs/origin
Params
- date: String | date accepted by Bunny (optional)