Purging cache via the API
Purging clears cached content so the next visitor gets fresh bytes from your origin. This guide is task-focused; the exact request/response contract lives in the API reference. All examples authenticate with an API key in the X-API-Key header.
How purge works (read this first)โ
A purge is asynchronous. The API enqueues the work and responds 200 immediately with a job count โ that means the jobs were queued, not that the cache has already cleared. The background worker then applies the purge to every active hostname, across all Origin Shields first and then all healthy PoP nodes.
A 200 response with a jobCount confirms the purge was accepted and queued. It is fire-and-forget โ there is no callback or status to confirm the cache actually cleared. Allow a short propagation window before re-testing.
Single purgeโ
POST /api/property/{id}/purge
Body:
{ "type": "All", "value": null, "matchType": null }
Purge typesโ
type | Meaning | value |
|---|---|---|
All | Purge everything for the property | Omitted / ignored |
Extension | Purge files with a given extension | Required (for example jpg) |
Path | Purge a specific path | Required (for example /images/logo.png) |
Regex | Purge by pattern | Required (the pattern) |
type is required and case-insensitive. There is no separate wildcard or tag field โ wildcard-style purging is done with type: "Regex".
Match type (Regex only)โ
matchType is honored only when type is Regex. For Extension and Path it is ignored.
matchType | Behavior |
|---|---|
equals | Exact match |
contains | Substring match |
starts_with | Prefix match |
ends_with | Suffix match |
regex | Regular-expression match (default when omitted or blank) |
Examplesโ
Purge everything:
curl -X POST https://api.paradarum.com/api/property/123/purge \
-H "X-API-Key: pdm_YOUR_RAW_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "type": "All" }'
Purge a single path:
curl -X POST https://api.paradarum.com/api/property/123/purge \
-H "X-API-Key: pdm_YOUR_RAW_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "type": "Path", "value": "/images/logo.png" }'
Purge by extension:
curl -X POST https://api.paradarum.com/api/property/123/purge \
-H "X-API-Key: pdm_YOUR_RAW_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "type": "Extension", "value": "jpg" }'
Purge by pattern with a match type:
curl -X POST https://api.paradarum.com/api/property/123/purge \
-H "X-API-Key: pdm_YOUR_RAW_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "type": "Regex", "value": "/blog/", "matchType": "starts_with" }'
Success responseโ
{
"succeeded": true,
"message": "Purge request accepted. 12 jobs queued across 2 shields + 4 PoPs.",
"data": { "jobCount": 12, "shields": 2, "nodes": 4, "hostnames": 1 }
}
Batch purgeโ
Combine several instructions into one round-trip.
POST /api/property/{id}/purge/batch
curl -X POST https://api.paradarum.com/api/property/123/purge/batch \
-H "X-API-Key: pdm_YOUR_RAW_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"items": [
{ "type": "All" },
{ "type": "Path", "value": "/index.html" },
{ "type": "Extension", "value": "css" },
{ "type": "Regex", "value": "^/assets/", "matchType": "regex" }
]
}'
Each item has the same shape as a single purge and is validated independently. Valid items are queued; invalid ones are reported back in rejected, each with its index and a reason.
{
"succeeded": true,
"message": "...",
"data": {
"jobCount": 12,
"accepted": 3,
"rejected": [{ "index": 1, "reason": "Value is required..." }],
"shields": 2,
"nodes": 4,
"hostnames": 1
}
}
A single invalid item never fails the whole request โ it lands in rejected[] while the valid items proceed. The batch only returns 400 when every item is invalid (or the items array is empty).
Guards and error responsesโ
A purge can be blocked before anything is queued. Branch on the HTTP status and read the message.
| Status | When it happens | Example message |
|---|---|---|
400 | Missing/invalid type or value; empty batch; no active hostnames | No active hostnames found for this property. |
403 | Property is disabled or suspended | This property is currently {status}... Configuration changes are not allowed until it is re-enabled. |
404 | Property not found, or owned by another account | Property not found. |
500 | No healthy, traffic-enabled PoP nodes available | No active cache nodes found. |
The property must have at least one Active hostname (otherwise 400) and at least one healthy PoP node (otherwise 500). A disabled or suspended property rejects purges with 403.
Automate from WordPress or PrestaShopโ
CMS purge plugins call these same endpoints โ typically purge after a single post or product changes, and purge/batch to clear several paths at once.
Paradarum ships official, ready-to-install plugins that do exactly this for you โ no code required:
Create a separate, descriptively named API key for each site (for example Production WordPress). If a site is decommissioned or a key leaks, revoke just that key without disrupting your other integrations.
Related pagesโ
- Authentication โ the
X-API-Keyheader in detail. - Manage API keys โ create and revoke the key your automation uses.
- API reference โ the full purge request/response contract.