---
title: "Replace a site's error pages"
url: https://docs.corefinity.com/api/reference/site-settings/replace-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_update.md
---
# Replace a site's error pages

Saves the whole configuration at the `version` you read: the setting of every code, every page and the support email. Scripts and anything else a page may not contain are removed, and `warnings` lists what was; the change is then checked on the site: follow the operation in the answer.

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

- 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

- `config` (object, required): The configuration to save. A code, page or the support email left out goes back to its default.
  - `codes` (object)
    - `404` (string) One of `page`, `app`.
    - `500` (string) One of `page`, `app`.
    - `502` (string) One of `page`, `app`.
    - `503` (string) One of `page`, `app`.
    - `504` (string) One of `page`, `app`.
  - `pages` (object)
    - `404` (object)
      - `message` (string or null): One line of plain text the page shows through the `{{message}}` tag, at most 300 characters. Null shows the default message.
      - `source` (string or null): Your own HTML for the page, at most 64 KiB (65,536 bytes), and all pages at most 256 KiB together. Null shows the platform's page.
    - `500` (object)
    - `502` (object)
    - `503` (object)
    - `504` (object)
    - `maintenance` (object)
  - `support_email` (string or null): An email address, with no spaces, quotes, `<`, `>` or `&` in it. Null or left out shows none.
- `note` (string or null): Why, shown in the history. Only its first 200 characters are kept.
- `version` (integer, required): The `version` from the last read.

## Request

### curl

```bash
curl -X PUT https://manage.corefinity.com/api/corestack/sites/1042/error-pages \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "codes": {
        "404": "app",
        "500": "page",
        "502": "page",
        "503": "app",
        "504": "page"
      },
      "pages": {
        "404": {
          "message": null,
          "source": null
        },
        "500": {
          "message": null,
          "source": null
        },
        "502": {
          "message": null,
          "source": null
        },
        "503": {
          "message": null,
          "source": null
        },
        "504": {
          "message": null,
          "source": null
        },
        "maintenance": {
          "message": "Back at 10:00 UTC",
          "source": null
        }
      },
      "support_email": "help@harbourandfinch.example.com"
    },
    "note": "Our app shows its own holding page",
    "version": 2
  }'
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->put('https://manage.corefinity.com/api/corestack/sites/1042/error-pages', [
        'config' => [
            'codes' => (object) [
                '404' => 'app',
                '500' => 'page',
                '502' => 'page',
                '503' => 'app',
                '504' => 'page',
            ],
            'pages' => (object) [
                '404' => [
                    'message' => null,
                    'source' => null,
                ],
                '500' => [
                    'message' => null,
                    'source' => null,
                ],
                '502' => [
                    'message' => null,
                    'source' => null,
                ],
                '503' => [
                    'message' => null,
                    'source' => null,
                ],
                '504' => [
                    'message' => null,
                    'source' => null,
                ],
                'maintenance' => [
                    'message' => 'Back at 10:00 UTC',
                    'source' => null,
                ],
            ],
            'support_email' => 'help@harbourandfinch.example.com',
        ],
        'note' => 'Our app shows its own holding page',
        'version' => 2,
    ]);

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

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/error-pages', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    config: {
      codes: {
        '404': 'app',
        '500': 'page',
        '502': 'page',
        '503': 'app',
        '504': 'page',
      },
      pages: {
        '404': {
          message: null,
          source: null,
        },
        '500': {
          message: null,
          source: null,
        },
        '502': {
          message: null,
          source: null,
        },
        '503': {
          message: null,
          source: null,
        },
        '504': {
          message: null,
          source: null,
        },
        maintenance: {
          message: 'Back at 10:00 UTC',
          source: null,
        },
      },
      support_email: 'help@harbourandfinch.example.com',
    },
    note: 'Our app shows its own holding page',
    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.put(
    "https://manage.corefinity.com/api/corestack/sites/1042/error-pages",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "config": {
            "codes": {
                "404": "app",
                "500": "page",
                "502": "page",
                "503": "app",
                "504": "page",
            },
            "pages": {
                "404": {
                    "message": None,
                    "source": None,
                },
                "500": {
                    "message": None,
                    "source": None,
                },
                "502": {
                    "message": None,
                    "source": None,
                },
                "503": {
                    "message": None,
                    "source": None,
                },
                "504": {
                    "message": None,
                    "source": None,
                },
                "maintenance": {
                    "message": "Back at 10:00 UTC",
                    "source": None,
                },
            },
            "support_email": "help@harbourandfinch.example.com",
        },
        "note": "Our app shows its own holding page",
        "version": 2,
    },
)

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

## Responses

### 200 The configuration is the one the site already has. Nothing was started.

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

### 201 The change was saved. Follow `operation`; `revision` is the new revision.

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

### 413 A page is over 64 KiB, or the pages are over 256 KiB together (`too_large`). `page` names the page, or is null for the total; `bytes` and `max_bytes` say by how much.

```json
{
  "bytes": 70112,
  "code": "too_large",
  "max_bytes": 65536,
  "message": "This page is larger than 64 KB.",
  "page": "503",
  "reason": "too_large"
}
```

### 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).

```json
{
  "code": "error_pages_locked",
  "message": "Corefinity has locked this environment's error pages. Contact support to change them.",
  "reason": "error_pages_locked"
}
```

### 429 Too many requests (`rate_limited`): the API's general limit, or the 20 saves a minute this 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. |
| 413 | `too_large` | The upload is larger than the limit for one file. |
| 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. |
| 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_update`](https://docs.corefinity.com/mcp/tools/corestack_error_pages_update.md)
