---
title: "corestack_environment_delete"
url: https://docs.corefinity.com/mcp/tools/corestack_environment_delete
type: tool
last_updated: 2026-11-13
feature: environments
related:
  - https://docs.corefinity.com/api/reference/sites/delete-site.md
  - https://docs.corefinity.com/guides/sites/environments-and-copies/create-an-environment.md
---
# corestack_environment_delete

**Delete an environment.** Remove an environment at once (no grace period): a final snapshot is taken and kept on the site, then its files, database, address and claims go. Scope: destructive. Long-running: answers with a task.

- Scope: `destructive`
- Confirmation: `confirm_name`
- Runs as a task: yes

## When to use it

Remove an environment at once (no grace period): a final snapshot is taken and kept on the site, then its files, database, address and claims go.

If external database access is on for the environment, the delete turns it off first and then carries on by itself once access is off. The call then answers at once, and it is not an error: `{"operation": null, "queued": true, "reason": "external_db_delete_queued", "message": "Turning off external access, then deleting.", "turn_off_operation": {"id": 9123, "status_tool": "corestack_site_operation_get"}, "held_delete_id": 41}`. Follow the turn-off with its status tool if you want to; there is nothing else to send, and asking again while it waits gives the same answer.

## Inputs

- `site_id` (integer, ≥ 1, required): The environment's row.
- `confirm_name` (string, up to 40 characters, required): The environment's name, typed exactly.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "confirm_name": {
      "description": "The environment's name, typed exactly.",
      "maxLength": 40,
      "type": "string"
    },
    "site_id": {
      "description": "The environment's row.",
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "site_id",
    "confirm_name"
  ],
  "type": "object"
}
```

## Refusals

- `wrong_row`: a production-row-only tool given an environment row, or the reverse; use the other tool or row.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_environment_delete",
  "arguments": {
    "site_id": 4211,
    "confirm_name": "Staging"
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_environment_delete with site_id 4211. (Delete an environment.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [DELETE /api/corestack/sites/{site}](https://docs.corefinity.com/api/reference/sites/delete-site.md)
- Guide: [Create an environment](https://docs.corefinity.com/guides/sites/environments-and-copies/create-an-environment.md)
