createApiKey
Requires at least one of the permissions settings:api:create or settings:tenant:update.
Generate a new API key. The full key is only shown once. Requires permission to create API keys or update tenant settings.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation CreateApiKey($input: CreateApiKeyInputGql!) {
createApiKey(input: $input) {
id
name
createdAt
allowedIps
expiresAt
isActive
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CreateApiKey($input: CreateApiKeyInputGql!) {\n createApiKey(input: $input) {\n id\n name\n createdAt\n allowedIps\n expiresAt\n isActive\n }\n}",
"variables": {
"input": {
"name": "string"
}
}
}
EOF
Variables:
{
"input": {
"name": "string"
}
}
Response:
{
"data": {
"createApiKey": {
"id": "id",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"allowedIps": [
"string"
],
"expiresAt": "2025-01-15T00:00:00Z",
"isActive": true
}
}
}
createApiKey(
input: CreateApiKeyInputGql!
): ApiKeyResult!
Arguments
createApiKey.input ● CreateApiKeyInputGql! non-null input
The details of the api key to create.
Type
ApiKeyResult object
An API key. The full key is never shown again after it is created.