Client mappings API
Which registered agent an IdP client acts as. An MCP client registered at your IdP is
identified by the azp (or client_id) claim of its tokens; it has no authority until an
admin maps it to an agent here. Consent then runs its sessions in that agent's scope.
Every route needs the admin bearer and returns 404 unless the control plane runs with
AGENTIC_AUTH_CLIENT_MAPPING_ENABLED=true (which requires verified consent). Available from
0.4.0.
POST /v1/agents/{agent_id}/clients
{"client_id": "desktop-client"}
client_id: 1–255 characters, no whitespace. The issuer is not part of the request: it is
always the configured principal IdP, the only one whose tokens consent verifies.
Response — 201 (AgentClientRead):
{
"id": "…",
"agent_id": "…",
"issuer": "https://idp.example.com",
"client_id": "desktop-client",
"created_at": "2026-11-25T10:00:00Z",
"created_by": "admin",
"removed_at": null,
"removed_by": null
}
| Status | Meaning |
|---|---|
404 | Unknown agent |
409 | client_already_mapped: the client already acts as an agent. One client maps to one agent; remove the old mapping first |
422 | Validation error |
One agent may have several clients, such as a desktop app and a CLI.
GET /v1/agents/{agent_id}/clients
Active mappings, newest first, with the standard pagination (limit, cursor).
include_removed=true includes removed ones, which makes this the mapping's history.
DELETE /v1/agents/{agent_id}/clients/{client_id}
204. Soft removal: the row stays, with removed_at and removed_by set. Removing an
already removed mapping is 204 again. A mapping that never existed is 404. Mapping the
client again creates a new row.
Removing a mapping stops new sessions for the client. It does not end sessions already
running, which expire within AGENTIC_AUTH_SESSION_TTL_SECONDS; revoke the agent for an
immediate stop.