> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keebai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DELETE /v1/agents/{id}/scenarios/{scenarioId}

> Delete a scenario with its routes.

Deletes the scenario permanently, with its routes and the history of each.

## Endpoint

```
DELETE https://api.keebai.com/v1/agents/{id}/scenarios/{scenarioId}
```

## Required scope

`agents:write`

## Path parameters

| Parameter | Type | Description |
| - | - | - |
| `id` | `string` | `ObjectId` of the agent. |
| `scenarioId` | `string` | `ObjectId` of the scenario. |

## Example request

```bash curl theme={"system"}
curl -X DELETE https://api.keebai.com/v1/agents/6650a1b2c3d4e5f6a7b8c9d0/scenarios/6652c0ffee11223344556677 \
  -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
```

## Response

### 204 No Content

No body.

### 400 Bad Request

`scenarioId` is not an `ObjectId`.

### 404 Not Found

`AGENT_NOT_FOUND` when the agent belongs to another project of the company, `UPSTREAM_ERROR` (message `AGENT_NOT_FOUND`) when no agent has that id in the company; `scenario_not_found` when the agent has no scenario with that id.

### 401 Unauthorized

Missing, invalid, revoked, or expired token.

### 403 Forbidden

The token does not have the `agents:write` scope.

### 502 Bad Gateway

The agent service is unreachable.

## Operational notes

* **It cannot be undone.** To stop using a scenario but keep it, set its `status` to `archived` instead.
* **Functions only its routes used are unmounted** from the agent.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.