Purge a site's Varnish cache
Removes pages from the site's Varnish cache: everything, the pages carrying a Magento cache tag, single addresses, or every address matching a pattern. A site may ask for ten purges an hour; Magento's own purges and deployments are not counted. host limits a purge by address or by pattern to one of the site's hostnames; a purge of everything or by tag always covers every hostname. Follow the command in the answer.
Path parameters
The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.
Body
The body is application/json. The request example shows its shape.
Returns
202 The purge was sent. command.status says how it went.
Fields of the 202 answer
A command on the site: a purge, or a repair of Magento's cache settings.
Fields
Why it failed, in plain words.
Format: date-time.
At least 1.
What was asked for. For a purge: its mode, the items it names and where the request came from (via). Null for a repair.
Fields
The one host the purge was limited to, when it was.
alltagsurlspatternsAlways varnish for a purge.
Where the purge was asked for, such as api.
varnish_purgemagento_varnish_configFormat: date-time.
What the command did. For a purge: the requests sent, how many were needed (requests) and whether Varnish confirmed them. For a repair: the cache Magento was set up for (mode: varnish or builtin) and whether anything had to be changed. Null until it finishes.
Fields
For a repair: whether Magento's settings had to be changed.
How many items the purge named; 1 for everything.
For a purge, its mode. For a repair, varnish or builtin: the cache Magento's settings now name.
Present only when the purge has something to warn about: a pattern broad enough to empty most of the cache, or an address too long to purge with its query variants, of which only the exact address was purged.
A site by its id and domain.
Fields
Format: date-time.
queued or running while it runs, then succeeded or failed.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | scope_required | Use a token with the scope named in scope. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
409 | command_running | Another action or command is still running on the site. Wait for it to finish, then try again. |
409 | managed_elsewhere | This site is read-only here. Change it in the control panel that manages it. |
409 | varnish_not_offered | Varnish is available for Magento 2 sites only. Nothing to change here. |
409 | varnish_off | Varnish is off on the environment. Switch it on first. |
422 | host_not_owned | A URL names a host that is not one of the site's. Purge only the site's own hosts. |
422 | invalid_arguments | The arguments do not match the tool's input schema, or the Control Panel refused a field. Fix the fields named in the answer and call again. |
422 | invalid_tags | A cache tag is not one. Send tags as the site sets them. |
429 | rate_limited | Wait for the seconds in Retry-After. |
503 | switched_off | Corefinity has switched this action off for the moment. Try again later. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/varnish/purge \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"host": null,
"include_query": false,
"mode": "urls",
"urls": [
"/gravel-bikes",
"/gravel-bikes?colour=red"
]
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->post('https://manage.corefinity.com/api/corestack/sites/1042/varnish/purge', [
'host' => null,
'include_query' => false,
'mode' => 'urls',
'urls' => [
'/gravel-bikes',
'/gravel-bikes?colour=red',
],
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/varnish/purge', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
host: null,
include_query: false,
mode: 'urls',
urls: [
'/gravel-bikes',
'/gravel-bikes?colour=red',
],
}),
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.post(
"https://manage.corefinity.com/api/corestack/sites/1042/varnish/purge",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"host": None,
"include_query": False,
"mode": "urls",
"urls": [
"/gravel-bikes",
"/gravel-bikes?colour=red",
],
},
)
data = res.json() if res.content else None{
"command": {
"blocked_until_verified": false,
"duration_ms": 840,
"error": null,
"exit_code": 0,
"finished_at": "2026-11-06T09:16:41Z",
"id": 905,
"input": {
"host": null,
"mode": "tags",
"tags": [
"cat_p_1180",
"cat_c_27"
],
"target": "varnish",
"via": "api"
},
"kind": "varnish_purge",
"label": "Varnish purged · by tag",
"operation_id": null,
"output_excerpt": "200",
"queued_at": "2026-11-06T09:16:40Z",
"requested_by": {
"id": 2041,
"name": "Eleanor Finch"
},
"result": {
"confirmed": true,
"count": 2,
"hosts": [],
"mode": "tags",
"objects": null,
"requests": 1,
"seconds": 0,
"sent": 1,
"target": "varnish"
},
"site": {
"domain": "harbourandfinch.example.com",
"id": 1042
},
"started_at": "2026-11-06T09:16:40Z",
"status": "succeeded",
"status_label": "Done"
}
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "command_running",
"message": "Another action is still running on this site. Wait for it to finish.",
"reason": "command_running"
}{
"code": "host_not_owned",
"errors": {
"urls.0": [
"old.harbourandfinch.example.org is not one of this site's hosts."
]
},
"message": "old.harbourandfinch.example.org is not one of this site's hosts.",
"offenders": [
{
"field": "urls",
"index": 0,
"message": "old.harbourandfinch.example.org is not one of this site's hosts.",
"value": "https://old.harbourandfinch.example.org/x"
}
],
"reason": "host_not_owned"
}{
"available_at": "2026-11-03T10:16:40Z",
"code": "rate_limited",
"message": "Ten purges an hour for this site have been used. The next is available in 60 minutes. Magento's own purges and deployments are not affected.",
"reason": "rate_limited",
"retry_after": 3600,
"retry_after_seconds": 3600
}{
"code": "switched_off",
"message": "Site commands are switched off at the moment",
"reason": "switched_off"
}Try it is off for this endpointIt deletes data that cannot be brought back. Copy the request and run it yourself when you are sure.