# Admin API

> The routes under /admin/v1/ that administrators call, with a second factor, to inspect and revoke users, sessions, and agents.

From `server/openapi.json` in tensile-tools/tensile-auth at commit `e66760d` (v0.4.1-7-ge66760d). The HTML page is https://auth.tensile.tools/docs/reference/api/admin.

Administrators call these routes with a session that has a second factor. Changes from a stale session, an agent, or a token are refused.

## Agents

### GET /admin/v1/agents

List agents.

Lists agents ordered by ID.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `owner` | query | `AdminID` | Only agents this user owns. |
| `unclaimed` | query | `boolean` | `true` for only agents that signed themselves up and that no human has claimed. Don't combine it with `owner`. |
| `disabled` | query | `boolean` | `true` for disabled agents only, claimed or not. |
| `cursor` | query | `string` | `next_cursor` from the previous page. |
| `limit` | query | `integer` | Items per page. From 1 to 200. Default: 50. |

| Status | Meaning | Body |
|---|---|---|
| 200 | A page of agents. | `AdminAgentList` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

### GET /admin/v1/agents/{agent}

Get an agent.

Returns the agent and its stored sessions. An unclaimed agent's signup sessions belong to no user and aren't listed.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `agent` (required) | path | `AdminID` |  |

| Status | Meaning | Body |
|---|---|---|
| 200 | The agent and its sessions. | `AdminAgentBody` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 404 | `not_found`: the user, session, or agent doesn't exist. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

### POST /admin/v1/agents/{agent}/revoke

Revoke an agent.

Disables the agent, so no new sessions can be delegated to it, and revokes its sessions and every session delegated from them. Needs a human session that authenticated within the freshness window (10 minutes by default); agents always get `human_required`. The change is rate-limited per administrator and recorded in the audit log with the administrator as the actor.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `agent` (required) | path | `AdminID` |  |

| Status | Meaning | Body |
|---|---|---|
| 200 | The agent after the revocation. | `AdminAgentBody` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 404 | `not_found`: the user, session, or agent doesn't exist. | `AdminError` |
| 429 | `throttled`: too many changes. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

## Alerts

### GET /admin/v1/alerts

List alerts.

Derives alerts, newest first: token reuse, leaked tokens, suspected passkey clones, TOTP locks, bursts of failed attempts from one client or against one user, signup spikes, a full signup quota, and unclaimed agents close to their claim deadline. Alerts are computed on each request and aren't stored.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `since` | query | `string (date-time)` | Scan back to this time, at most 30 days ago by default. The default is 24 hours ago. |

| Status | Meaning | Body |
|---|---|---|
| 200 | Alerts since the given time. | `AdminAlertList` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

## Overview

Totals and the audit chain status.

### GET /admin/v1/audit/chain

Get the audit chain status.

The result of the last full verification of the audit log's hash chain, against the trusted checkpoints the application passes to `authadmin.WithChainCheck`. When the last check is older than the interval set there, 5 minutes by default, the server starts a new one in the background and still answers with the last. Only the first request waits for a check. Events that are not yet sealed into the chain are not covered; `unsealed` counts them.

Auth: A session token, as `Authorization: Bearer`.

| Status | Meaning | Body |
|---|---|---|
| 200 | The last check. | `AdminChainStatus` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

### GET /admin/v1/stats

Count users, sessions, agents, and events.

Totals for an overview. Counting reads every row, so poll it no more than once a minute.

Auth: A session token, as `Authorization: Bearer`.

| Status | Meaning | Body |
|---|---|---|
| 200 | The totals. | `AdminStats` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

## Events

### GET /admin/v1/events

List audit events.

Pages through the audit log, newest first by default. Events written in concurrent transactions can commit out of `seq` order, so use `seq` for display and paging, not for exactly-once processing.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `user` | query | `AdminID` | Only events about this user. |
| `agent` | query | `AdminID` | Only events about this agent. |
| `actor` | query | `AdminID` | Only changes this user made on someone else's behalf. |
| `kind` | query | `array of string` | Only these event kinds. Repeat the parameter or separate kinds with commas; at most 32. |
| `order` | query | `"asc" or "desc"` | `desc` for newest first, the default, or `asc`. A cursor carries its order. |
| `cursor` | query | `string` | `next_cursor` from the previous page. |
| `limit` | query | `integer` | Items per page. From 1 to 200. Default: 50. |

| Status | Meaning | Body |
|---|---|---|
| 200 | A page of events. | `AdminEventList` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

## Me

The caller's own session.

### GET /admin/v1/me

Describe your own session.

Shows who the caller is and until when their session passes the freshness checks for changes. A client uses it to ask for a step-up before a change instead of after a 403 `step_up_required`.

Auth: A session token, as `Authorization: Bearer`.

| Status | Meaning | Body |
|---|---|---|
| 200 | The caller's session. | `AdminMe` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

## Meta

### GET /admin/v1/openapi.json

Get this document.

Returns this OpenAPI document.

Auth: A session token, as `Authorization: Bearer`.

| Status | Meaning | Body |
|---|---|---|
| 200 | The OpenAPI document. | `object` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

## Signup

Agent self-signup settings.

### GET /admin/v1/signup/settings

Get the signup settings.

Shows the agent self-signup policy in effect, with defaults filled in. With overrides on (`auth.WithSignupOverrides`), it also shows the code policy, the stored override, and its version, and sets the ETag header to the version. Hooks are code: the response says only whether each is set.

Auth: A session token, as `Authorization: Bearer`.

| Status | Meaning | Body |
|---|---|---|
| 200 | The signup policy in effect. | `AdminSignupSettings` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

### PUT /admin/v1/signup/settings

Change the signup override.

Replaces the stored signup override, which can only narrow the code policy. It needs a human who signed in with more than one factor in the last 10 minutes, and If-Match with the ETag from GET, so two admins can't overwrite each other. The change is recorded as a `signup_settings_changed` event, and every server applies it within 5 seconds.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `If-Match` (required) | header | `string` | The ETag from GET /v1/signup/settings. |

Body: `AdminSignupOverride` as `application/json`.

| Status | Meaning | Body |
|---|---|---|
| 200 | The settings in effect after the change. | `AdminSignupSettings` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 409 | `version_conflict`: someone changed the override since the given version. | `AdminError` |
| 428 | `precondition_required`: If-Match is missing. | `AdminError` |
| 429 | `throttled`: too many changes. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

## Users

### GET /admin/v1/users

List users.

Lists users who have a stored session or own an agent, ordered by ID. The library knows users only through their sessions and agents; your application's user directory is the source of truth for accounts.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `cursor` | query | `string` | `next_cursor` from the previous page. |
| `limit` | query | `integer` | Items per page. From 1 to 200. Default: 50. |

| Status | Meaning | Body |
|---|---|---|
| 200 | A page of users. | `AdminUserList` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

### GET /admin/v1/users/{user}

Get a user.

Returns one user's summary.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `user` (required) | path | `AdminID` |  |

| Status | Meaning | Body |
|---|---|---|
| 200 | The user. | `AdminUserBody` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 404 | `not_found`: the user, session, or agent doesn't exist. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

### POST /admin/v1/users/{user}/revoke

Revoke a user's sessions.

Revokes every session of the user, human and agent, and every session delegated from them. Agents stay enabled; revoke them separately. Needs a human session that authenticated within the freshness window (10 minutes by default); agents always get `human_required`. The change is rate-limited per administrator and recorded in the audit log with the administrator as the actor.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `user` (required) | path | `AdminID` |  |

| Status | Meaning | Body |
|---|---|---|
| 200 | The user after the revocation. | `AdminUserBody` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 404 | `not_found`: the user, session, or agent doesn't exist. | `AdminError` |
| 429 | `throttled`: too many changes. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

## Sessions

### GET /admin/v1/users/{user}/connections

List a user's connections.

Lists the user's live OAuth grants for a resource, such as MCP clients connected to an MCP server, oldest first. Each grant is its own connection, even when several share a client ID. Revoke one with `revokeSession` on its `id`, which ends every token under it and leaves the user's other connections.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `user` (required) | path | `AdminID` |  |

| Status | Meaning | Body |
|---|---|---|
| 200 | The user's connections. | `AdminConnectionList` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 404 | `not_found`: the user, session, or agent doesn't exist. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

### GET /admin/v1/users/{user}/sessions

List a user's sessions.

Lists every stored session of the user, live or not, in creation order. Build the delegation tree from `parent_id`.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `user` (required) | path | `AdminID` |  |

| Status | Meaning | Body |
|---|---|---|
| 200 | The user's sessions. | `AdminSessionList` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 404 | `not_found`: the user, session, or agent doesn't exist. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

### GET /admin/v1/users/{user}/sessions/{session}

Get a session and its delegation tree.

Returns the session and every session delegated from it, at any depth, in creation order.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `user` (required) | path | `AdminID` |  |
| `session` (required) | path | `AdminID` |  |

| Status | Meaning | Body |
|---|---|---|
| 200 | The session and its descendants. | `AdminSessionTree` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 404 | `not_found`: the user, session, or agent doesn't exist. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

### POST /admin/v1/users/{user}/sessions/{session}/revoke

Revoke a session and its delegation tree.

Revokes the session and every session delegated from it. The session must belong to the user in the path. Revoking a revoked session succeeds and changes nothing. Needs a human session that authenticated within the freshness window (10 minutes by default); agents always get `human_required`. The change is rate-limited per administrator and recorded in the audit log with the administrator as the actor.

Auth: A session token, as `Authorization: Bearer`.

| Parameter | In | Type | Description |
|---|---|---|---|
| `user` (required) | path | `AdminID` |  |
| `session` (required) | path | `AdminID` |  |

| Status | Meaning | Body |
|---|---|---|
| 200 | The session and its descendants after the revocation. | `AdminSessionTree` |
| 400 | `invalid_request`: a parameter is malformed, or `invalid_cursor`: the cursor is malformed or from another route. | `AdminError` |
| 401 | `unauthenticated`: no credential, or one that doesn't work. | `AdminError` |
| 403 | `forbidden`: the principal isn't an administrator, `step_up_required`: a change from a stale session, `stronger_factor_required`: a change from a session whose factors are too weak, such as a recovery code alone, or `human_required`: a change from an agent or a token. | `AdminError` |
| 404 | `not_found`: the user, session, or agent doesn't exist. | `AdminError` |
| 429 | `throttled`: too many changes. | `AdminError` |
| 503 | `unavailable`: the store or limiter failed. Retry later. | `AdminError` |

## Schemas

### AdminActor

Who made a change on someone else's behalf.

| Field | Type | Description |
|---|---|---|
| `agent_id` | `AdminID` |  |
| `session_id` | `AdminID` |  |
| `user_id` (required) | `AdminID` |  |

### AdminAgent

An agent: a delegated identity.

| Field | Type | Description |
|---|---|---|
| `claim_by` | `string (date-time)` | For an unclaimed agent, when it's deleted unless a human claims it. |
| `claimed_at` | `string (date-time)` | When a human claimed the agent. Absent for agents that never signed themselves up. |
| `claimed_type` | `string` | The agent type the agent reported when it signed itself up, for example `claude-code`. Self-reported: trust it only when `type_verified` is true. |
| `created_at` (required) | `string (date-time)` |  |
| `disabled_at` | `string (date-time)` | Absent while the agent is enabled. |
| `id` (required) | `AdminID` |  |
| `name` (required) | `string` |  |
| `owner_id` | `AdminID` | The human who owns the agent. Absent while the agent is unclaimed. |
| `scopes` (required) | `array of string` | The most any session of the agent may hold. |
| `state` (required) | `string` | `active`, `disabled`, or `unclaimed` for an agent that signed itself up and that no human has claimed. A disabled agent is `disabled` whether or not it was claimed. The set is open: accept values you don't know. |
| `type_verified` (required) | `boolean` | True only when the application's verifier accepted an attestation of `claimed_type`. |

### AdminAgentBody

| Field | Type | Description |
|---|---|---|
| `agent` (required) | `AdminAgent` |  |
| `sessions` (required) | `array of AdminSession` |  |

### AdminAgentCounts

Agents by state.

| Field | Type | Description |
|---|---|---|
| `active` (required) | `integer` | Owned by a user and not disabled. At least 0. |
| `disabled` (required) | `integer` | Disabled, claimed or not. At least 0. |
| `unclaimed` (required) | `integer` | Signed themselves up, not claimed, and not disabled. At least 0. |

### AdminAgentList

| Field | Type | Description |
|---|---|---|
| `agents` (required) | `array of AdminAgent` |  |
| `next_cursor` | `AdminCursor` |  |

### AdminAlert

An alert derived from the audit log.

| Field | Type | Description |
|---|---|---|
| `agent_id` | `AdminID` |  |
| `agent_ids` | `array of AdminID` | Up to 10 agents, for alerts about agent state such as `unclaimed_near_expiry`. |
| `client` | `string` |  |
| `count` (required) | `integer` | How many attempts or events the alert covers. At least 1. |
| `first_at` (required) | `string (date-time)` |  |
| `first_seq` | `integer` | Absent for alerts about agent state, such as `unclaimed_near_expiry`. At least 1. |
| `id` (required) | `string` | Stable for the same alert across requests. |
| `kind` (required) | `string` | `token_reuse`, `token_leaked`, `passkey_clone_suspected`, `totp_locked`, `failure_burst`, `signup_spike`, `signup_quota_pressure`, `unclaimed_near_expiry`, `export_started`, `users_exported`, or a kind that an alert source adds, such as the server's `webhook_late` and `webhook_skipped`. The set is open: accept values you don't know. |
| `last_at` (required) | `string (date-time)` |  |
| `last_seq` | `integer` | Absent for alerts about agent state, such as `unclaimed_near_expiry`. At least 1. |
| `message` (required) | `string` |  |
| `session_id` | `AdminID` |  |
| `severity` (required) | `string` | `high`, `medium`, or `low`. The set is open. |
| `source` | `string` | For `token_leaked`, where the token was found. Show it as text; don't follow it automatically. |
| `user_id` | `AdminID` |  |

### AdminAlertList

| Field | Type | Description |
|---|---|---|
| `alerts` (required) | `array of AdminAlert` |  |
| `scanned` (required) | `integer` | How many events the scan read. At least 0. |
| `since` (required) | `string (date-time)` |  |
| `truncated` (required) | `boolean` | True when the scan stopped at its limit before reaching `since`. |

### AdminChainStatus

The last verification of the audit chain.

| Field | Type | Description |
|---|---|---|
| `checked_at` (required) | `string (date-time)` |  |
| `checkpoints` (required) | `integer` | How many trusted checkpoints the chain was checked against. At least 0. |
| `head_hash` | `string` | The hex SHA-256 chain hash at `verified_through`. Absent for an empty chain. |
| `message` | `string` | What failed, when `status` is not `verified`. |
| `oldest_unsealed_at` | `string (date-time)` | When the oldest unsealed event was recorded. Absent when every event is sealed. |
| `status` (required) | `string` | `verified`, `tampered`, or `unavailable` when the check could not run. The set is open. |
| `unsealed` (required) | `integer` | How many events were not yet sealed into the chain when the check ran. The check can't detect a change to them. A count that keeps growing means nothing runs `Service.Run`. At least 0. |
| `verified_through` (required) | `integer` | The chain position the check reached. When `status` is `tampered`, the first bad position follows it. At least 0. |

### AdminChallenge

What would make a refused change succeed.

| Field | Type | Description |
|---|---|---|
| `action` (required) | `string` | The route's action. |
| `approval` | `object` | An approval an agent can wait for. The admin API never sets it, because only humans make changes there. |
| `approval.expires_in` | `integer` |  |
| `approval.id` | `string` |  |
| `approval.summary` | `string` |  |
| `approval.url` | `string` |  |
| `assurance` (required) | `"none" or "recovering" or "single" or "multi"` | The minimum assurance the change needs. |
| `begin` | `string` | Where to begin a step-up, when the application set one. |
| `human` | `boolean` | True when agents and tokens can't make the change. |
| `purpose` | `object` | Set when only an elevation for this purpose meets the need. |
| `purpose.name` | `string` |  |
| `purpose.resource` | `string` |  |
| `satisfy_with` (required) | `array of string` | Factors the administrator has that would pass a step-up, strongest first. Empty when none would. |
| `scopes` | `array of string` | Scopes that were missing. |
| `within_seconds` | `integer` | How recent the administrator's sign-in must be. |

### AdminConnection

| Field | Type | Description |
|---|---|---|
| `client_id` (required) | `string` | The OAuth client ID, which may be the URL of a client ID metadata document. |
| `created_at` (required) | `string (date-time)` |  |
| `expires_at` (required) | `string (date-time)` |  |
| `id` (required) | `AdminID` | The grant's root session. Revoke the connection by revoking this session. |
| `last_used_at` (required) | `string (date-time)` | The latest use of any token in the grant. |
| `resource` (required) | `string` | The resource the tokens are for. |
| `scopes` (required) | `array of string` |  |

### AdminConnectionList

| Field | Type | Description |
|---|---|---|
| `connections` (required) | `array of AdminConnection` |  |

### AdminCursor

An opaque cursor for the next page. Absent on the last page. Pass it back unchanged to the same route.

Type: `string`.

### AdminError

An error response: RFC 9457 problem details, served as `application/problem+json`.

| Field | Type | Description |
|---|---|---|
| `challenge` | `AdminChallenge` |  |
| `code` (required) | `AdminErrorCode` |  |
| `detail` | `string` | What went wrong, for people. It may change. |
| `fix` | `string` | What to do next, for people. It may change. |
| `retry_after` | `integer` | Seconds to wait before retrying, for `throttled`. |
| `status` (required) | `integer` | The HTTP status code. |
| `title` (required) | `string` | A short summary for people. It may change. |
| `type` (required) | `string` | `urn:tensile:auth:problem:` followed by the code. |

### AdminErrorCode

A machine-readable error code. The set is fixed within /v1. The codes `step_up_required`, `stronger_factor_required`, and `human_required` come with a challenge.

Type: `"forbidden" or "human_required" or "invalid_cursor" or "invalid_request" or "method_not_allowed" or "not_found" or "precondition_required" or "step_up_required" or "stronger_factor_required" or "throttled" or "unauthenticated" or "unavailable" or "version_conflict"`.

### AdminEvent

An audit event. It never includes a token.

| Field | Type | Description |
|---|---|---|
| `action` | `string` | The attempted operation, for failure events. |
| `actor` | `AdminActor` |  |
| `agent_id` | `AdminID` |  |
| `at` (required) | `string (date-time)` |  |
| `client` | `string` | The client key the application recorded, such as an IP address. |
| `count` | `integer` | Sessions affected by a revocation, or attempts a failure event stands for. At least 1. |
| `factor` | `string` | The credential or factor involved. |
| `kind` (required) | `string` | What happened, for example `session_revoked`. The set is open: accept values you don't know. |
| `methods` | `array of string` |  |
| `parent_id` | `AdminID` |  |
| `reason` | `string` | Why an attempt failed. |
| `seq` (required) | `integer` | At least 1. |
| `session_id` | `AdminID` |  |
| `source` | `string` | For `token_leaked`, where a secret scanner found the token. Show it as text; don't follow it automatically. |
| `until` | `string (date-time)` | Set only on a summary of failed attempts: the last attempt it counts. `at` is the first. |
| `user_id` | `AdminID` |  |

### AdminEventList

| Field | Type | Description |
|---|---|---|
| `events` (required) | `array of AdminEvent` |  |
| `next_cursor` | `AdminCursor` |  |

### AdminID

An opaque ID. Percent-encode it in paths.

Type: `string`.

### AdminMe

The caller's own session.

| Field | Type | Description |
|---|---|---|
| `agent_id` | `AdminID` | Absent for human sessions. |
| `authenticated_at` (required) | `string (date-time)` | When the human last proved who they are. |
| `changes_until` | `string (date-time)` | Until when the caller can make changes without a step-up. Absent when a change needs a step-up now, and always for agents. |
| `depth` (required) | `integer` | 0 for a human session, 1 for an agent delegated by a human, and so on. At least 0. |
| `expires_at` (required) | `string (date-time)` | The absolute expiry of the session. |
| `kind` (required) | `string` | `human`, `agent`, `pat`, `oauth`, or `oauth_refresh`. Clients must accept other values. |
| `methods` (required) | `array of string` | How the human proved who they are, sorted. |
| `multi_factor` (required) | `boolean` | Whether the human used a passkey, or TOTP with another factor. |
| `profile` | `AdminProfile` |  |
| `scopes` (required) | `array of string` |  |
| `session_id` (required) | `AdminID` |  |
| `signup_changes_until` | `string (date-time)` | The same for the signup settings, which also need more than one factor. |
| `user_id` | `AdminID` | The responsible human. Absent for an agent that no human has claimed. |

### AdminProfile

What the application's user directory says about a user. Present only when the application passes authadmin.WithDirectory and the directory knows the user.

| Field | Type | Description |
|---|---|---|
| `admin` (required) | `boolean` | Whether the application treats the user as an administrator. |
| `disabled` (required) | `boolean` | Whether the application has disabled the account. |
| `email` | `string` |  |
| `name` | `string` | The name to show, from the application's user directory. |

### AdminSession

A session. It never includes the token.

| Field | Type | Description |
|---|---|---|
| `agent_id` | `AdminID` |  |
| `authenticated_at` (required) | `string (date-time)` |  |
| `client_id` | `string` | The OAuth client an OAuth token was issued to. |
| `created_at` (required) | `string (date-time)` |  |
| `depth` (required) | `integer` | 0 for a human session, 1 for an agent delegated by a human, and so on. At least 0. |
| `expires_at` (required) | `string (date-time)` |  |
| `id` (required) | `AdminID` |  |
| `idle_timeout_seconds` (required) | `integer` | At least 0. |
| `kind` (required) | `"human" or "agent" or "pat" or "oauth" or "oauth_refresh"` | `human` for a sign-in, `agent` for a delegated agent session, `pat` for a personal access token, `oauth` for an OAuth access token, and `oauth_refresh` for an OAuth refresh token. |
| `last_seen_at` (required) | `string (date-time)` |  |
| `methods` (required) | `array of string` | How the human proved who they are, for example `passkey`. |
| `name` | `string` | The name of a personal access token. |
| `parent_id` | `AdminID` | The session this one was delegated from. Absent for a session started by a sign-in. |
| `resource` | `string` | The resource (RFC 8707) an OAuth token is for, such as an MCP server's URI. Absent for tokens without one. |
| `revoked_at` | `string (date-time)` | Absent while the session isn't revoked. |
| `scopes` (required) | `array of string` |  |
| `state` (required) | `string` | `live`, `idle`, `expired`, or `revoked`. The set is open: accept values you don't know. |
| `user_id` (required) | `AdminID` |  |

### AdminSessionList

| Field | Type | Description |
|---|---|---|
| `sessions` (required) | `array of AdminSession` |  |

### AdminSessionTree

| Field | Type | Description |
|---|---|---|
| `descendants` (required) | `array of AdminSession` |  |
| `session` (required) | `AdminSession` |  |

### AdminSignupHooks

Which signup hooks the application set. Hooks are code, so only their presence is shown.

| Field | Type | Description |
|---|---|---|
| `admit` (required) | `boolean` | A final per-request admission hook is set. |
| `verifier` (required) | `boolean` | A vendor attestation verifier is set. |
| `work_check` (required) | `boolean` | A proof-of-work check is set. |

### AdminSignupOverride

Narrows the code policy. It can't turn signup on or widen anything: values past the code ceiling are refused.

| Field | Type | Description |
|---|---|---|
| `claim_window_seconds` (required) | `integer` | A shorter claim window for new agents, at least 60 seconds. 0 keeps the code value. At least 0. |
| `deny_types` (required) | `array of string` | Agent types to deny, on top of the code list. |
| `max_unclaimed` (required) | `integer` | A lower unclaimed-agent quota. 0 keeps the code value. At least 0. |
| `paused` (required) | `boolean` | Stops new signups. Agents already signed up keep working. |
| `require_verified_type` (required) | `boolean` | True requires verified agent types even when the code policy doesn't. |
| `scopes` (required) | `array of string or null` | null keeps the code sandbox. A list replaces it with these scopes, which must be in the code sandbox; an empty list empties it. |

### AdminSignupPolicy

A signup policy, with defaults filled in.

| Field | Type | Description |
|---|---|---|
| `allow_types` (required) | `array of string` | When not empty, only these agent types may sign up. Types are unverified labels unless `require_verified_type` is true. |
| `claim_window_seconds` (required) | `integer` | How long an unclaimed agent lives before it and its sessions are deleted. At least 0. |
| `deny_types` (required) | `array of string` | Agent types that may not sign up. |
| `enabled` (required) | `boolean` | False when the application doesn't turn on agent self-signup. Then every other field is empty or zero. |
| `hooks` (required) | `AdminSignupHooks` |  |
| `max_unclaimed` (required) | `integer` | The most unclaimed agents the store holds. At least 0. |
| `paused` (required) | `boolean` | True when an override paused new signups, or the server hasn't loaded the override yet. Agents already signed up keep working. |
| `require_verified_type` (required) | `boolean` | True when an agent's type must be verified by the vendor attestation hook. |
| `scopes` (required) | `array of string` | The sandbox: the most any session of an unclaimed agent can hold. |
| `session_idle_seconds` (required) | `integer` | How long an unclaimed agent's signup session lasts without use. At least 0. |

### AdminSignupSettings

The signup policy in effect. With overrides on, it also has the code ceiling, the stored override, and its version, which the ETag header carries too.

| Field | Type | Description |
|---|---|---|
| `allow_types` (required) | `array of string` | When not empty, only these agent types may sign up. Types are unverified labels unless `require_verified_type` is true. |
| `claim_window_seconds` (required) | `integer` | How long an unclaimed agent lives before it and its sessions are deleted. At least 0. |
| `code` | `AdminSignupPolicy` | The policy set in code: the most an override can allow. |
| `deny_types` (required) | `array of string` | Agent types that may not sign up. |
| `enabled` (required) | `boolean` | False when the application doesn't turn on agent self-signup. Then every other field is empty or zero. |
| `hooks` (required) | `AdminSignupHooks` |  |
| `max_unclaimed` (required) | `integer` | The most unclaimed agents the store holds. At least 0. |
| `override` | `AdminSignupOverride` |  |
| `paused` (required) | `boolean` | True when an override paused new signups, or the server hasn't loaded the override yet. Agents already signed up keep working. |
| `require_verified_type` (required) | `boolean` | True when an agent's type must be verified by the vendor attestation hook. |
| `scopes` (required) | `array of string` | The sandbox: the most any session of an unclaimed agent can hold. |
| `session_idle_seconds` (required) | `integer` | How long an unclaimed agent's signup session lasts without use. At least 0. |
| `source` (required) | `string` | `code`, or `code_and_override` when the application turned overrides on. The set is open. |
| `version` | `integer` | The override's version. Send it as If-Match to change the override. At least 0. |

### AdminStats

Totals for an overview.

| Field | Type | Description |
|---|---|---|
| `agents` (required) | `AdminAgentCounts` |  |
| `events_last_24h` (required) | `integer` | Audit events in the last 24 hours. At least 0. |
| `live_sessions` (required) | `integer` | Sessions, human and agent, that are not revoked or past their absolute expiry. At least 0. |
| `users` (required) | `integer` | Users who have a stored session or own an agent. At least 0. |

### AdminUser

A user the library knows through their sessions and agents.

| Field | Type | Description |
|---|---|---|
| `active_agents` (required) | `integer` | Enabled agents the user owns. At least 0. |
| `id` (required) | `AdminID` |  |
| `last_seen_at` | `string (date-time)` | The latest use of any stored session. Absent when the user has none. |
| `live_sessions` (required) | `integer` | Sessions, human and agent, that aren't revoked or past their absolute expiry. Idle sessions count until they're used. At least 0. |
| `profile` | `AdminProfile` |  |

### AdminUserBody

| Field | Type | Description |
|---|---|---|
| `user` (required) | `AdminUser` |  |

### AdminUserList

| Field | Type | Description |
|---|---|---|
| `next_cursor` | `AdminCursor` |  |
| `users` (required) | `array of AdminUser` |  |
