Copy an environment onto another
Copies {site} onto another environment of its website, or onto production (push to live), replacing what is there; quote the preview_token of previewSiteClone. A copy that starts answers 201 with its operation; one that has to wait for something still running answers 202 and starts by itself (getQueuedCopy). A copy onto production keeps a safety copy first and needs confirm_name set to the website's domain.
- Needs
destructiveas well: The copy goes onto production (target.typeisproduction). - Needs
execas well:copy_node_runtimeis true and the source's Node.js packages run install scripts the target does not run now.
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
Make an anonymised copy. Shopware only, from the live database, never onto production. A value that is not true or false, and an anonymised copy that cannot be made, are refused invalid.
For an environment, its name, typed exactly: checked whenever it is sent, and required when the copy replaces the whole environment. For production, the website's domain, always required.
Also copy the source's Nginx rules, once the copy has completed.
Also copy the source's Node.js version and global packages.
Also copy the source's PHP settings, once the copy has completed.
With copy_node_runtime, what you acknowledge about the Node.js version being copied. Only eol, for a version past its end of life, and at most once. Up to 1 items.
eolThe preview_token of previewSiteClone, asked with the same target, scope and snapshot within the last 15 minutes.
Keep a safety copy of the target before it is replaced. Always on for a copy onto production. Defaults to true.
What a copy takes: files and database, the database only, or files only. Defaults to files_db.
files_dbdbfilesFields
Copy from this ready snapshot of the source instead of the live environment. At least 1.
Fields
For environment, the site row id of the environment to copy onto. It cannot be production or the source itself. At least 1.
environment copies onto environment_id. production copies onto the website's production (push to live).
environmentproductionReturns
201 The copy started. Follow operation.id with getOperation until it completes.
202 The copy waits its turn (reason is queued) and starts by itself when what it waits for has finished. Read it with getQueuedCopy and queued.id; cancel it with cancelQueuedCopy. Poll the operation until it finishes.
Fields of the 201 answer
A change the Control Panel is making or has made. A save or an action that starts work answers one in operation; read it again by id with GET / until status is completed or failed. Both answers have this shape; the few endpoints that answer a different one say so.
Fields
The cluster the operation runs on.
Why the operation failed, in plain words. Null unless status is failed.
A stable code for the failure.
True when the change applies without a maintenance window.
What the operation did differently on purpose. Empty when nothing.
Fields of each item
Who asked for the change.
Present on some site creations and copies.
Always null here. A one-time result is read once with the reveal endpoint.
nonependingavailableviewedWhat a retry needs first, if anything.
Who revealed a one-time result and when, when there was one.
siteclusterbatchThe website the operation belongs to. Null for a cluster's own operation.
Where a change is. completed and failed are final; every other status means the change is still running and blocks another change to the same site.
pendingcommittedrolling_outexecutingcompletedfailedThe key of the step the operation is at. Null once it has completed.
Fields of each item
One of done, current, todo, failed or skipped.
The kind of change, such as crons_change or redirects_change.
One environment of a website, addressed by its site row.
Fields
The environment's platform identifier.
The environment's own address on the platform.
The site row id, the {site} every /corestack/sites/{site} endpoint takes.
The environment's role, such as production or staging.
Fields of the 202 answer
What the copy waits for.
A copy that waits its turn, as the Control Panel, this API and an MCP client all show it.
Fields
How many copies on the same website are in front of this one. Null once it is no longer in the queue.
When the copy stops waiting. Six hours after it was queued, by default. Format: date-time.
When it started, was cancelled, was refused or expired. Format: date-time.
The id getQueuedCopy and cancelQueuedCopy take. At least 1.
The same in plain words. Null once it has started.
The copy's operation once it has started, for getOperation. At least 1.
When the copy was queued. Format: date-time.
A stable code for why it waits or why it ended, such as target_busy, clone_in_progress, busy, snapshot_slot, cancelled, access_ended or two_factor_required. Null once it has started.
The environment the copy comes from. Null when you may not see that environment (a copy from another website), where message calls it "the environment it copies from", and when it no longer exists.
waiting or starting while it is in the queue; started once the copy runs (follow operation_id); refused when a rule failed as it started, or the access that queued it has ended; expired when it could not start before deadline_at; cancelled.
waitingstartingstartedrefusedexpiredcancelledAn environment of a queued copy. Unlike the shared Named, name is null once the environment is gone.
Fields
The environment's site row id, the {site} of /corestack/sites/{site}. At least 1.
The environment's name. Null for a target that no longer exists.
One environment of a website, addressed by its site row.
Fields
The environment's platform identifier.
The environment's own address on the platform.
The site row id, the {site} every /corestack/sites/{site} endpoint takes.
The environment's role, such as production or staging.
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 | clone_in_progress | Another copy is running on the site. Wait for it to finish. |
409 | copy_queued | A copy onto Staging is already waiting its turn. Cancel it first to queue another. |
409 | different_cluster | A copy works within one cluster, and the target is in another. Choose a target in the same cluster. |
409 | maintenance | The site is in maintenance mode, which blocks this. Switch maintenance mode off first. |
409 | managed_elsewhere | This site is read-only here. Change it in the control panel that manages it. |
409 | ssh_unreachable | The environment you are copying from cannot be reached right now. Try again in a few minutes. |
409 | target_busy | The environment to copy or restore into is busy with another change. Nothing was changed. Wait, then try again. |
409 | too_small | The target is too small for what it would hold. Choose a larger size. |
422 | invalid | Fix the field named in field; errors says why. |
422 | confirm_mismatch | Send the confirmation exactly as the field named in field asks for it. |
422 | legacy_search | This site's search runs on a temporary older engine. Switch the store to the OpenSearch module first. |
422 | snapshot_transfer | A saved snapshot can be copied only to an environment on the same servers for now. Copy the live environment instead, or restore the snapshot first. |
429 | copy_limit | Your company already has 3 copies or restores running. Try again when one has finished. |
429 | rate_limited | Wait for the seconds in Retry-After. |
502 | none | Read the message; it says what happened. |
503 | temporarily_unavailable | The Control Panel could not answer just now. Nothing was started; try again shortly. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/clone \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"confirm_name": "Staging",
"preview_token": "cp_Xq7mR2vK9sLp4TzW8nBd",
"safety_first": true,
"scope": "files_db",
"target": {
"environment_id": 1043,
"type": "environment"
}
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->post('https://manage.corefinity.com/api/corestack/sites/1042/clone', [
'confirm_name' => 'Staging',
'preview_token' => 'cp_Xq7mR2vK9sLp4TzW8nBd',
'safety_first' => true,
'scope' => 'files_db',
'target' => [
'environment_id' => 1043,
'type' => 'environment',
],
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/clone', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
confirm_name: 'Staging',
preview_token: 'cp_Xq7mR2vK9sLp4TzW8nBd',
safety_first: true,
scope: 'files_db',
target: {
environment_id: 1043,
type: 'environment',
},
}),
});
// 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/clone",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"confirm_name": "Staging",
"preview_token": "cp_Xq7mR2vK9sLp4TzW8nBd",
"safety_first": True,
"scope": "files_db",
"target": {
"environment_id": 1043,
"type": "environment",
},
},
)
data = res.json() if res.content else None{
"operation": {
"applied_at": null,
"can_retry": false,
"cluster": {
"id": 1017,
"name": "Northwind UK 1"
},
"committed_at": null,
"completed_at": null,
"created_at": "2026-11-03T07:00:00Z",
"environment": {
"env_id": "rs-northwind-harbourandfinch-example-com--staging",
"hostname": "harbourandfinch-example-com-staging.northwind.cfstack.example.net",
"id": 1043,
"name": "Staging",
"role": "staging",
"role_label": "Staging",
"slug": "staging"
},
"error": null,
"failure_reason": null,
"from_version": null,
"hot": false,
"id": 5120,
"install": null,
"label": "Snapshots taken",
"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": 1043
},
"status": "executing",
"status_label": "Taking the source snapshot",
"step": "snapshot",
"steps": [
{
"key": "snapshot",
"label": "Snapshots taken",
"state": "current"
},
{
"key": "bound",
"label": "Prepared on the cluster",
"state": "todo"
},
{
"key": "holding",
"label": "Disk slot held",
"state": "todo"
},
{
"key": "stopped",
"label": "Target stopped",
"state": "todo"
},
{
"key": "copied",
"label": "Data copied",
"state": "todo"
},
{
"key": "started",
"label": "Target started",
"state": "todo"
},
{
"key": "fixups",
"label": "Target adjusted",
"state": "todo"
},
{
"key": "cleanup",
"label": "Tidied up",
"state": "todo"
}
],
"subject": null,
"summary": "Staging ← Production (files and database)",
"to_version": null,
"type": "clone",
"type_label": "Clone"
},
"target": {
"env_id": "rs-northwind-harbourandfinch-example-com--staging",
"hostname": "harbourandfinch-example-com-staging.northwind.cfstack.example.net",
"id": 1043,
"name": "Staging",
"role": "staging",
"role_label": "Staging",
"slug": "staging"
}
}{
"message": "Waiting for the change in progress on Staging to finish. It starts on its own.",
"queued": {
"ahead": 0,
"deadline_at": "2026-11-03T13:00:00Z",
"ended_at": null,
"id": 6120,
"message": "Waiting for the change in progress on Staging to finish. It starts on its own.",
"operation_id": null,
"queued_at": "2026-11-03T07:00:00Z",
"reason": "target_busy",
"source": {
"id": 1042,
"name": "Production"
},
"state": "waiting",
"target": {
"id": 1043,
"name": "Staging"
}
},
"reason": "queued",
"target": {
"env_id": "rs-northwind-harbourandfinch-example-com--staging",
"hostname": "harbourandfinch-example-com-staging.northwind.cfstack.example.net",
"id": 1043,
"name": "Staging",
"role": "staging",
"role_label": "Staging",
"slug": "staging"
}
}{
"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": "The source environment has a change in progress. Wait for it to finish.",
"reason": "busy"
}{
"code": "invalid",
"errors": {
"anonymise": [
"An anonymised copy is offered on Shopware only"
]
},
"field": "anonymise",
"message": "An anonymised copy is offered on Shopware only",
"reason": "invalid"
}{
"code": "copy_limit",
"message": "Your company already has 3 copies or restores running. Try again when one has finished.",
"reason": "copy_limit"
}{
"message": "Live status is unavailable. Try again in a minute."
}{
"code": "temporarily_unavailable",
"message": "We can't make this copy right now. Nothing was changed. Try again in a few minutes; contact support if it keeps happening.",
"reason": "temporarily_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.