Create a new API Key
Generates a new API key for the specified realm. The plaintext key is returned only in this response and cannot be retrieved later.
Generates a new API key for the specified realm. The plaintext key is returned only in this response and cannot be retrieved later.
application/json- body
Request to create a new API Key
clientAppId*stringClient App to bind this API key to. Required — every API key must be explicitly bound; a key whose bound app is disabled fails auth.
uuidexpiresAt?|Optional expiration time (ISO 8601 string)
name*stringHuman-readable name for the API key (1-100 characters)
roleIds?array<>|Optional role IDs to assign to this API key after creation (max 20).
API Key created
application/json- response
Response after creating an API Key (plaintext key shown once)
clientAppEnabled*booleanWhether the bound Client App is enabled — false means the key
cannot authenticate until a realm admin re-enables the app.
clientAppId?|Client App this API key is bound to
uuidclientAppName?|Client App display name
createdAt*stringCreation time (ISO 8601)
enabled*booleanWhether the API key is enabled
expiresAt?|Optional expiration time (ISO 8601)
id*stringAPI Key UUID
key*stringPlaintext API key (shown only once, store securely)
name*stringHuman-readable name
realmId*stringRealm this API key belongs to
roleBindingError?|Role binding failure after the key was created. The plaintext key is still returned so the caller never loses the one-time secret.
curl -X POST 'https://example.com/api/api-keys' \
-H 'Content-Type: application/json' \
-d '{
"clientAppId": "d386372c-64d9-49da-bb8b-4b5eda60f56c",
"name": "string"
}'{
"clientAppEnabled": true,
"clientAppId": "d386372c-64d9-49da-bb8b-4b5eda60f56c",
"clientAppName": "string",
"createdAt": "string",
"enabled": true,
"expiresAt": "string",
"id": "string",
"key": "string",
"name": "string",
"realmId": "string",
"roleBindingError": "string"
}