/api/auth/login

Authenticate a user and register a session.

POST
Request

Body

Content-Type: application/json

PropertyTypeDescription
usernamestringRequired. Username for the user.
passwordstringRequired. Password for the user.
codestring?TOTP code if user has TOTP enabled. This is used as the second request if a totp code is needed

Example

{
"username": "test",
"password": "test"
}

Response

Status: 200 OK

Content-Type: application/json

If login is successful

PropertyTypeDescription
userUserThe authenticated user object.

If TOTP is enabled for the user

PropertyTypeDescription
totpbooleanIndicates that TOTP is enabled.

Example

{
"user": {
"id": "cmb6042f500029kenox2u8npu",
"username": "admin",
"createdAt": "2025-05-27T04:13:22.625Z",
"updatedAt": "2025-05-28T02:20:05.997Z",
"role": "SUPERADMIN",
"view": {},
"oauthProviders": [],
"totpSecret": null,
"passkeys": [],
"quota": null,
"sessions": [],
"token": "MTc0ODMxOTIwMjYyNQ==.ejV1UVFRODBJNHltU0VGZWVaTXNzRmc2UFZKUTlIMmg="
}
}

or if TOTP is enabled:

{
"totp": true
}

It is then recommended to ask the user for their TOTP code, and include it in the next request to this endpoint.

Error Responses

  • 400 Bad Request

    Invalid fields, invalid username or password, invalid TOTP code.



Last updated: 5/30/2025
Edit this page on GitHub