---
title: "Delete a site"
url: https://docs.corefinity.com/api/reference/sites/delete-site
type: endpoint
last_updated: 2026-11-13
feature: sites
related:
  - https://docs.corefinity.com/guides/sites/create-and-manage/site-overview.md
  - https://docs.corefinity.com/mcp/tools/corestack_site_delete.md
---
# Delete a site

Deletes the row `{site}` names, once the request carries the typed confirmation that row takes: the body's
fields say which. It answers the operation to follow.

```http
DELETE /api/corestack/sites/{site}
```

- Scope: `destructive`
- 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 deletes 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_domain` (string): To delete a site, name its production row in `{site}` and send the site's domain here, exactly.
- `confirm_name` (string): To delete one environment, name that environment's row in `{site}` and send its name here, exactly as the site shows it, such as `Staging`. A production row takes `confirm_domain` instead.

## Request

### curl

```bash
curl -X DELETE https://manage.corefinity.com/api/corestack/sites/1042 \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "confirm_name": "Staging"
  }'
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->delete('https://manage.corefinity.com/api/corestack/sites/1042', [
        'confirm_name' => 'Staging',
    ]);

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

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042', {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    confirm_name: 'Staging',
  }),
});

// 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.delete(
    "https://manage.corefinity.com/api/corestack/sites/1042",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "confirm_name": "Staging",
    },
)

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

## Responses

### 202 The delete has started: the row and the operation to follow. When external database access has to be turned off first, the answer is instead a message with the reason `external_db_delete_queued` and no operation; the delete then starts by itself.

```json
{
  "held_delete_id": 3120,
  "message": "Turning off external access, then deleting.",
  "reason": "external_db_delete_queued",
  "turn_off_operation_id": 5119
}
```

### 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 row does not exist or is not yours to delete, or deleting this kind of row is not on for your company.

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

### 409 The delete cannot start now. `reason` says why. `cluster_paused` means Corefinity has paused changes for planned maintenance: the message says until when, if that is known.

```json
{
  "code": "busy",
  "message": "Another change to this site is in progress. Wait for it to finish.",
  "reason": "busy"
}
```

### 422 The confirmation is missing or does not match. Both answer `confirm_mismatch`, and `field` names the confirmation to send.

```json
{
  "code": "confirm_mismatch",
  "errors": {
    "confirm_name": [
      "Type the environment's name exactly to confirm"
    ]
  },
  "field": "confirm_name",
  "message": "Type the environment's name exactly to confirm",
  "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
}
```

### 502 The site could not be read to take its final snapshot. Nothing has been deleted and no operation has started: send the request again in a minute.

```json
{
  "message": "The site could not be read for its final snapshot. Try again in a minute."
}
```

### 503 Corefinity has switched this action off for the moment. Try again later.

```json
{
  "code": "switched_off",
  "message": "Deleting is switched off at the moment",
  "reason": "switched_off",
  "switch": "delete"
}
```

## 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 | `busy` | Another operation is running on the site. Wait for it to finish. |
| 409 | `clone_in_progress` | Another copy is running on the site. Wait for it to finish. |
| 409 | `cluster_deleting` | The cluster is being deleted. Nothing can be changed on it. |
| 409 | `cluster_paused` | Changes on this site are paused for planned maintenance; please try again later. |
| 409 | `deleted` | The site, environment or copy has been deleted, or is being deleted. Nothing can be changed on it. Restore a deleted site first if it can still be restored. |
| 409 | `has_environments` | The site still has an environment that stops this. Read the message: delete its other environments first, or do what it names. |
| 409 | `is_production` | The production environment is the site itself. Delete the site instead. |
| 409 | `managed_elsewhere` | This site is read-only here. Change it in the control panel that manages it. |
| 422 | `confirm_mismatch` | Send the confirmation exactly as the field named in `field` asks for it. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |
| 502 |  | Read the message; it says what happened. |
| 503 | `switched_off` | Corefinity has switched this action off for the moment. Try again later. |

## The same task elsewhere

- Guide: [Site overview](https://docs.corefinity.com/guides/sites/create-and-manage/site-overview.md)
- MCP tool: [`corestack_site_delete`](https://docs.corefinity.com/mcp/tools/corestack_site_delete.md)
