---
title: "Copy error pages to another environment"
url: https://docs.corefinity.com/api/reference/site-settings/copy-site-error-pages
type: endpoint
last_updated: 2026-11-13
feature: error-pages
related:
  - https://docs.corefinity.com/guides/sites/site-settings/error-and-maintenance-pages.md
  - https://docs.corefinity.com/mcp/tools/corestack_error_pages_copy.md
---
# Copy error pages to another environment

Copies this environment's settings and pages onto another environment of the same company, as a new revision there, for example to promote staging's pages to production. `version` is the other environment's. Copying onto a production environment needs `confirm_production: true`.

```http
POST /api/corestack/sites/{site}/error-pages/copy
```

- Scope: `write`
- Two-factor: required on your account (all)
- Rate limit: 60 a minute; 20 a minute for each environment
- 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

- `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.

## Body

- `confirm_production` (boolean): Must be true to copy onto a production environment.
- `note` (string or null): Why, shown in the history. Only its first 200 characters are kept.
- `to_site_id` (integer, required): The id of the environment to copy onto.
- `version` (integer, required): The `version` from the last read of the environment copied onto.

## Request

### curl

```bash
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/error-pages/copy \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "confirm_production": true,
    "note": "Promote the staging pages",
    "to_site_id": 1042,
    "version": 2
  }'
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->post('https://manage.corefinity.com/api/corestack/sites/1042/error-pages/copy', [
        'confirm_production' => true,
        'note' => 'Promote the staging pages',
        'to_site_id' => 1042,
        'version' => 2,
    ]);

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

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/error-pages/copy', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    confirm_production: true,
    note: 'Promote the staging pages',
    to_site_id: 1042,
    version: 2,
  }),
});

// 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/corestack/sites/1042/error-pages/copy",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "confirm_production": True,
        "note": "Promote the staging pages",
        "to_site_id": 1042,
        "version": 2,
    },
)

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

## Responses

### 200 The site already has that configuration. Nothing was started.

```json
{
  "operation": null,
  "revision": null
}
```

### 201 The change was saved as a new revision. Follow `operation`.

```json
{
  "operation": {
    "can_retry": false,
    "completed_at": null,
    "created_at": "2026-11-06T09:16:40Z",
    "error": null,
    "id": 5123,
    "outcome": null,
    "status": "committed",
    "steps": [
      {
        "at": "2026-11-06T09:16:40Z",
        "detail": "No problems",
        "key": "check",
        "label": "Check",
        "state": "done"
      },
      {
        "at": null,
        "detail": null,
        "key": "commit",
        "label": "Commit",
        "state": "current"
      },
      {
        "at": null,
        "detail": null,
        "key": "apply",
        "label": "Apply",
        "state": "todo"
      },
      {
        "at": null,
        "detail": null,
        "key": "verify",
        "label": "Verify",
        "state": "todo"
      }
    ]
  },
  "revision": {
    "id": 313,
    "number": 3,
    "status": "applying"
  },
  "warnings": []
}
```

### 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 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"
}
```

### 409 The change was refused because of the site's state. `reason` says why: `stale` (somebody saved since your read: read the pages again and send the new `version`), `operation_in_progress` (another change to the site has not finished), `restore_running` (a restore of the site is running), `switch_reconcile_failed` (the change leaves a 503 to the application while maintenance mode is on, and the site could not be reached to keep the maintenance page in place: nothing was changed) or `managed_elsewhere`.

```json
{
  "code": "managed_elsewhere",
  "message": "This site is managed by another control panel",
  "reason": "managed_elsewhere"
}
```

### 422 A field is missing or wrong (`invalid`, with `field` and `errors`), or the change was refused for a reason of its own: `invalid_page` (a page has a problem that stops the save; `diagnostics` lists each one), `overlap_nginx_rules` (the site's Nginx rules already set an error page for a code; `codes` lists them), `error_pages_locked` (Corefinity has locked the site's error pages) or `runtime_lacks_capability` (error pages arrive with the site's next platform update). A copy onto production without `confirm_production: true` answers `confirm`, and one between companies `tenant_mismatch`.

```json
{
  "code": "confirm",
  "errors": {
    "confirm_production": [
      "Set confirm_production to true to change production's error pages."
    ]
  },
  "field": "confirm_production",
  "message": "Set confirm_production to true to change production's error pages.",
  "reason": "confirm"
}
```

### 429 Too many requests (`rate_limited`): the API's general limit, or the 20 saves a minute the target environment takes from the API, the Control Panel and AI assistants together. Wait for `Retry-After`, which `retry_after_seconds` repeats.

```json
{
  "code": "rate_limited",
  "message": "Too many attempts on this environment. Try again shortly.",
  "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. |
| 409 | `managed_elsewhere` | This site is read-only here. Change it in the control panel that manages it. |
| 409 | `operation_in_progress` | A change to the environment is in progress. Try again when it has finished. |
| 409 | `restore_running` | A restore is running on the site. Wait for it to finish, then try again. |
| 409 | `stale` | What you read has changed since you read it. Read it again, then send the change with its new version or quote. |
| 409 | `switch_reconcile_failed` | The maintenance switch could not be checked on the site, so nothing was changed. Try again shortly. |
| 422 | `confirm` | The action needs an explicit confirmation field. Ask the person, then send it. |
| 422 | `error_pages_locked` | Corefinity has locked the environment's error pages. Contact support to change them. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 422 | `invalid_page` | An error page cannot be saved as it is. Fix the errors the answer lists. |
| 422 | `runtime_lacks_capability` | The site's runtime does not support this yet. It is available after the site's platform update. |
| 422 | `tenant_mismatch` | The object does not exist or the token may not see it. Check the id. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Error pages](https://docs.corefinity.com/guides/sites/site-settings/error-and-maintenance-pages.md)
- MCP tool: [`corestack_error_pages_copy`](https://docs.corefinity.com/mcp/tools/corestack_error_pages_copy.md)
