CorefinityCorefinityDocs
Open the Control PanelControl Panel
Copies · 3 of 4

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.

POST/api/corestack/sites/{site}/clone
  • Needs destructive as well: The copy goes onto production (target.type is production).
  • Needs exec as well: copy_node_runtime is true and the source's Node.js packages run install scripts the target does not run now.

Path parameters

siteintegerRequired

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

anonymiseboolean

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.

confirm_namestring

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.

copy_nginx_rulesboolean

Also copy the source's Nginx rules, once the copy has completed.

copy_node_runtimeboolean

Also copy the source's Node.js version and global packages.

copy_php_runtimeboolean

Also copy the source's PHP settings, once the copy has completed.

node_acknowledgearray of strings

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.

eol
preview_tokenstringRequired

The preview_token of previewSiteClone, asked with the same target, scope and snapshot within the last 15 minutes.

safety_firstboolean

Keep a safety copy of the target before it is replaced. Always on for a copy onto production. Defaults to true.

scopestring

What a copy takes: files and database, the database only, or files only. Defaults to files_db.

files_dbdbfiles
Fields
snapshot_idinteger

Copy from this ready snapshot of the source instead of the live environment. At least 1.

targetobjectRequired
Fields
environment_idinteger

For environment, the site row id of the environment to copy onto. It cannot be production or the source itself. At least 1.

typestringRequired

environment copies onto environment_id. production copies onto the website's production (push to live).

environmentproduction

Returns

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
operationobjectRequired

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 /corestack/operations/{operation} until status is completed or failed. Both answers have this shape; the few endpoints that answer a different one say so.

Fields
applied_atstring or null
can_retryboolean or null
clusterobject or any or null

The cluster the operation runs on.

committed_atstring or null
completed_atstring or nullRequired
created_atstring or nullRequired
environmentobject or any or null
errorstring or nullRequired

Why the operation failed, in plain words. Null unless status is failed.

failure_reasonstring or null

A stable code for the failure.

from_versionstring or null
hotboolean or null

True when the change applies without a maintenance window.

idintegerRequired
installobject or null
labelstring or null
notesarray of objects

What the operation did differently on purpose. Empty when nothing.

Fields of each item
codestringRequired
textstringRequired
parent_operation_idinteger or null
requested_byany

Who asked for the change.

reset_targetany

Present on some site creations and copies.

resultany

Always null here. A one-time result is read once with the reveal endpoint.

result_statestring
nonependingavailableviewed
retried_by_operation_idinteger or null
retries_operation_idinteger or null
retry_requiresany

What a retry needs first, if anything.

revealedany

Who revealed a one-time result and when, when there was one.

scopestringRequired
siteclusterbatch
siteobject or any or null

The website the operation belongs to. Null for a cluster's own operation.

statusstringRequired

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_outexecutingcompletedfailed
status_labelstringRequired
stepstring or null

The key of the step the operation is at. Null once it has completed.

stepsarray of objectsRequired
Fields of each item
keystring
labelstring
statestring

One of done, current, todo, failed or skipped.

subjectobject or null
summarystring or null
to_versionstring or null
typestringRequired

The kind of change, such as crons_change or redirects_change.

type_labelstringRequired
targetobjectRequired

One environment of a website, addressed by its site row.

Fields
env_idstringRequired

The environment's platform identifier.

hostnamestringRequired

The environment's own address on the platform.

idintegerRequired

The site row id, the {site} every /corestack/sites/{site} endpoint takes.

namestringRequired
rolestringRequired

The environment's role, such as production or staging.

role_labelstringRequired
slugstringRequired
Fields of the 202 answer
messagestringRequired

What the copy waits for.

queuedobjectRequired

A copy that waits its turn, as the Control Panel, this API and an MCP client all show it.

Fields
aheadinteger or nullRequired

How many copies on the same website are in front of this one. Null once it is no longer in the queue.

deadline_atstring or nullRequired

When the copy stops waiting. Six hours after it was queued, by default. Format: date-time.

ended_atstring or nullRequired

When it started, was cancelled, was refused or expired. Format: date-time.

idintegerRequired

The id getQueuedCopy and cancelQueuedCopy take. At least 1.

messagestring or nullRequired

The same in plain words. Null once it has started.

operation_idinteger or nullRequired

The copy's operation once it has started, for getOperation. At least 1.

queued_atstring or nullRequired

When the copy was queued. Format: date-time.

reasonstring or nullRequired

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.

sourceobject or any or nullRequired

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.

statestringRequired

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.

waitingstartingstartedrefusedexpiredcancelled
targetobjectRequired

An environment of a queued copy. Unlike the shared Named, name is null once the environment is gone.

Fields
idintegerRequired

The environment's site row id, the {site} of /corestack/sites/{site}. At least 1.

namestring or nullRequired

The environment's name. Null for a target that no longer exists.

reasonstringRequired
targetobjectRequired

One environment of a website, addressed by its site row.

Fields
env_idstringRequired

The environment's platform identifier.

hostnamestringRequired

The environment's own address on the platform.

idintegerRequired

The site row id, the {site} every /corestack/sites/{site} endpoint takes.

namestringRequired
rolestringRequired

The environment's role, such as production or staging.

role_labelstringRequired
slugstringRequired

If it is refused

StatusReasonWhat to do
401noneSend a valid token as Authorization: Bearer <token>.
403company_unavailableYour company is unavailable.
403scope_requiredUse a token with the scope named in scope.
403two_factor_requiredTurn on two-factor on your account, then send again.
404feature_offThis feature is not on for your organisation yet.
409busyAnother operation is running on the site. Wait for it to finish.
409clone_in_progressAnother copy is running on the site. Wait for it to finish.
409copy_queuedA copy onto Staging is already waiting its turn. Cancel it first to queue another.
409different_clusterA copy works within one cluster, and the target is in another. Choose a target in the same cluster.
409maintenanceThe site is in maintenance mode, which blocks this. Switch maintenance mode off first.
409managed_elsewhereThis site is read-only here. Change it in the control panel that manages it.
409ssh_unreachableThe environment you are copying from cannot be reached right now. Try again in a few minutes.
409target_busyThe environment to copy or restore into is busy with another change. Nothing was changed. Wait, then try again.
409too_smallThe target is too small for what it would hold. Choose a larger size.
422invalidFix the field named in field; errors says why.
422confirm_mismatchSend the confirmation exactly as the field named in field asks for it.
422legacy_searchThis site's search runs on a temporary older engine. Switch the store to the OpenSearch module first.
422snapshot_transferA 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.
429copy_limitYour company already has 3 copies or restores running. Try again when one has finished.
429rate_limitedWait for the seconds in Retry-After.
502noneRead the message; it says what happened.
503temporarily_unavailableThe 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"
    }
  }'
{
  "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"
  }
}
Try it

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.

Was this helpful?
Open in ClaudeOpen in ChatGPT