v4

latestOpenAPI 3.1.0raw.githubusercontent.com2026-06-13216144508.7 KB
agents

Revoke Agent Api Key

Soft-revoke the agent's active API key.

Idempotent: calling DELETE on an agent with no active key still returns HTTP 200 with revoked=false. This lets clients call DELETE blindly without first getting it to check existence.

Args: agent_id: Path parameter. current_user: Resolved from JWT. db: SQLAlchemy session.

Returns: :class:APIKeyRevokeResponse with: - revoked=true, revoked_at=<now> if an active key was just revoked. - revoked=false, revoked_at=null if no active key existed.

Raises: HTTPException 401: missing or invalid JWT. HTTPException 404: agent missing / not owned.

Notes: Revoked rows stay in the table forever (we only flip revoked_at). The audit trail of "when was a key created and when was it revoked" is the entire point of soft-delete here; hard-deleting would also lose the ability to answer "is this old hash one we issued?" during incident response.

delete/api/agents/{agent_id}/api-key

Path parameters

agent_idinteger required

Response

Successful Response

revokedboolean required

True if this call actually revoked an active key; False if no active key existed (idempotent no-op).

revoked_atstring date-time nullable

Set to the UTC revocation timestamp when revoked is True; None when revoked is False.