The examples on this page use a Project API key. See the
Administration API to create and use an Admin API
key.
Header
The canonical header is bearer auth:/v1/messages, /v1/messages/count_tokens) also accepts the Anthropic-style header, so the official Anthropic SDK works with api_key=... unchanged:
ak_... keys.
Scoped keys
Keys can be scoped to a project. Published policies that apply to that project run automatically when you use its key. See Policies.Rotating keys
When you need to replace a key — suspected leak, compliance cadence, or just housekeeping — do it in three steps:- Create a new key in the console.
- Update your clients to use the new key.
- Revoke the old key.
Never commit keys. Load them from environment variables or a secret manager.