Skip to content

Create a new API key for a service user.

POST
/api/workspace/users/{userId}/api-keys
curl --request POST \
--url https://example.com/api/workspace/users/example/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "Name": "example", "ExpiresAt": "2026-04-15T12:00:00Z", "IsPermanent": true }'
userId
required
string
access_token
string

Optional access token for clients that cannot set Authorization headers. Prefer Authorization: Bearer <token> when possible.

Request payload to create an API key for a service user.

object
Name

Human-readable label for the key.

string
nullable
ExpiresAt

Expiration timestamp (required when IsPermanent is false).

string format: date-time
nullable
IsPermanent

When true, the API key never expires.

boolean
Examplegenerated
{
"Name": "example",
"ExpiresAt": "2026-04-15T12:00:00Z",
"IsPermanent": true
}

OK

Media typeapplication/json
object
Data

Response payload for a newly created API key.

object
Id

API key identifier.

string
nullable
Token

Bearer token for the API key.

string
nullable
Name

Label for the key.

string
nullable
CreatedAt

Creation timestamp.

string format: date-time
ExpiresAt

Expiration timestamp or null when the key never expires.

string format: date-time
nullable
Errors
Array<object>
nullable
object
Code
required
string
nullable
Message
required
string
nullable
Target
string
nullable
Field
string
nullable
Metadata
object
key
additional properties
string
nullable
Type
integer format: int32
Allowed values: 0 1 2
Severity
integer format: int32
Allowed values: 0 1 2
Warnings
Array<object>
nullable
object
Code
required
string
nullable
Message
required
string
nullable
Target
string
nullable
Field
string
nullable
Metadata
object
key
additional properties
string
nullable
Type
integer format: int32
Allowed values: 0 1 2
Severity
integer format: int32
Allowed values: 0 1 2
Success
boolean
Example
{
"Errors": [
{
"Type": 0,
"Severity": 0
}
],
"Warnings": [
{
"Type": 0,
"Severity": 0
}
]
}

Bad Request

Media typeapplication/json
object
Data

Response payload for a newly created API key.

object
Id

API key identifier.

string
nullable
Token

Bearer token for the API key.

string
nullable
Name

Label for the key.

string
nullable
CreatedAt

Creation timestamp.

string format: date-time
ExpiresAt

Expiration timestamp or null when the key never expires.

string format: date-time
nullable
Errors
Array<object>
nullable
object
Code
required
string
nullable
Message
required
string
nullable
Target
string
nullable
Field
string
nullable
Metadata
object
key
additional properties
string
nullable
Type
integer format: int32
Allowed values: 0 1 2
Severity
integer format: int32
Allowed values: 0 1 2
Warnings
Array<object>
nullable
object
Code
required
string
nullable
Message
required
string
nullable
Target
string
nullable
Field
string
nullable
Metadata
object
key
additional properties
string
nullable
Type
integer format: int32
Allowed values: 0 1 2
Severity
integer format: int32
Allowed values: 0 1 2
Success
boolean
Example
{
"Errors": [
{
"Type": 0,
"Severity": 0
}
],
"Warnings": [
{
"Type": 0,
"Severity": 0
}
]
}

Forbidden

Media typeapplication/json
object
type
string
nullable
title
string
nullable
status
integer format: int32
nullable
detail
string
nullable
instance
string
nullable
key
additional properties
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example"
}

Not Found

Media typeapplication/json
object
Data

Response payload for a newly created API key.

object
Id

API key identifier.

string
nullable
Token

Bearer token for the API key.

string
nullable
Name

Label for the key.

string
nullable
CreatedAt

Creation timestamp.

string format: date-time
ExpiresAt

Expiration timestamp or null when the key never expires.

string format: date-time
nullable
Errors
Array<object>
nullable
object
Code
required
string
nullable
Message
required
string
nullable
Target
string
nullable
Field
string
nullable
Metadata
object
key
additional properties
string
nullable
Type
integer format: int32
Allowed values: 0 1 2
Severity
integer format: int32
Allowed values: 0 1 2
Warnings
Array<object>
nullable
object
Code
required
string
nullable
Message
required
string
nullable
Target
string
nullable
Field
string
nullable
Metadata
object
key
additional properties
string
nullable
Type
integer format: int32
Allowed values: 0 1 2
Severity
integer format: int32
Allowed values: 0 1 2
Success
boolean
Example
{
"Errors": [
{
"Type": 0,
"Severity": 0
}
],
"Warnings": [
{
"Type": 0,
"Severity": 0
}
]
}