Clear files from a site's CDN
/v1/sites/{siteId}/cdn/actions/purge Clears files from the CDN, so visitors get their latest version. Usually there's nothing to clear: WordPress gives updated plugin and theme files new addresses, and files changed in the panel's File Manager are cleared for you. Clear after replacing a file but keeping its name.
Send no body (or {}) to clear everything. Send paths to clear only those files and folders (one of the delivery options: 403 feature_unavailable while they aren't open to the account).
What happens next. The answer is 202 with purging: true; clearing takes a minute or two, then purging is false again and purgedAt is set. The CDN must be on (409 cdn_off). Up to 10 clears an hour per site.
Scopes
The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).
-
sites:write - Manage sites. Domains, SSL, CDN, cache, firewall, malware protection, resources, backups, staging, Media Offload, SMTP and RabbitPress Cache. Choosing Rabbitflare Backup for a site's backups, and turning on Media Offload or a site's malware protection, also need Turn on paid features: they start monthly charges.
Headers
| Field | Type and description |
|---|---|
Idempotency-Key | string 1 to 255 characters A key of your own for this request, like a UUID: letters, digits and |
Path parameters
| Field | Type and description |
|---|---|
siteId Required | string The site's id. |
Request body
JSON, with these fields. Fields that aren't listed are refused.
| Field | Type and description |
|---|---|
paths | array of strings 1 to 15 items Files or folders to clear, each inside /wp-content/ or /wp-includes/ (up to 300 characters), like /wp-content/themes/shop/style.css or a folder ending in |
Example request
curl -X POST "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/cdn/actions/purge" \
-H "Authorization: Bearer $RABBITFLARE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"paths": [
"/wp-content/themes/shop/style.css",
"/wp-content/uploads/2026/11/*"
]
}' const res = await fetch("https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/cdn/actions/purge", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RABBITFLARE_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"paths": [
"/wp-content/themes/shop/style.css",
"/wp-content/uploads/2026/11/*"
]
}),
});
if (!res.ok) throw new Error(`Rabbitflare API error ${res.status}: ${await res.text()}`);
const { data } = await res.json();
console.log(data); import { Rabbitflare } from "@rabbitflare/api";
const rf = new Rabbitflare({ token: process.env.RABBITFLARE_TOKEN });
const data = await rf.sites.cdn.purge({
siteId: "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
paths: [
"/wp-content/themes/shop/style.css",
"/wp-content/uploads/2026/11/*",
],
});
console.log(data); <?php
$ch = curl_init('https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/cdn/actions/purge');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RABBITFLARE_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'paths' => [
'/wp-content/themes/shop/style.css',
'/wp-content/uploads/2026/11/*',
],
]),
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($body === false || $status >= 400) {
throw new RuntimeException("Rabbitflare API error $status: $body");
}
print_r(json_decode($body, true)['data']); import os
import requests
response = requests.post(
"https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/cdn/actions/purge",
headers={
"Authorization": "Bearer " + os.environ["RABBITFLARE_TOKEN"],
},
json={
"paths": [
"/wp-content/themes/shop/style.css",
"/wp-content/uploads/2026/11/*",
],
},
timeout=120,
)
response.raise_for_status()
print(response.json()["data"]) Response
202 Accepted Returns the SiteCdn object in data.
The SiteCdn object's fields 28 fields
| Field | Type and description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
status | string
Known values: | ||||||||||
stage | string or null While Known values: | ||||||||||
blockedReason | string or null Why the CDN can't be switched on (or changed) for this site right now, in a sentence: the site is a staging copy, is still installing, or is on your own server or a trial server, its server is off, or its built-in address has no SSL certificate yet. Null when nothing stands in the way. | ||||||||||
domain | string or null The CDN's own address for the site's files, which the site's pages use (until a custom hostname is active). Null while the CDN is off or being set up. | ||||||||||
startedAt | string or null An ISO 8601 time, in UTC When the setup started, while | ||||||||||
enabledAt | string or null An ISO 8601 time, in UTC When the CDN came on, while it's | ||||||||||
lastError | string or null Why the setup failed (with | ||||||||||
purging | boolean Whether files are being cleared from the CDN now (it takes a minute or two). | ||||||||||
purgedAt | string or null An ISO 8601 time, in UTC When files were last cleared from the CDN. Null when they never were. | ||||||||||
usage | object or null What the CDN served for the site over the last | ||||||||||
days | integer The number of days the figures cover, up to now. | ||||||||||
requests | integer Requests the CDN served for the site. | ||||||||||
bytes | integer Bytes the CDN served for the site. | ||||||||||
deliveryOptions | boolean Whether the delivery options are open to the account: choosing the kinds of files the CDN serves and paths it leaves on the server ( | ||||||||||
settings | object What the CDN serves. It applies whenever the CDN is on; a site that never chose serves every kind and keeps no paths. | ||||||||||
types | array of strings The kinds of files the CDN serves, from the site's /wp-content and /wp-includes folders: Known values: | ||||||||||
exclude | array of strings Paths kept on the server: files whose address starts with one of them are never served from the CDN. | ||||||||||
customHostname | object or null The site's custom CDN hostname, while the CDN is on. Null when it has none, or when the delivery options aren't open to the account. | ||||||||||
hostname | string The hostname the site's files are served from, like cdn.example.com. | ||||||||||
status | string
Known values: | ||||||||||
records | array of objects The DNS records to add for it, while it's being set up. The Show its 4 fields
| ||||||||||
dnsZone | string or null The domain registered with Rabbitflare, and using Rabbitflare DNS, that the hostname is on: add the records in the control panel, on the domain's DNS page. Null when its DNS is elsewhere: add the records there. | ||||||||||
error | string or null Why setting it up failed (with | ||||||||||
addedAt | string An ISO 8601 time, in UTC When the hostname was added. |
Example response
{
"data": {
"status": "active",
"stage": null,
"blockedReason": null,
"domain": "d1a2b3c4e5f6g7.cdn.example.net",
"startedAt": null,
"enabledAt": "2026-11-18T09:42:10.000Z",
"lastError": null,
"purging": true,
"purgedAt": "2026-11-18T11:05:33.000Z",
"usage": {
"days": 7,
"requests": 184220,
"bytes": 9310442118
},
"deliveryOptions": true,
"settings": {
"types": [
"images",
"css",
"js",
"fonts",
"media",
"documents"
],
"exclude": []
},
"customHostname": null
}
} Errors
The errors this request can answer besides those every request can (a missing token, a missing scope, the rate limits). Each answer is an Error object (see Errors).
| Status and code | When, and what to do |
|---|---|
403 feature_ | This product isn't open to the account. Contact support if you'd like it opened. |
404 not_ | The resource doesn't exist, or isn't this account's. Check the id. Ids of other accounts' resources answer the same way. |
409 cdn_ | The site's CDN isn't on, and this needs it. Turn the CDN on first (POST /v1/sites/{siteId}/cdn/actions/enable) and wait until it's active. |
409 server_ | The server is being restored, and nothing else can change it or its sites until that's done. Wait until the restore finishes (the server's |
422 validation_ | One or more fields are missing or wrong. Correct the fields named in |