Skip to main content

Overview

The Dashboard Authentication API manages password and two-factor authentication (TOTP) for accessing the Codex-LB web dashboard and management APIs.
Dashboard authentication is separate from API key authentication. API keys are for proxy endpoints, while dashboard auth is for management endpoints.

GET /api/dashboard-auth/session

Get the current dashboard authentication session state.

Response

boolean
Whether a password has been set up
boolean
Whether the current session has verified the password
boolean
Whether TOTP 2FA is configured
boolean
Whether the current session has verified TOTP
boolean
Whether TOTP is required for dashboard access

Example Request

cURL

Example Response

POST /api/dashboard-auth/password/setup

Set up the initial dashboard password. Can only be called once.

Request Body

string
required
Password to set. Must be at least 8 characters.

Response

Returns session state after successful setup. Sets dashboard_session cookie.

Example Request

cURL

POST /api/dashboard-auth/password/login

Authenticate with the dashboard password.

Request Body

string
required
Dashboard password

Response

Returns session state after successful login. Sets dashboard_session cookie.

Rate Limiting

Password login is rate-limited to 8 attempts per 60 seconds per IP address.

Example Request

cURL

POST /api/dashboard-auth/password/change

Change the dashboard password. Requires active password session.

Request Body

string
required
Current password for verification
string
required
New password to set. Must be at least 8 characters.

Example Request

cURL

DELETE /api/dashboard-auth/password

Remove the dashboard password. Requires active password session.
Removing the password disables all authentication. Anyone will be able to access the dashboard.

Request Body

string
required
Current password for confirmation

Example Request

cURL

POST /api/dashboard-auth/totp/setup/start

Start TOTP (two-factor authentication) setup. Requires active password session.

Response

string
TOTP secret key in base32 format
string
Data URL for QR code image to scan with authenticator app
string
Token to use when confirming TOTP setup

Example Request

cURL

Example Response

POST /api/dashboard-auth/totp/setup/confirm

Complete TOTP setup by verifying a code from the authenticator app.

Request Body

string
required
Setup token from /totp/setup/start
string
required
6-digit code from authenticator app

Example Request

cURL

POST /api/dashboard-auth/totp/verify

Verify a TOTP code to complete dashboard login.

Request Body

string
required
6-digit code from authenticator app

Response

Returns session state after successful verification. Updates dashboard_session cookie.

Rate Limiting

TOTP verification is rate-limited to 8 attempts per 60 seconds per IP address.

Example Request

cURL

POST /api/dashboard-auth/totp/disable

Disable TOTP two-factor authentication. Requires active password session.

Example Request

cURL

POST /api/dashboard-auth/logout

Log out and invalidate the current dashboard session.

Example Request

cURL

Session Management

Authenticated sessions are stored in a cookie named dashboard_session:
  • HTTPOnly: Yes (not accessible via JavaScript)
  • Secure: Yes (HTTPS only in production)
  • SameSite: Lax
  • Max-Age: 12 hours (43200 seconds)
  • Encryption: AES-256-GCM

Session State

Each session tracks:
  • password_verified - Whether password was authenticated
  • totp_verified - Whether TOTP was verified (if enabled)
If TOTP is required (isTotpRequiredOnLogin: true), both password_verified and totp_verified must be true to access protected endpoints.

Error Codes

Authentication Flow

Initial Setup

Login (Password Only)

Login (Password + TOTP)