principal_is_not_the_caller means you tried to create an API key that acts as a different user. Read this page if you create keys for other people or for services.
What happened
Route:POST /v1/keys.
A key’s principal says who it acts as. The body set principal to {"type": "user", "id": X}, where X is not you. Nobody can mint a key that acts as another person, so no key was created.
How to fix
- For your own use: omit
principal. - For a service or pipeline: use a service-account principal, with an id that names the service. Creating one needs
members_write, which owners and admins hold. - For another person: ask them to create their own key.
Example
keys_write and members_write.
Related
- API key security - how keys act, and how to keep them safe.
- Scopes and roles - who holds
members_write. - Production checklist - one narrow key per service and environment.
- Problem codes - every code, its status, and whether a retry can help.