---
title: "Preview a copy onto an environment"
url: https://docs.corefinity.com/api/reference/environments/preview-site-clone
type: endpoint
last_updated: 2026-11-13
feature: copies
related:
  - https://docs.corefinity.com/guides/sites/environments-and-copies/clone-a-site.md
  - https://docs.corefinity.com/mcp/tools/corestack_site_clone_preview.md
---
# Preview a copy onto an environment

Checks a copy of `{site}` onto another environment: what would move, what blocks it now (`blockers`), what
it would wait for (`waits`), and the `preview_token` that `cloneSite` must quote within 15 minutes. Ask with
the same target, scope and snapshot you will send; you need to be able to change both environments.

```http
GET /api/corestack/sites/{site}/clone/preview
```

- Scope: `read`
- Two-factor: required on your account (all)
- Rate limit: 60 a minute
- Try it in the console: on

## Path parameters

- `site` (integer, required): The id of a site row. A website's production site and each of its environments has its own id. Digits only.

## Query parameters

- `target_type` (string): `environment` (with `target_id`) or `production`, which copies onto the website's production.
- `target_id` (integer): For `environment`, the site row id of the environment to copy onto.
- `scope` (string): What to copy. Files and database when left out.
- `snapshot_id` (integer): Copy from this snapshot of the source instead of the live environment.
- `anonymise` (boolean): Ask about an anonymised copy (Shopware only). `true` or `false`; `1` and `0` are taken too, and anything else is refused `invalid`.

## Request

### curl

```bash
curl https://manage.corefinity.com/api/corestack/sites/1042/clone/preview \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json"
```

### PHP

```php
use Illuminate\Support\Facades\Http;

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->get('https://manage.corefinity.com/api/corestack/sites/1042/clone/preview');

$data = $response->json();
```

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/clone/preview', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
  },
});

// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);
```

### Python

```python
import os
import requests

res = requests.get(
    "https://manage.corefinity.com/api/corestack/sites/1042/clone/preview",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
)

data = res.json() if res.content else None
```

## Responses

### 200 The preview. `can_proceed` says whether a copy sent now would be taken.

```json
{
  "blockers": [],
  "can_proceed": true,
  "crypt_match": null,
  "estimated_seconds": null,
  "estimated_switch_seconds": 30,
  "expected_switch": {
    "compute": {
      "from": null,
      "to": null
    },
    "crosses_tier": false,
    "note": null,
    "storage": {
      "from": null,
      "to": null
    }
  },
  "expires_at": "2026-11-03T07:15:00Z",
  "fixups": [
    "URLs rewritten to harbourandfinch-example-com-staging.northwind.cfstack.example.net",
    "Crons switched off",
    "Outbound mail captured by Mailpit",
    "Search engines blocked (noindex)",
    "WordPress admin password reset (shown once)"
  ],
  "preview_token": "cp_Xq7mR2vK9sLp4TzW8nBd",
  "queues": false,
  "safety_snapshot": true,
  "scope": "files_db",
  "sizes": {
    "basis": null,
    "copied_bytes": null,
    "db_bytes": null,
    "files_bytes": null,
    "measured_at": null,
    "scratch_bytes": null,
    "used_bytes": null
  },
  "source": {
    "env_id": "rs-northwind-harbourandfinch-example-com",
    "hostname": "harbourandfinch-example-com.northwind.cfstack.example.net",
    "id": 1042,
    "name": "Production",
    "platform": "wordpress",
    "role": "production",
    "role_label": "Production",
    "slug": "production",
    "tier": "S"
  },
  "steps": [
    {
      "key": "snapshot",
      "label": "Snapshots taken"
    },
    {
      "key": "bound",
      "label": "Prepared on the cluster"
    },
    {
      "key": "holding",
      "label": "Disk slot held"
    },
    {
      "key": "stopped",
      "label": "Target stopped"
    },
    {
      "key": "copied",
      "label": "Data copied"
    },
    {
      "key": "started",
      "label": "Target started"
    },
    {
      "key": "fixups",
      "label": "Target adjusted"
    },
    {
      "key": "cleanup",
      "label": "Tidied up"
    }
  ],
  "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",
    "tier": "S"
  },
  "target_disk": {
    "free_bytes": null,
    "size_bytes": 10737418240,
    "used_bytes": null
  },
  "target_growth": null,
  "waits": []
}
```

### 401 No token, or a token that is not valid.

```json
{
  "message": "Unauthenticated."
}
```

### 403 The token lacks the scope (`scope_required`, with the `scope` to use), your company requires two-factor authentication and you have not set it up, or your account has no company that can use Managed Clusters, for example because the company was closed (`company_unavailable` or `company_not_enabled`, whichever the route checks first). For Managed Clusters routes; any other route uses `ForbiddenScopeOrTwoFactor`.

```json
{
  "code": "company_unavailable",
  "message": "Your company is unavailable.",
  "reason": "company_unavailable"
}
```

### 404 The id does not exist or is something you cannot see, or the feature is not on for your company (`feature_off`).

```json
{
  "code": "feature_off",
  "message": "Not found.",
  "reason": "feature_off"
}
```

### 422 The target type, the scope or another parameter is not a value the preview takes (`invalid`).

```json
{
  "code": "invalid",
  "errors": {
    "anonymise": [
      "Anonymise is true or false"
    ]
  },
  "field": "anonymise",
  "message": "Anonymise is true or false",
  "reason": "invalid"
}
```

### 429 Too many requests (`rate_limited`). Wait for the number of seconds in `Retry-After`, which `retry_after_seconds` repeats.

```json
{
  "code": "rate_limited",
  "message": "Too many requests. Try again in 60 seconds.",
  "reason": "rate_limited",
  "retry_after_seconds": 60
}
```

## If it is refused

| Status | Reason | What to do |
|---|---|---|
| 401 |  | 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. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Clone an environment](https://docs.corefinity.com/guides/sites/environments-and-copies/clone-a-site.md)
- MCP tool: [`corestack_site_clone_preview`](https://docs.corefinity.com/mcp/tools/corestack_site_clone_preview.md)
