Search the docs
Menu
Updated Edit on GitHub

Server API: sign-in

Copy as Markdown

These routes are on the server API, port 21114 (21121 in Docker). They take an API key in X-API-Key or a sign-in token; see The HTTP API.

Signing in to the server API with a console account, and the account the token signs in as.

POST /api/auth/login

Sign in with a console account and get a token.

Local and LDAP accounts sign in here; an account that uses single sign-on gets 401. When the account has two-factor sign-in on, the answer is requires_2fa and a partial_token for POST /api/auth/login/2fa instead of a token. An account that must set up two-factor sign-in (code totp_setup_required) or choose a new password (code password_change_required) first does that in the web console; a disabled account gets code account_disabled. Failed sign-ins count per address and per username.

On the server API, port 21114.

Request body, application/json:

Field Type Required What it is
username string yes
password string yes write only

200: Signed in, or the second factor is needed (application/json)

Object or object.

Error When
400 The request is not valid
401 Wrong username or password, or the account uses single sign-on
403 The account is disabled, or must set up two-factor sign-in or a new password in the web console; code says which
429 Too many sign-in attempts
504 The directory did not answer in time

POST /api/auth/login/2fa

Finish a sign-in with the two-factor code.

code is the six digits of the authenticator app or one of the recovery codes; a recovery code works once and the answer then says used_recovery_code.

On the server API, port 21114.

Request body, application/json:

Field Type Required What it is
partial_token string yes From POST /api/auth/login
code string yes write only

200: Signed in (application/json)

Object and object.

Error When
400 The request is not valid
401 The partial token is not valid or expired, or the code is wrong
403 The account is disabled (code account_disabled)
429 Too many attempts

GET /api/auth/me

Show the account the token signs in as.

An API key has no account and gets 401.

On the server API, port 21114. Needs the sign-in token of a person; API keys are refused.

200: Done (application/json)

Field Type What it is
id integer
username string
role string
totp_enabled boolean
is_server_admin boolean
created_at string (date-time)
last_login string or null (date-time) null when it never signed in
Error When
401 No credential, or one that is not valid

Type to search pages, sections, commands and settings.