
# Delete a directory role mapping

`DELETE /v1/directories/{directory_id}/role-mappings/{mapping_id}` · permission `directories:write`

Deletes the mapping. A mapping of a directory that has since been deleted can still be deleted. Roles granted by the mapping are recalculated. The deletion is audited as `role_mapping.deleted`.

## Request

| Field | Type | Required | Description |
|---|---|---|---|
| `directory_id` | path | yes | SCIM directory ID (`dir_…`). |
| `mapping_id` | path | yes | Mapping ID (`rmp_…`). |

There is no request body.

## Response

`204 No Content` with no body.

## Errors

| HTTP | code | When |
|---|---|---|
| 404 | `not_found` | The mapping does not exist, or belongs to another directory or environment. |
| 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 -i -X DELETE "https://api.eu.keenauth.com/v1/directories/dir_01j9xm2n4p6q8r0s2t4v6w8y0z/role-mappings/rmp_01j9xw0x4y5z9a1b3c5d7e9f1h" \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY"
```
