# Workspace: deletion

> Schedule this workspace for deletion, after a seven-day hold; Change your mind inside the seven days

## Schedule this workspace for deletion, after a seven-day hold

`POST /v1/workspace/deletion` · operation `requestWorkspaceDeletion`

Requires the `batondeck:workspace:admin` permission (action `workspace:delete`).

Requires a step-up: MFA enrolled and re-authenticated within 15 minutes. **Not reachable with an API key** — a key has no session and so can never step up.

Refused while the workspace is suspended or on deletion hold.

**Request body** (`application/json`)

| Field | Type | Required | Notes |
|---|---|---|---|
| `reason` | string |  | ≤ 500 chars |

<details>
<summary>Request schema</summary>

```json
{
  "type": "object",
  "properties": {
    "reason": {
      "type": "string",
      "maxLength": 500
    }
  },
  "additionalProperties": false
}
```

</details>

**Responses**

| Status | Meaning |
|---|---|
| 201 | Schedule this workspace for deletion, after a seven-day hold |
| 400 | The arguments did not validate. |
| 401 | No portal session, and no live API key. |
| 403 | The policy refused, or the request was cross-site. |
| 404 | No such resource, or none this session may see. |

<details>
<summary>201 response schema</summary>

```json
{
  "type": "object",
  "properties": {
    "hold_until": {
      "type": "number"
    }
  },
  "required": [
    "hold_until"
  ],
  "additionalProperties": false
}
```

</details>

```sh
curl -X POST 'https://api.batondeck.com/v1/workspace/deletion' \
  -H "Authorization: Bearer $BATONDECK_API_KEY" \
  -H 'content-type: application/json' \
  -d @body.json
```


## Change your mind inside the seven days

`DELETE /v1/workspace/deletion` · operation `cancelWorkspaceDeletion`

Requires the `batondeck:workspace:admin` permission (action `workspace:cancel-deletion`).

Refused while the workspace is suspended or on deletion hold.

**Responses**

| Status | Meaning |
|---|---|
| 200 | Change your mind inside the seven days |
| 401 | No portal session, and no live API key. |
| 403 | The policy refused, or the request was cross-site. |
| 404 | No such resource, or none this session may see. |

<details>
<summary>200 response schema</summary>

```json
{
  "type": "null"
}
```

</details>

```sh
curl -X DELETE 'https://api.batondeck.com/v1/workspace/deletion' \
  -H "Authorization: Bearer $BATONDECK_API_KEY"
```
