# Delete Workspace Beta

> Permanently delete a workspace and all of its data.

> Documentation index: https://www.foxreach.io/docs/llms.txt lists every page of these docs. Each page is also served as Markdown: add `.md` to its URL.

`DELETE` https://api.foxreach.io/api/v1/workspaces/{workspace_id}

> **Note:** **Beta.** This endpoint is new and may change.

Requires an API key with the `Requires an API key with the `write` and `admin` scopes. The `admin` scope is opt-in: no default key carries it. The call runs in the key's own workspace and `X-Workspace-Id` is ignored. It is recorded as an `audit.workspace.deleted` event in the key's workspace, visible in [List Events](/api-reference/webhooks/list-events).` scope.

Irreversible: leads, campaigns, email accounts, inbox and API keys of the workspace are deleted with it. The workspace must be owned by the key's creator. The call is refused for a personal workspace, for the workspace the key belongs to (`400 cannot_delete_own_workspace`), and for a workspace with a live paid subscription (`409 subscription_active`): cancel the subscription in Billing first. The audit event is written to the key's workspace so it survives the deletion.

## Path Parameters

- `workspace_id` string path required

  The workspace to delete.

## Query Parameters

- `confirm` boolean query required

  Must be `true`. Without it the call returns `400 confirmation_required` and deletes nothing.

**Request example**

```bash cURL
curl -X DELETE "https://api.foxreach.io/api/v1/workspaces/ws_abc123?confirm=true" \
  -H "X-API-Key: otr_your_key"
```

```python Python
import requests

response = requests.delete(
    "https://api.foxreach.io/api/v1/workspaces/ws_abc123?confirm=true",
    headers={"X-API-Key": "otr_your_key"}
)
data = response.json()
```

```typescript TypeScript
const response = await fetch("https://api.foxreach.io/api/v1/workspaces/ws_abc123?confirm=true", { method: "DELETE", headers: { "X-API-Key": "otr_your_key" } });
const data = await response.json();
```

**Response example**

```json
{
  "data": {
    "id": "ws_abc123",
    "deleted": true
  }
}
```

## Errors

| Status | Description |
|--------|-------------|
| `401` | Missing, invalid, revoked or expired API key |
| `403` | API key does not have the required scope: `Requires an API key with the `write` and `admin` scopes. The `admin` scope is opt-in: no default key carries it. The call runs in the key's own workspace and `X-Workspace-Id` is ignored. It is recorded as an `audit.workspace.deleted` event in the key's workspace, visible in [List Events](/api-reference/webhooks/list-events).` |
| `400` | `confirm` is not `true`, the workspace is personal, or it is the key's own workspace |
| `403` | Key lacks `write` or `admin`, or the key's creator does not own the workspace |
| `404` | Workspace not found |
| `409` | The workspace has a live paid subscription |

## Rate Limit

- **120 requests per minute, shared by every `write` call in your workspace.** Fixed 60-second window.
- Every response includes `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` (unix epoch seconds) and `X-RateLimit-Bucket` (`write`).
- A `429` response includes a `Retry-After` header (seconds until the bucket resets).

For client-side patterns, see [Rate Limiting](https://www.foxreach.io/docs/rate-limiting).
