agents
Get Agent Api Key
Return metadata for the agent's currently active API key.
Returns the public-safe prefix and a display-only masked_key. The plaintext secret is unrecoverable by design -- if the owner has lost it, they must POST to rotate.
Args: agent_id: Path parameter. current_user: Resolved from JWT. db: SQLAlchemy session.
Returns: :class:APIKeyMetadataResponse with key_prefix, masked_key, and created_at.
Raises: HTTPException 401: missing or invalid JWT. HTTPException 404: agent missing / not owned; or owned but has no active key. Both shapes use the same status code so the caller cannot distinguish "agent doesn't exist" from "no key generated yet". The detail differentiates so the UI can render "未生成" instead of "agent not found".
get/api/agents/{agent_id}/api-key
Path parameters
agent_idinteger required
Response
Successful Response