Create My Api Key
POST
/auth/api-keys/
const url = 'https://example.com/api/auth/api-keys/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/auth/api-keys/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example" }'Create an API key for the current user.
The raw key is returned only in this response and cannot be retrieved again.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ” Media type application/json
ApiKeyCreateRequest
object
name
required
Name
Human-readable label for the API key
string
Example generated
{ "name": "example"}Responses
Section titled “ Responses ”Successful Response
Media type application/json
ApiKeyCreateResponse
object
id
required
Id
string format: uuid
key
required
Key
The API key secret (shown only once)
string
name
required
Name
string
created_at
required
Created At
string format: date-time
Example generated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "key": "example", "name": "example", "created_at": "2026-04-15T12:00:00Z"}Validation Error
Media type application/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}