POST
/api/admin/api-keysAdminCreate an API key
Creates a key with allow_any_audience=false and no scope entries, so it can send to nobody until its audience is configured. The plaintext token is returned exactly once.
operationId
createApiKeyAdmin: API KeysAuthentication & permissionsAdmin
Platform administrators only
- Accepted credentials
- Access token (Bearer)
Authorization: Bearer <JWT> - Access token (cookie)
cookie "access_token_schemavaults-mail"
- Access token (Bearer)
- Who may call
- Platform administrators only
Request body
Required
application/json
CreateApiKeyRequestBody
| Property | Type | Description |
|---|---|---|
| name* | string | Human-facing API key label (1-64 characters). minLength: 1maxLength: 64 |
JSONExample
"name""marketing-site"
Responses
application/json
| Property | Type | Description |
|---|---|---|
| success* | true | |
| data* | CreatedApiKey | |
| api_key_id* | string (uuid) | |
| name* | string | minLength: 1maxLength: 64 |
| key_prefix* | string | minLength: 1 |
| created_at* | number | minimum: 0 |
| created_by_user_id* | string (uuid) | |
| plaintext* | string | The full API key token. Returned EXACTLY ONCE, on creation — it is stored only as a hash. |
| message* | string |
JSONExample
"success"true
"data"
"api_key_id""123e4567-e89b-12d3-a456-426614174000"
"name""string"
"key_prefix""string"
"created_at"1.5
"created_by_user_id""123e4567-e89b-12d3-a456-426614174000"
"plaintext""svlts_mail_pk_..."
"message""string"
Example request
bashcurl
curl -X POST 'https://mail.schemavaults.com/api/admin/api-keys' \
-H 'Authorization: Bearer <access_token>' \
-H 'Content-Type: application/json' \
-d '{
"name": "marketing-site"
}'