Replace a site's custom VCL
Saves the snippets sent in hooks: a snippet left out stays as it is. Send the version from the last read. The VCL is checked against the policy, compiled, saved and loaded by Varnish, which takes about a minute; one that Varnish refuses or that breaks the shop's home page is put back automatically.
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 snippets to change. One left out stays as it is; "" or null empties it.
Fields
Why, shown in the history. Up to 200 characters.
The version from the last read. At least 0.
Returns
200 Nothing to follow: the VCL is what the site already has (revision and operation null), or Varnish is off, so the VCL was saved and loads when Varnish is switched on (varnish_off: true).
202 The VCL was saved and is being loaded, which takes about a minute. Follow operation: its vcl.outcome says whether Varnish loaded it. Poll the operation until it finishes.
Fields of the 200 answer
False, present when Varnish is off.
The change to follow. Null when nothing changed.
The new revision. Null when nothing changed.
True when Varnish is off: the VCL loads when it is switched on.
What the policy warns about in the saved snippets. A warning never stops the save.
Fields of each item
The policy's rule, such as VN-POL-09; the policy explains each. Left out of a finding of the compiler, which has no rule.
The snippet it is about (recv, backend_response or deliver), or * for the policy's limit on the snippets together. Empty for a finding of the compiler about the VCL as a whole, whose line and column are 0.
What found it: the policy (policy for an error, advice for a warning) or the compiler (compile).
policycompileadviceerrorwarningWhat found it, in words, such as the Varnish version the compile ran on. Left out of a finding of the policy.
Fields of the 202 answer
False, present when Varnish is off.
The change to follow. Null when nothing changed.
The new revision. Null when nothing changed.
True when Varnish is off: the VCL loads when it is switched on.
What the policy warns about in the saved snippets. A warning never stops the save.
Fields of each item
The policy's rule, such as VN-POL-09; the policy explains each. Left out of a finding of the compiler, which has no rule.
The snippet it is about (recv, backend_response or deliver), or * for the policy's limit on the snippets together. Empty for a finding of the compiler about the VCL as a whole, whose line and column are 0.
What found it: the policy (policy for an error, advice for a warning) or the compiler (compile).
policycompileadviceerrorwarningWhat found it, in words, such as the Varnish version the compile ran on. Left out of a finding of the policy.
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 | busy | Another operation is running on the site. Wait for it to finish. |
409 | managed_elsewhere | This site is read-only here. Change it in the control panel that manages it. |
409 | stale | What you read has changed since you read it. Read it again, then send the change with its new version or quote. |
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 | invalid | Fix the field named in field; errors says why. |
422 | vcl_invalid | The VCL breaks a rule of the platform. Nothing was saved. Fix what the message names. |
422 | vcl_locked | Corefinity manages this environment's VCL. Contact support to change it. |
429 | rate_limited | Wait for the seconds in Retry-After. |
503 | upstream_unavailable | A service the action depends on did not answer. Try again later. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X PUT https://manage.corefinity.com/api/corestack/sites/1042/varnish/vcl \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"hooks": {
"backend_response": "if (bereq.url ~ \"^/size-guides/\") { set beresp.ttl = 1d; }"
},
"note": "Cache the size guides for a day",
"version": 1
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->put('https://manage.corefinity.com/api/corestack/sites/1042/varnish/vcl', [
'hooks' => [
'backend_response' => 'if (bereq.url ~ "^/size-guides/") { set beresp.ttl = 1d; }',
],
'note' => 'Cache the size guides for a day',
'version' => 1,
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/varnish/vcl', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
hooks: {
backend_response: 'if (bereq.url ~ "^/size-guides/") { set beresp.ttl = 1d; }',
},
note: 'Cache the size guides for a day',
version: 1,
}),
});
// 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.put(
"https://manage.corefinity.com/api/corestack/sites/1042/varnish/vcl",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"hooks": {
"backend_response": "if (bereq.url ~ \"^/size-guides/\") { set beresp.ttl = 1d; }",
},
"note": "Cache the size guides for a day",
"version": 1,
},
)
data = res.json() if res.content else None{
"operation": null,
"revision": null
}{
"operation": {
"applied_at": null,
"can_retry": false,
"cluster": {
"id": 1017,
"name": "Northwind UK 1"
},
"committed_at": "2026-11-06T09:16:40Z",
"completed_at": null,
"created_at": "2026-11-06T09:16:40Z",
"environment": {
"env_id": "rs-harbourandfinch-example-com",
"hostname": "harbourandfinch-example-com.northwind.cfstack.example.net",
"id": 1042,
"name": "Production",
"role": "production",
"role_label": "Production",
"slug": "production"
},
"error": null,
"failure_reason": null,
"from_version": null,
"hot": false,
"id": 5125,
"install": null,
"label": "Loaded by Varnish",
"notes": [],
"parent_operation_id": null,
"requested_by": {
"id": 2041,
"name": "Eleanor Finch"
},
"reset_target": null,
"result": null,
"result_state": "none",
"retried_by_operation_id": null,
"retries_operation_id": null,
"retry_requires": null,
"revealed": null,
"scope": "site",
"site": {
"domain": "harbourandfinch.example.com",
"id": 1042
},
"status": "committed",
"status_label": "Waiting for the platform",
"step": "loaded",
"steps": [
{
"key": "policy",
"label": "Checked against the policy",
"state": "done"
},
{
"key": "compiled",
"label": "Compiled",
"state": "done"
},
{
"key": "loaded",
"label": "Loaded by Varnish",
"state": "current"
},
{
"key": "checked",
"label": "Checked",
"state": "todo"
}
],
"subject": null,
"summary": "Varnish VCL",
"to_version": null,
"type": "varnish_vcl_change",
"type_label": "Varnish VCL"
},
"revision": {
"number": 2,
"status": "saving"
},
"warnings": []
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "busy",
"message": "Another change to this site is in progress. Wait for it to finish.",
"reason": "busy"
}{
"code": "invalid",
"errors": {
"hooks": [
"hooks is an object of recv, backend_response and deliver, each text or null."
]
},
"field": "hooks",
"message": "hooks is an object of recv, backend_response and deliver, each text or null.",
"reason": "invalid"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}{
"code": "upstream_unavailable",
"message": "The environment's files could not be read. Try again in a minute.",
"reason": "upstream_unavailable"
}Try it is off for this endpointIt overwrites data that cannot be brought back. Copy the request and run it yourself when you are sure.