# Subscription API - Delete

Use this endpoint to delete a subscription from your account.

---

## Endpoint

```
DELETE https://e1.envoke.com/v2/subscriptions/{ID}
```

Replace `{ID}` with the Envoke subscription ID you want to delete. Authentication is via HTTP Basic Auth using your API ID and API Key.

---

## Important

**A subscription cannot be deleted while contacts are assigned to it.** If any contacts are currently subscribed, the API returns a validation error. You must remove all assigned contacts first using the [`DELETE /subscriptions/{ID}/contacts`](https://envoke-developers.pages.dev/v2/subscriptions/contacts/) endpoint, then retry the delete.

**Deletion is permanent.** Once all contacts have been removed and the subscription is deleted, it cannot be recovered via the API.

---

## Response

### Success

```json
{
  "success": true,
  "result_text": "Deleted",
  "result_data": []
}
```

### Subscription has contacts assigned

```json
{
  "success": false,
  "result_text": "Validation failed, see 'result_data' -> 'errors'",
  "result_data": {
    "errors": ["Cannot delete a subscription that has contacts assigned to it"]
  }
}
```

### Subscription not found

```json
{
  "success": false,
  "result_text": "Validation failed, see 'result_data' -> 'errors'",
  "result_data": {
    "errors": ["Item with id '999999' not found"]
  }
}
```

---

## Example

```bash
curl -X DELETE -gs \
  -u "$API_ID:$API_KEY" \
  "https://e1.envoke.com/v2/subscriptions/12"
```

Replace `12` with the ID of the subscription you want to delete, and substitute your actual API ID and API Key.

---

*Note: The curl examples above are formatted for readability. All requests must use properly encoded URLs.*

*Full reference, OpenAPI description, and Postman collection: [developers.envoke.com](https://developers.envoke.com).*
