Remove a membership
DELETE /v1/organizations/{org_id}/memberships/{membership_id} · permission organizations:write
Removes the membership (reason removed_by_admin). The organization's last active admin cannot be removed. If-Match is optional. The removal is audited as organization_membership.deleted.
Request
| Field | Type | Required | Description |
|---|---|---|---|
org_id |
path | yes | Organization ID (org_…). |
membership_id |
path | yes | Membership ID (mem_…). |
If-Match |
header | no | Current ETag; on mismatch 412. |
No request body.
Response
204 No Content.
Errors
| HTTP | code | When |
|---|---|---|
| 404 | not_found |
The membership does not exist in this organization. |
| 409 | last_org_admin |
The membership is the organization's last active admin. |
| 412 | precondition_failed |
If-Match does not match the current version. |
| 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
curl -i -X DELETE "https://api.eu.keenauth.com/v1/organizations/org_01j9xk3m7q8r2s4t6v8w0y2z4a/memberships/mem_01j9xn5p9s0t4v6w8x0y2z4a6c" \
-H "Authorization: Bearer $KEENAUTH_SECRET_KEY"
Personal data
This endpoint carries personal data: organization memberships and invitations. 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.