Delete a non-primary email address of a user
DELETE /v1/users/{user_id}/emails/{email_id} · permission users:write
Deletes one non-primary email address of the user. The primary address cannot be deleted: make another verified address primary first. While the environment requires an email, the user's last verified address cannot be deleted. Every deletion is written to the management audit log as user.email_removed with the API key as actor. Deleting the same row again returns 404 because the row no longer exists: the effect is idempotent, the status code is not.
Request
| Parameter | In | Required | Description |
|---|---|---|---|
user_id |
path | yes | User id, prefixed usr_. |
email_id |
path | yes | Id of the email row (internal UUID, lowercase, hyphenated), as returned by GET /v1/users/{user_id}/emails. |
The request takes no body.
Response
204 No Content.
Errors
Every error is an application/problem+json body with a stable code.
| HTTP | code |
When |
|---|---|---|
| 409 | primary_identifier_required |
The address is the primary address. |
| 409 | last_verified_channel |
The environment requires an email and this is the last verified address. |
| 404 | not_found |
The user or the email row does not exist in this environment, the email does not belong to this user, or an id is malformed. |
| 401 | unauthenticated |
The API key is missing, invalid or revoked. |
| 403 | insufficient_permissions |
The key lacks the users:write permission. |
| 429 | rate_limited |
The rate limit was exceeded; honor Retry-After. |
| 503 | service_unavailable |
A dependency is temporarily unavailable; retry later. |
Example
curl -X DELETE https://api.eu.keenauth.com/v1/users/usr_0a1b2c3d4e5f6g7h8j9k0m1n2p/emails/0191f0a0-3333-7444-8555-666666666666 \
-H "Authorization: Bearer $KEENAUTH_SECRET_KEY"
Personal data
This endpoint carries personal data: end-user profile. Personal data in the KeenAuth APIs describes what is stored, how long it is kept and how it is deleted. Do not send special categories of personal data (health, biometric data, religion, political opinions, sexual orientation) in any field.