Create Api Key — POST /api/v1/keys
Create Api Key
Generate a new scoped API key. The raw key is only shown once.
Endpoint: POST /api/v1/keys
Authentication: Send a signed-in user’s access token in Authorization: Bearer <access token>, or an API key in X-API-Key: <API key>.
- Your role must be QA engineer or higher.
Parameters
Section titled “Parameters”| Name | In | Required | Type | Default | Description |
|---|---|---|---|---|---|
X-API-Key | header | no | string or null | API key, as an alternative to the access token (see Authentication). |
Request body
Section titled “Request body”| Content type | Body | Required |
|---|---|---|
application/json | ApiKeyCreate | yes |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
201 | Successful Response | ApiKeyCreatedResponse (application/json) |
422 | Validation Error | HTTPValidationError (application/json) |
Errors this endpoint returns, read from its source code:
403, with messages such as “Only ADMIN can create keys for other users”, “Only ADMIN can create project-scoped API keys”, “This API key can grant only the scopes it holds (”, and 3 other messages404, with messages such as “Project not found”, “Target user not found”422, with the message “Unknown API key scope(s):”
It can also return 401 if your credential is missing or expired, 403 if your credential does not allow this request, and 404 if the item does not exist or you cannot see it. Your role, your project membership and the key’s scope decide what a credential allows. See Errors and retries.
More details
Section titled “More details”- Group: API Keys
- Operation ID:
create_api_key_api_v1_keys_post - Source code:
backend/app/routers/api_keys.py, line 60 - Specification: OpenAPI JSON