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

# Stop Automation

<span class="badge--post">POST</span> <code class="endpoint-url">/leads/\{id}/automation/stop</code>

Stops all AI automation for a lead's active workflow run. The AI will no longer respond to messages, cadence is paused, and pending scheduled tasks are cancelled.

Use this when a human agent takes over the conversation or the lead requests to stop being contacted.

Authenticate every request with the `X-API-Key` header. See [Authentication](/docs/en/api/authentication).

## Path Parameters

| Parameter | Type          | Required | Description |
| --------- | ------------- | -------- | ----------- |
| `id`      | string (uuid) | **Yes**  | Lead ID     |

## Request Body

| Field         | Type          | Required | Description                     |
| ------------- | ------------- | -------- | ------------------------------- |
| `workflow_id` | string (uuid) | **Yes**  | Workflow to stop automation for |

## Responses

### `200` Automation stopped

```json theme={null}
{
  "success": true,
  "workflow_run_id": "run-uuid",
  "cadence_paused": true,
  "tasks_cancelled": 2
}
```

If already stopped:

```json theme={null}
{
  "success": true,
  "already_stopped": true,
  "workflow_run_id": "run-uuid"
}
```

### Response Fields

| Field             | Type    | Description                                             |
| ----------------- | ------- | ------------------------------------------------------- |
| `workflow_run_id` | string  | The workflow run that was stopped                       |
| `cadence_paused`  | boolean | Whether cadence was paused                              |
| `tasks_cancelled` | integer | Number of pending tasks that were cancelled             |
| `already_stopped` | boolean | Returned if automation was already stopped (idempotent) |

### `400` Missing workflow\_id

```json theme={null}
{
  "error": "workflow_id is required"
}
```

### `404` No active run found

```json theme={null}
{
  "error": "No active workflow run found for this lead and workflow"
}
```

This also applies if the lead is in a terminal status (for example, `expired`, `converted`).

### `401` Authentication error

See [Authentication](/docs/en/api/authentication).
