# Delete workflow

> Delete a workflow.

Source: https://docs.mycrmsim.com/docs/automations/delete-workflow

```http
DELETE https://backend.mysmsgateway.app/api/v1/ext/workflows/{id}
```

- Category: myCRMSIM Automations / Automations
- Auth: Bearer access token
- Scope: `automations.write`

Runs in progress are cancelled first. A workflow an AI agent uses as a task cannot be deleted until it is removed from the agent (400). Cannot be undone.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | number | yes | Workflow id. Example: `1201` |
| `workspace_id` | query | number | yes | A workspace of the installer. Example: `7` |

## Response 200

OK

```json
{
  "success": true,
  "message": "Workflow deleted",
  "data": {
    "id": 1201
  }
}
```

## Response 400

Used by an AI agent

```json
{
  "success": false,
  "message": "This workflow is in use by AI agent (Revive). Remove it from the agent's tasks before you delete it."
}
```

## Response 401

Missing or invalid token

```json
{
  "success": false,
  "message": "Invalid or expired access token."
}
```

## Response 403

Missing scope

```json
{
  "success": false,
  "message": "Missing scope(s): automations.write. This integration was granted: …"
}
```

## Response 404

workspace_id does not exist or is not the installer's (same response for both)

```json
{
  "success": false,
  "message": "Workspace not found or not accessible to this token"
}
```

## Response 404

The workflow does not exist, is not the installer's, or is in another workspace

```json
{
  "success": false,
  "message": "Workflow not found or not accessible to this token"
}
```
