Operator-side surface for agent keys. Mint when bringing up a new agent, deprecate when rotating, revoke when retiring. All methods on this page live underDocumentation Index
Fetch the complete documentation index at: https://docs.alterauth.com/llms.txt
Use this file to discover all available pages before exploring further.
App.agents — they require an app API key (alter_key_app_…). For the runtime use of these keys, see Agent runtime.
The key lifecycle
- Active: the key works for
Agent(api_key=...). - Deprecated: the key still works, but Alter sets
X-Alter-Key-Deprecated: trueon every response. Use this stage when rotating — allow the new key time to roll out before revoking the old one. - Revoked: the key fails immediately with
KeyRevokedErrorand cannot be undeprecated.
Minting a key
Listing keys
key_prefix, name, derived status, created_at, deprecated_at, revoked_at, last_used_at. The plaintext is never recoverable.
Rotating a key (deprecate → mint → revoke)
undeprecate_key to restore a deprecated key to active status when a rotation is cancelled mid-flight.
Revoking a key
force=True is required when revoking the last active key — without it the call raises LastActiveKeyError to protect against accidentally locking out an agent. Use force=True when intentionally retiring the agent.
Common pitfalls
- Keys are shown once. When the plaintext wasn’t captured, it cannot be recovered. Mint a new one and revoke the lost one.
last_used_atupdates eventually. Avoid relying on it for live monitoring — it’s updated lazily on a cascade-isolated path. Use audit logs for real-time tracking.LastActiveKeyError. Default-safe. Useforce=Truewhen actually retiring the agent.
See also
- Agents overview
- Creating agents — provisioning the agent the keys belong to.
- SDK → Agents reference — full method signatures.