Skip to content

Create API key

POST
/api/v1/api-keys
curl --request POST \
--url https://localhost:8080/api/v1/api-keys \
--header 'Authorization: <Authorization>' \
--header 'Content-Type: application/json' \
--data '{ "allowedIps": [ "example" ], "description": "example", "expiresAt": "example", "name": "example", "organizationId": 1, "projectId": 1, "scopes": [ "example" ] }'

Create a new API key for service-to-service authentication

API key configuration

Media type application/json
object
allowedIps
Array<string>
description
string
expiresAt
string
name
required
string
>= 1 characters <= 255 characters
organizationId
integer
projectId
integer
scopes
Array<string>
Example generated
{
"allowedIps": [
"example"
],
"description": "example",
"expiresAt": "example",
"name": "example",
"organizationId": 1,
"projectId": 1,
"scopes": [
"example"
]
}

Created API key (key shown only once)

Media type application/json
object
apiKey
object
allowedIps
Array<string>
createdAt
string
createdBy

Key lifecycle

string
description
string
expiresAt
string
id
string
keyId
string
lastUsedAt
string
name
string
organizationId
integer
projectId
integer
revocationReason
string
revokedAt
string
revokedBy
string
scopes

Permissions and scope

Array<string>
status

Status

string
usageCount
integer
userId

User context

string
keyPrefix
string
plainKey

Only returned once during creation

string
Example generated
{
"apiKey": {
"allowedIps": [
"example"
],
"createdAt": "example",
"createdBy": "example",
"description": "example",
"expiresAt": "example",
"id": "example",
"keyId": "example",
"lastUsedAt": "example",
"name": "example",
"organizationId": 1,
"projectId": 1,
"revocationReason": "example",
"revokedAt": "example",
"revokedBy": "example",
"scopes": [
"example"
],
"status": "example",
"usageCount": 1,
"userId": "example"
},
"keyPrefix": "example",
"plainKey": "example"
}

Bad request - Invalid request body

Media type application/json
object
error
string
error_description
string
Example
{
"error": "Unauthorized",
"error_description": "Invalid token"
}

Unauthorized - Authentication required

Media type application/json
object
error
string
error_description
string
Example
{
"error": "Unauthorized",
"error_description": "Invalid token"
}

Internal server error

Media type application/json
object
error
string
error_description
string
Example
{
"error": "Unauthorized",
"error_description": "Invalid token"
}