---
title: "Copy the environment again"
url: https://docs.corefinity.com/api/reference/enterprise/resync-enterprise-copy
type: endpoint
last_updated: 2026-11-13
feature: enterprise-copies
related:
  - https://docs.corefinity.com/guides/corestack-enterprise/websites-and-environments.md
---
# Copy the environment again

Copies the environment into the same site again, once this copy's run has ended: the answer is a new copy
whose `copy_of` is this one. Only the site's latest copy can be re-synced, whether it is resting, finished
or failed; the site and the environment are checked again as a start checks them, and `confirm_target_site`
is asked again because everything the site holds is replaced.

```http
POST /api/enterprise-copies/{copy}/resync
```

- Scope: `write`
- Two-factor: required on your account (all)
- Rate limit: 5 a minute
- Long-running: answers with an operation to poll
- Try it in the console: off. It overwrites data that cannot be brought back. Copy the request and run it yourself when you are sure.

## Path parameters

- `copy` (integer, required): The id of a copy, as a start or a re-sync answers it. Digits only; 0 or an id above 2147483647 is refused `422`.

## Body

- `confirm_target_site` (string, required): The name of the copy's site, as the preview answers it in `confirm`.

## Request

### curl

```bash
curl -X POST https://manage.corefinity.com/api/enterprise-copies/6201/resync \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "confirm_target_site": "harbourandfinch-example-com-trial"
  }'
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->post('https://manage.corefinity.com/api/enterprise-copies/6201/resync', [
        'confirm_target_site' => 'harbourandfinch-example-com-trial',
    ]);

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

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/enterprise-copies/6201/resync', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    confirm_target_site: 'harbourandfinch-example-com-trial',
  }),
});

// 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.post(
    "https://manage.corefinity.com/api/enterprise-copies/6201/resync",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "confirm_target_site": "harbourandfinch-example-com-trial",
    },
)

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

## Responses

### 202 A new copy started. Follow it at `poll`.

```json
{
  "copy": {
    "copied": null,
    "copied_at": null,
    "copy_of": 6201,
    "created_at": "2026-11-03T14:30:00+00:00",
    "database_bytes": 10737418240,
    "error": null,
    "failure_reason": null,
    "files_bytes": 32212254720,
    "finishable": false,
    "finished_at": null,
    "id": 6202,
    "operation": {
      "id": 5143,
      "status": "executing",
      "step": "protected"
    },
    "phase": "presync",
    "source_environment_id": 1311,
    "state": "running",
    "step": "guard",
    "superseded_by": null,
    "target_cluster_id": 1017,
    "target_site_id": 1081,
    "unactivated_at": null
  },
  "poll": "/api/enterprise-copies/6202"
}
```

### 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), or your company requires two-factor authentication and you have not set it up. For routes outside Managed Clusters.

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

### 404 The id does not exist, or it is something you cannot see. Both answer the same body.

```json
{
  "message": "Not found."
}
```

### 409 The copy cannot be made again now. `copy_running` (its run has not ended), `copy_not_latest` (a newer copy of the site exists), `target_not_ready` (the site is gone), `managed_elsewhere`, or any reason a start refuses with, judged again on the site and the environment as they are now.

```json
{
  "code": "copy_not_latest",
  "message": "A newer copy of this site exists: re-sync that one.",
  "reason": "copy_not_latest"
}
```

### 422 An id is missing or is not a whole number from 1 to 2147483647 (`invalid`; `copy` names the id in the path), or `confirm_target_site` is missing or is not the site's name (`confirm_mismatch`).

```json
{
  "code": "confirm_mismatch",
  "field": "confirm_target_site",
  "message": "Type the site's name (harbourandfinch-example-com-trial) to confirm: the copy replaces its files and its database.",
  "reason": "confirm_mismatch"
}
```

### 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 |  | Check the id. You see only what your account can reach. |
| 409 | `copy_not_latest` | A newer copy of the site exists. Re-sync that one. |
| 409 | `copy_running` | The copy is still running. Wait for its run to end. |
| 422 | `confirm_mismatch` | Send the confirmation exactly as the field named in `field` asks for it. |
| 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: [Websites and environments](https://docs.corefinity.com/guides/corestack-enterprise/websites-and-environments.md)
