Create an API key
POST/api/v1/api-keys
Creates a new API key for the authenticated user. - project_id is optional. When set, the key is scoped to that single project. When omitted or null, the key is unscoped and spans every project its owner can reach. - If policy_ids is provided, the key's effective permissions are the intersection of the user's policies and the key's policies. - Otherwise the key inherits the user's permissions (confined to the key's project when scoped). - When the request is authenticated with a project-scoped credential, the new key is confined to that same project: omitting project_id defaults to it, naming a different project returns 403 API_KEY_PROJECT_SCOPE, and project_id: null (an unscoped key) is likewise refused. Minting an unscoped key requires an unscoped credential.
Request
Responses
- 201
- 400
- 401
- 403
API key created successfully. The raw key value is only returned once.
Bad request (missing name, invalid project or policy IDs)
Unauthorized
Forbidden (a project-scoped credential named a different project, or asked for an unscoped key)