
# List a directory's role mappings

`GET /v1/directories/{directory_id}/role-mappings` · permission `directories:read`

Lists the group → role mappings of a SCIM directory, oldest first. Only forward pagination is available; the cursor is bound to the directory.

## Request

| Field | Type | Required | Description |
|---|---|---|---|
| `directory_id` | path | yes | SCIM directory ID (`dir_…`). |
| `limit` | query | no | 1–100, default 20. |
| `after` | query | no | Cursor from `list_metadata.after`. |

There is no request body.

## Response

`200 OK` with a page of mappings.

```json
{
  "data": [
    {
      "id": "rmp_01j9xw0x4y5z9a1b3c5d7e9f1h",
      "directory_id": "dir_01j9xm2n4p6q8r0s2t4v6w8y0z",
      "organization_id": "org_01j9xk3m7q8r2s4t6v8w0y2z4a",
      "directory_group_id": "dsg_01j9xn3p5q7r9s1t3v5w7x9y1a",
      "role_id": "rol_01j9xr7s1t2w6x8y0z2a4b6c8e",
      "role_privileged": false,
      "approved_at": null,
      "created_at": "2026-10-13T09:31:00.123456Z"
    }
  ],
  "list_metadata": {
    "before": null,
    "after": null
  }
}
```

## Errors

| HTTP | code | When |
|---|---|---|
| 400 | `invalid_cursor` | The cursor is invalid or belongs to another directory. |
| 404 | `not_found` | The directory does not exist in this environment. |
| 422 | `validation_failed` | `limit` is out of range, or `before` or an `order` other than `asc` was given. |
| 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` | The directory record could not be checked or a dependency is temporarily unavailable; retry after the `Retry-After` period. |

## Example

```bash
curl -i "https://api.eu.keenauth.com/v1/directories/dir_01j9xm2n4p6q8r0s2t4v6w8y0z/role-mappings?limit=20" \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY"
```
