Users API
DELETE /api/v1/users/
Permanently deletes a user account.
Token and session revocation on deletion (Wave 1.5)
Before the user record is removed, the server now performs the following revocation steps to prevent orphaned tokens from passing introspection:
- List all agents created by the user (
created_by = user_id). - Revoke all OAuth tokens for each agent via
RevokeOAuthTokensByClientID. - Delete all active sessions for the user via
DeleteSessionsByUserID. - Delete the user (ON DELETE CASCADE handles FK-linked rows in the schema).
Audit event: user.deleted_with_token_revocation is written with metadata:
Previously issued tokens will return active: false on introspection immediately after the DELETE completes.
Response
Returns 200 OK with { "message": "User deleted" } on success, or 404 if the user does not exist.
GET /api/v1/users//agents
Returns agents associated with a user. Auth: admin API key.
Query parameters
| Parameter | Values | Default | Description |
|---|---|---|---|
filter | created | authorized | created | Which relationship to query |
filter=created — agents where created_by = user_id.
filter=authorized — agents where an active oauth_consents row exists for the user (revoked_at IS NULL).
Response
GET /api/v1/me/agents
Same as /users/{id}/agents but scoped to the calling user. Auth: session cookie.
Query parameters
Same filter parameter as above (created | authorized).
Response
Same shape as /users/{id}/agents.
POST /api/v1/users//revoke-agents
Cascade revoke — deactivates all of a user's agents and revokes all associated OAuth tokens and consents in a single operation. Part of the Layer 3 of 5 security model (see cascade-revoke.md).
Auth: ADMIN API KEY ONLY. Session tokens are explicitly rejected (mitigates account-takeover blast radius).
Request body (optional)
When agent_ids is omitted, all agents created by the user are targeted.
Server-side actions
- If
agent_idsis omitted, list all agents wherecreated_by = user_id. - For each agent: set
active = false, revoke all OAuth tokens viaRevokeOAuthTokensByClientID. - Bulk-revoke all
oauth_consentsrows whereuser_id = ?andrevoked_at IS NULL. - Write a single audit event
user.cascade_revoked_agentswith metadata. - Return summary.