# Group API - Delete

Use this endpoint to delete a group from your account.

---

## Endpoint

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

Replace `{type}` with one of: `tags`, `subscriptions`, `messages`, or `templates`. Replace `{ID}` with the Envoke group ID you want to delete.

Authentication is via HTTP Basic Auth using your API ID and API Key.

---

## Important

**A group must be empty before it can be deleted.** The API returns the same validation error whether the group is blocked by subgroups or by assigned items:

- **Subgroups:** Delete or reassign all subgroups first.
- **Assigned items:** Tags, subscriptions, messages, or templates assigned to this group must be deleted or moved to a different group first.

**Deletion is permanent** and cannot be undone via the API.

---

## Response

### Success

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

### Group is not empty

```json
{
  "success": false,
  "result_text": "Validation failed, see 'result_data' -> 'errors'",
  "result_data": {
    "errors": ["Only empty groups can be deleted"]
  }
}
```

### Group 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/groups/tags/7"
```

Replace `tags` with the appropriate item type and `7` with the ID of the group you want to delete.

---

*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).*
