
# List directory tokens

`GET /v1/directories/{directory_id}/tokens` · permission `directories:write`

Lists the metadata of the directory's SCIM tokens, newest first, revoked and expired ones included; never the token or its digest. Only forward paging exists; the cursor is bound to the directory. Listing tokens requires `directories:write`.

## Request

| Field | Type | Required | Description |
|---|---|---|---|
| `directory_id` | path | yes | SCIM directory ID (`dir_…`). |
| `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 token metadata.

```json
{
  "data": [
    {
      "id": "0192a3b5-0a1b-7c2d-8e3f-4a5b6c7d8e9f",
      "label": "rotation",
      "created_at": "2026-10-19T09:40:00.123456Z",
      "expires_at": "2027-01-17T09:40:00.123456Z",
      "revoked_at": null,
      "last_used_at": null
    }
  ],
  "list_metadata": {
    "before": null,
    "after": null
  }
}
```

## Errors

| HTTP | code | When |
|---|---|---|
| 400 | `invalid_cursor` | The cursor is invalid or belongs to another directory or filter. |
| 404 | `not_found` | The directory does not exist in this environment. |
| 422 | `validation_failed` | `limit` is out of range, or `before` or `order` was given (`unsupported`). |
| 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/dir_01j9xm2n4p6q8r0s2t4v6w8y0z/tokens" \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY"
```
