
# List directories

`GET /v1/directories` · permission `directories:read`

Lists the SCIM directories of the environment, newest first. Only forward paging exists; the cursor is bound to the filters. No token, token digest or personal data is returned; the open mass deprovision hold is shown by `GET /v1/directories/{directory_id}`.

## Request

| Field | Type | Required | Description |
|---|---|---|---|
| `organization_id` | query | no | Only directories of this organization (`org_…`). |
| `type` | query | no | Only directories of this type (`scim`). |
| `state` | query | no | Only directories in this state (`inactive`, `active`). |
| `limit` | query | no | 1–100, default 20. |
| `after` | query | no | The cursor from `list_metadata.after`. |

There is no request body.

## Response

`200 OK` with a page of directories.

```json
{
  "data": [
    {
      "id": "dir_01j9xm2n4p6q8r0s2t4v6w8y0z",
      "organization_id": "org_01j9xk3m7q8r2s4t6v8w0y2z4a",
      "type": "scim",
      "name": "Okta",
      "state": "inactive",
      "base_url": "https://acme.eu.keenauth.app/scim/v2/dir_01j9xm2n4p6q8r0s2t4v6w8y0z",
      "created_at": "2026-10-19T09:31:00.123456Z",
      "last_request_at": null,
      "provisioning_mode": "user_store",
      "attribute_allowlist": [],
      "unverified_domain_action": "invite",
      "delete_action": "remove_membership",
      "on_delete_memberships": "keep",
      "mass_deprovision_guard": {"enabled": true, "percent": 10, "absolute_min": 25},
      "send_welcome_email": false
    }
  ],
  "list_metadata": {
    "before": null,
    "after": null
  }
}
```

## Errors

| HTTP | code | When |
|---|---|---|
| 400 | `invalid_cursor` | The cursor is invalid or belongs to another directory or filter. |
| 422 | `validation_failed` | A filter is malformed or repeated, `limit` is out of range, or `before` or `order` 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` | Directory sync is temporarily unavailable or not configured in this deployment; retry after the `Retry-After` period. |

## Example

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