---
title: "corestack_site_clone"
url: https://docs.corefinity.com/mcp/tools/corestack_site_clone
type: tool
last_updated: 2026-11-13
feature: copies
related:
  - https://docs.corefinity.com/api/reference/environments/clone-site.md
  - https://docs.corefinity.com/guides/sites/environments-and-copies/clone-a-site.md
---
# corestack_site_clone

**Copy a site's data.** Copy a row's files and / or database onto one of the site's environments, or onto its production row ("push to live", which overwrites production). Preview it first with corestack_site_clone_preview. Scope: write. Also needs destructive when the target is production. Also needs exec when it turns on a Node package's install scripts. Long-running: answers with a task.

- Scope: `write`
- Also needs `destructive` when the clone target is production
- Also needs `exec` when `copy_node_runtime` brings packages with install scripts on, R35
- Confirmation: `confirm_domain`, `confirm_name`
- Runs as a task: yes

## When to use it

Copy a row's files and / or database onto one of the site's environments, or onto its production row ("push to live", which overwrites production). Preview it first with corestack_site_clone_preview.

While fast copies onto existing environments are switched on, the finished task also gives `safety_snapshot_id`: the copy of the target taken before it was replaced. To undo the copy, restore that snapshot onto the target with corestack_restore_create. It is null when no safety copy was taken (`safety_first` off).

Copying onto an existing environment replaces everything in it. When corestack_copy_preview names the confirmation (`confirm.field` `confirm_name`), ask the person to type the environment's name, as the Control Panel's copy dialog does, and send it in `confirm_name` exactly as the environment is named (`confirm.expected_hint`). Whenever you send it, it must match, or nothing is started. While fast copies onto existing environments are switched on, a copy of everything (`files_db`) runs as a swap of the whole environment and the name is then always needed: without it the copy is refused `confirm_mismatch`, and nothing is started. Onto production, the confirmation is the site's domain, in `confirm_domain`, and it is always needed.

Onto production, a fast copy runs only where the website's platform can show visitors the holding page for the whole switch; elsewhere the copy uses the standard method, with nothing different to send. If the platform stops being able to show it after a fast copy has started, the copy fails before anything changed, with reason `holding_unavailable` on the operation (corestack_site_operation_get). Tell the person nothing was changed, and copy again: it then uses the standard method.

A copy that would only have to wait — another copy running or queued on either site, a change in progress on the source or the target (a deployment, a restore, a command), an environment still being set up, a snapshot slot, or the cluster changing package — is not refused: it is queued and starts on its own, first come first served on the site. The task then stays working with the queue's words as its status ("Waiting for another copy on this site to finish. It starts on its own."; the task calls the environment the copy comes from "the environment it copies from"), and follows the copy's operation once it starts (completed with `operation`, as for a copy that started at once). corestack_site_clone_preview says so beforehand (`waits[]`, `queues` true). To stop a queued copy before it starts, cancel the task (tasks/cancel, or corestack_task_cancel), or cancel it with corestack_queued_copy_cancel (corestack_environment_list lists every copy waiting onto the site's environments, however it was queued); once it has started it runs to its end. A queued copy that cannot start within 6 hours ends with `work_failed` saying what it waited for, and staff are told; a rule that fails when it finally starts (the person's rights, the typed confirmation, the sizes) ends it with `work_failed` in that rule's words, and nothing is copied. A queued copy does not start once the grant that queued it is revoked or has ended.

## Inputs

- `site_id` (integer, ≥ 1, required): The source row.
- `target` (object, required)
  - `type` (one of `environment`, `production`, required)
  - `environment_id` (integer, ≥ 1): With type environment: the environment's row.
- `scope` (one of `files_db`, `db`, `files`): What to copy (files_db).
- `safety_first` (boolean): Snapshot the target first (default true; always on production).
- `snapshot_id` (integer, ≥ 1): Copy from a ready snapshot of the source instead.
- `confirm_domain` (string, up to 253 characters): Onto production: the site's domain, typed exactly.
- `confirm_name` (string, up to 253 characters): Onto an environment: its name, typed exactly, as corestack_copy_preview asks.
- `copy_node_runtime` (boolean): Also copy the source's Node.js version and global packages to the target. Needs exec when they turn install scripts on there.
- `node_acknowledge` (array of one of `eol`, up to 1 items): With copy_node_runtime: what ack_required named, once you have told the person.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "confirm_domain": {
      "description": "Onto production: the site's domain, typed exactly.",
      "maxLength": 253,
      "type": "string"
    },
    "confirm_name": {
      "description": "Onto an environment: its name, typed exactly, as corestack_copy_preview asks.",
      "maxLength": 253,
      "type": "string"
    },
    "copy_node_runtime": {
      "description": "Also copy the source's Node.js version and global packages to the target. Needs exec when they turn install scripts on there.",
      "type": "boolean"
    },
    "node_acknowledge": {
      "description": "With copy_node_runtime: what ack_required named, once you have told the person.",
      "items": {
        "enum": [
          "eol"
        ],
        "type": "string"
      },
      "maxItems": 1,
      "type": "array"
    },
    "safety_first": {
      "description": "Snapshot the target first (default true; always on production).",
      "type": "boolean"
    },
    "scope": {
      "description": "What to copy (files_db).",
      "enum": [
        "files_db",
        "db",
        "files"
      ],
      "type": "string"
    },
    "site_id": {
      "description": "The source row.",
      "minimum": 1,
      "type": "integer"
    },
    "snapshot_id": {
      "description": "Copy from a ready snapshot of the source instead.",
      "minimum": 1,
      "type": "integer"
    },
    "target": {
      "additionalProperties": false,
      "properties": {
        "environment_id": {
          "description": "With type environment: the environment's row.",
          "minimum": 1,
          "type": "integer"
        },
        "type": {
          "enum": [
            "environment",
            "production"
          ],
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "site_id",
    "target"
  ],
  "type": "object"
}
```

## Refusals

- `confirm_mismatch`: the typed confirmation does not match, or it is missing: the site's domain onto production, or the environment's name when the copy runs as a swap. The refusal names the argument (`confirm_name`: the environment's name; `confirm_domain`: the site's domain). Ask the person for the exact value. Nothing was started.
- `copy_queued` (message: "A copy onto Staging is already waiting its turn. Cancel it first to queue another."): a copy onto that target is already queued. Wait for it to start, or cancel it (its task, or corestack_queued_copy_cancel with its id from corestack_environment_list), then call again. Nothing was started.
- `different_cluster`: the objects are on different clusters; choose rows on the same cluster.
- `too_small` (message, for example: "The target's disk is too small for the data being copied (needs 96.0 GB, has 53.7 GB). Resize the target to Medium (100 GB) or larger first."): the target environment's disk is too small for the data. When the message says to resize, ask the person to resize the target to that size with corestack_environment_resize (price it first with corestack_billing_quote_preview), then copy again. When it says production is sized by its package, or to contact support, there is no resize to make here: tell the person. Nothing was started, bought or billed. A company that turned on automatic upgrades has the target grown first instead (`target_busy` below), within the monthly limit it set.
- `target_busy` (message: "The target is growing to Medium (100 GB) first, as an automatic upgrade you turned on. Start the copy again once it has finished."): the company turned on automatic upgrades, so the copy resized the target first, priced as a resize and counted against the company's monthly limit. Follow the resize (corestack_site_operations_list on the target) and copy again once it has finished. Any other `target_busy`: the target has a change in progress; wait for it to finish.
- `invalid_arguments` on `target` beginning "The source disk is larger than the target's.": the data was not measured, so the disks are compared; the rest of the message names the size to resize the target to, or says production's package or support is needed, as for `too_small`.
- `capacity_blocked`: there is not enough capacity for this; check corecluster_capacity_check or choose another size.
- `invalid_arguments` on `target` (message: "This WordPress site is built with Bedrock, so it can only be copied to a site that deploys the same way. For a staging copy, use a branch (Git) environment."): a Bedrock site's files are copied only onto an environment that deploys the way it does (Git onto Git). Copy into a branch (Git) environment, or copy the database alone (`scope` `db`).
- `legacy_search` on `target` (message: "This site's search runs on a temporary older engine. Switch the store to the OpenSearch module first."): the source's search runs on a temporary older engine, so it is not pushed to live. Tell the person to switch the store to the OpenSearch module first; a copy into another staging environment is still allowed.
- `snapshot_transfer` on `snapshot_id` (message: "A saved snapshot can be copied only to an environment on the same servers for now, and these two environments are on different servers. Copy the live environment instead, or restore the snapshot to an environment on the same servers."): the target runs on other servers than the source (a staging environment on a tier of its own, for example), and a saved snapshot is not copied across. corestack_site_clone_preview lists it in `blockers` first. Tell the person they can copy the live environment instead (call again without `snapshot_id`), or restore the snapshot to an environment on the same servers. Nothing was started.
  Where it is switched on and both servers can, a saved snapshot on other servers is sent to the target environment's servers first instead, and the copy then runs as usual (it takes longer: the send is part of it). `snapshot_transfer` stays for a snapshot the servers cannot send.
- `ack_required`: the change needs the person's acknowledgements first; `required[]` lists them — confirm with the person, then call again with them.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- `rate_limited`: the person has started as many copies this minute as the limit allows (5 by default, shared with the Control Panel and the API). A copy that is refused does not count; one that waits its turn does. Wait `retry_after_seconds`, then call again.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_site_clone",
  "arguments": {
    "site_id": 4211,
    "target": {
      "type": "environment",
      "environment_id": 4212
    },
    "scope": "db",
    "confirm_name": "Staging"
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_site_clone with site_id 4211, target {"type":"environment","environment_id":4212}, scope db. (Copy a site's data.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [POST /api/corestack/sites/{site}/clone](https://docs.corefinity.com/api/reference/environments/clone-site.md)
- Guide: [Clone an environment](https://docs.corefinity.com/guides/sites/environments-and-copies/clone-a-site.md)
