# Cancel an active run

> Source: https://elaichi.ai/docs/api-reference/workflows/automation/cancelautomationrun/

`POST /automation/{id}/run/{runId}/cancel`

Resource: **Workflow** · API: **Workflows**

## Path parameters

- **`id`** _(string, required)_
  Resource id
- **`runId`** _(string, required)_
  Resource id

## Response body

- **`run_id`** _(string)_
- **`automation_id`** _(string)_
- **`mode`** _(string)_
- **`status`** _(string)_
- **`outcome`** _(string,null)_
- **`skip_reason`** _(string,null)_
- **`trigger_key`** _(string,null)_
- **`trigger_type`** _(string)_
- **`actor_user_id`** _(string,null)_
- **`scheduled_at`** _(string,null)_
- **`version_id`** _(string,null)_
- **`version_number`** _(integer,null)_
- **`queued_at`** _(string)_
- **`started_at`** _(string,null)_
- **`finished_at`** _(string,null)_
- **`failing_step`** _(unknown)_
- **`error`** _(unknown)_
- **`retry_of_run_id`** _(string,null)_
- **`from_step_key`** _(string,null)_
- **`counts`** _(unknown)_
- **`waiting`** _(unknown)_
- **`chain`** _(unknown)_
- **`can_retry`** _(boolean)_
- **`can_cancel`** _(boolean)_
- **`progress`** _(object,null)_
  Top-level steps finished out of all of them. Present only on a running or waiting row of a runs list page, null elsewhere.

## Code examples

### curl

```bash
curl -X POST 'https://api.elaichi.ai/automation/<id>/run/<runId>/cancel' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const response = await fetch('https://api.elaichi.ai/automation/<id>/run/<runId>/cancel', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/automation/<id>/run/<runId>/cancel"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}

response = requests.post(url, headers=headers)
print(response.json())
```
