Skip to content

Create Api Key

POST
/api-keys
curl --request POST \
--url https://api.mengi.cloud/api-keys \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "description": "example", "expires_at": "2026-04-15T12:00:00Z" }'

Create a new API key.

The full API key is only returned once in this response. Store it securely - you won’t be able to see it again.

Media type application/json
APIKeyCreate
object
name
required
Name
string
description
Any of:
string
expires_at
Any of:
string format: date-time
Example generated
{
"name": "example",
"description": "example",
"expires_at": "2026-04-15T12:00:00Z"
}

Successful Response

Media type application/json
APIKeyCreateResponse

Response when creating a new API key - includes the full key (only shown once).

object
id
required
Id
string format: uuid
name
required
Name
string
description
required
Any of:
string
key
required
Key
string
key_prefix
required
Key Prefix
string
expires_at
required
Any of:
string format: date-time
created_at
required
Created At
string format: date-time
Example generated
{
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"name": "example",
"description": "example",
"key": "example",
"key_prefix": "example",
"expires_at": "2026-04-15T12:00:00Z",
"created_at": "2026-04-15T12:00:00Z"
}

Validation Error

Media type application/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Example generated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}