Mutation
mutation CreateApiKey($input: CreateApiKeyInput!) {
createApiKey(input: $input) {
apiKey {
id
description
permissions
createdBy {
__typename
... on UserActor {
__typename
}
}
createdAt {
unixTimestamp
iso8601
}
updatedBy {
__typename
... on UserActor {
__typename
}
}
}
apiKeySecret
error {
message
type
code
fields {
field
message
type
}
}
}
}Variables
{
"input": {
"machineUserId": "id",
"permissions": [
"string"
]
}
}Response
{
"data": {
"createApiKey": {
"apiKey": {
"id": "id",
"description": "string",
"permissions": [
"string"
],
"createdBy": {
"__typename": "UserActor"
},
"createdAt": {
"unixTimestamp": "string",
"iso8601": "string"
},
"updatedBy": {
"__typename": "UserActor"
}
},
"apiKeySecret": "string",
"error": {
"message": "string",
"type": "VALIDATION",
"code": "string",
"fields": [
{
"field": "string",
"message": "string",
"type": "VALIDATION"
}
]
}
}
}
}Mutations
createApiKey
Create an API key for a machine user. The plaintext secret is returned only once in apiKeySecret and cannot be retrieved again — store it immediately. You can only grant permissions that you yourself hold; attempting to escalate privileges returns an error. Requires the apiKey:create permission.
MUTATION
createApiKey(input: CreateApiKeyInput!): CreateApiKeyOutput!Arguments
input
required
Returns
apiKey
apiKeySecret
String
The plaintext API key secret (format: plainApiKey_…). This value is only returned once at creation time and cannot be retrieved later — store it securely immediately.
error
Mutation
mutation CreateApiKey($input: CreateApiKeyInput!) {
createApiKey(input: $input) {
apiKey {
id
description
permissions
createdBy {
__typename
... on UserActor {
__typename
}
}
createdAt {
unixTimestamp
iso8601
}
updatedBy {
__typename
... on UserActor {
__typename
}
}
}
apiKeySecret
error {
message
type
code
fields {
field
message
type
}
}
}
}Variables
{
"input": {
"machineUserId": "id",
"permissions": [
"string"
]
}
}Response
{
"data": {
"createApiKey": {
"apiKey": {
"id": "id",
"description": "string",
"permissions": [
"string"
],
"createdBy": {
"__typename": "UserActor"
},
"createdAt": {
"unixTimestamp": "string",
"iso8601": "string"
},
"updatedBy": {
"__typename": "UserActor"
}
},
"apiKeySecret": "string",
"error": {
"message": "string",
"type": "VALIDATION",
"code": "string",
"fields": [
{
"field": "string",
"message": "string",
"type": "VALIDATION"
}
]
}
}
}
}Was this page helpful?

