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

# Delete Automation

> Soft-delete an automation by ID to stop new dispatches. Activity history stays queryable, it no longer counts against your cap, and it can't be restored.

> [!NOTE]
>
> **Beta.** See the [Automations Overview](https://www.ayrshare.com/docs/apis/automations/overview.md) for the full feature description.

Soft-deletes the automation. The master row is flagged `deleted: true, active: false`; no new dispatches occur from this point on.

Existing triggers, actions, and activity rows are **not** cascaded. The activity history remains queryable via [`GET /automations/:id/activity`](https://www.ayrshare.com/docs/apis/automations/get-activity) for as long as the rows exist in Firestore (retention is indefinite for trace and analytics).

Soft-deleted automations no longer count against your active automation cap. They cannot be restored via the API; create a new automation instead.

## Header Parameters

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## Path Parameters

**id** `string` *required*

The automation ID returned from `POST /automations`.

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-X DELETE https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ
```

```javascript JavaScript theme={"system"}
const API_KEY = "API_KEY";
const id = "auto_9xKp2Lm4nQ";

fetch(`https://api.ayrshare.com/api/automations/${id}`, {
  method: "DELETE",
  headers: { "Authorization": `Bearer ${API_KEY}` },
})
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch(console.error);
```

```python Python theme={"system"}
import requests

headers = {"Authorization": "Bearer API_KEY"}
automation_id = "auto_9xKp2Lm4nQ"

r = requests.delete(
    f"https://api.ayrshare.com/api/automations/{automation_id}",
    headers=headers,
)

print(r.json())
```

```php PHP theme={"system"}
$id = "auto_9xKp2Lm4nQ";
$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "DELETE",
    CURLOPT_HTTPHEADER => ["Authorization: Bearer API_KEY"],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

```json 200: Success theme={"system"}
{
  "status": "success",
  "id": "auto_9xKp2Lm4nQ"
}
```

```json 404: Not found theme={"system"}
{
  "action": "automation",
  "status": "error",
  "code": 469,
  "message": "Automation not found"
}
```


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