
# Delete an email sender domain

`DELETE /v1/email-sender-domains/{sender_domain_id}` · permission `email-sender-domains:write` · all plans

Deletes a sender domain. A domain the email delivery configuration still uses cannot be deleted: first switch the [email provider](../email-provider/put.md) to another mode. After deletion you can remove the domain's DNS records.

## Request

| Field | Type | Required | Description |
|---|---|---|---|
| `sender_domain_id` | string | yes | Sender domain ID (`sdom_…`). |
| `If-Match` | header | yes | The domain's `ETag`; `*` matches any version. `428` when missing, `412` when it does not match. |

No request body.

## Response

`204 No Content`.

## Errors

| HTTP | code | When |
|---|---|---|
| 404 | `not_found` | The sender domain does not exist, belongs to another environment or the ID is malformed. |
| 409 | `conflict` | The email delivery configuration uses the domain (`platform_managed_domain`). Switch [the email provider](../email-provider/put.md) to another mode or domain first. |
| 412 | `precondition_failed` | `If-Match` does not match the domain's current version. |
| 428 | `precondition_required` | `If-Match` is missing. |
| 401 | `unauthenticated` | The credential is missing, invalid or revoked. |
| 403 | `insufficient_permissions` | The credential lacks the required permission. |
| 429 | `rate_limited` | The rate limit was exceeded; retry after the `Retry-After` period. |
| 503 | `service_unavailable` | A dependency is temporarily unavailable; retry after the `Retry-After` period. |

## Example

```bash
curl -X DELETE https://api.eu.keenauth.com/v1/email-sender-domains/sdom_01k7r9m3q5t8v2w4x6y8z0a2b4 \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY" \
  -H 'If-Match: "2"'
```

CLI: `keenauth email-sender-domains delete sdom_01k7r9m3q5t8v2w4x6y8z0a2b4 --if-match '"2"'`
