API Authentication
Last updated September 21, 2026
Authenticate to the Matruno API with login-backed access tokens, refresh tokens, secure cookies, TOTP support, and workspace-scoped sessions for legal matter access.
Authentication model#
The application authenticates users through POST /api/v1/auth/login. A successful login returns an access_token, a refresh_token, an expires_at timestamp, and sets auth cookies for browser sessions. Backend auth dependencies also accept bearer credentials, but the product UI is session-based and workspace-scoped.
/api/v1/auth/loginWhat the real login flow expects#
email_or_usernameandpasswordare required.totp_codeis required when two-factor authentication is enabled.device_nameis optional but useful for session review and audit.- Some login attempts can return
requires_totp_setuporrequires_totpwith a temporary token. - Workspace setup is handled by
POST /api/v1/auth/workspace/setupand the frontend/setuppage.
Example request#
curl -X POST "http://localhost:5678/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email_or_username": "admin@example.com",
"password": "SecurePassword123!",
"totp_code": "123456",
"device_name": "Docs Automation Runner"
}'
Required headers#
| Header | Purpose |
|---|---|
Content-Type | Required for JSON request bodies |
Authorization | Optional bearer usage for non-browser clients after login |
Cookie | Carries the browser session when working through the web application |
Plan for 2FA and refresh behavior
The real authentication flow supports TOTP setup, TOTP verification, refresh tokens, and workspace-scoped sessions. Do not build automation that assumes a permanent token with no session lifecycle.
Was this helpful?