Check what an API key is with GET /v1/key
`GET /v1/key` returns the calling key's name, prefix, scopes, environment, organization and expiry.
Before: There was no call to ask what an API key could do. A client that held only its key could not see its scopes or when it expires. It found out when a request failed.
Now: GET /v1/key returns the key's id, name, prefix, scopes, environment, organization, creation time and expires_at. expires_at is null for a key that does not expire. The call needs no scope and never returns the secret.
What this means for you: A client can check its own key before it does any work, and show or hide features to match.
Use cases
- Let a tool server list only the tools its key has the scope to call.
- Warn a user in your app when their key is close to
expires_at. - Check in a deploy script that the key it received is the one you meant to use.
Docs:Authentication
Back to the changelog