# Server-API: sign-in

Quelle: https://docs.neode.sk/de/development/api-reference/server-sign-in/
Zuletzt geändert: 2026-12-03

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

Diese Routen liegen auf der Server-API, Port 21114 (21121 in Docker). Sie nehmen einen API-Schlüssel in `X-API-Key` oder ein Anmelde-Token; siehe [Die HTTP-API](https://docs.neode.sk/de/development/api.md#signing-in). Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.

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 |
