Authentication

Use the public authentication routes to start a client session. All request bodies are JSON.

01

Log in

POST /apis/v1/auth/login

{
  "user": {
    "username": "person@example.com",
    "password": "your-password"
  }
}
Response fieldDescription
access_tokenSend it in the Authorization header for protected routes.
refresh_tokenUse it to refresh the session.
token_typeBearer.
expires_inLifetime of the access token.
requires_2faWhether the account still has a TOTP step to complete.

If requires_2fa is true, complete the account’s TOTP step before you treat the client as fully authenticated. For the user’s side of two-factor sign-in, see Settings: security.

02

Refresh a session

POST /apis/v1/auth/refresh

  • Send refresh_token either at the top level or under user.refresh_token.
  • Ration rotates the refresh token and returns a new bearer access token.
  • An invalid or expired refresh token returns 401 with invalid_refresh_token.

03

Sign out

POST /apis/v1/auth/logout or DELETE /apis/v1/auth/logout

  • This is a protected route. Send the bearer token.
  • An optional user.username names the account. Without it, the authenticated user is signed out.

04

Password recovery

OperationRouteRequest
Start recoveryPOST /apis/v1/auth/reset-password{"user":{"login":"person@example.com"}} (an email or username can be used)
Finish recoveryPOST /apis/v1/auth/update-passwordemail, temp_user_key and password

Starting recovery is rate limited. The finish route checks the temporary reset key and returns 401 when it is invalid, expired or belongs to a different email.

05

Two-factor management

These routes are protected and act on the authenticated user. Paths are relative to /apis/v1.

MethodRoutePurpose
POST/auth/initiate-2faStart TOTP setup.
POST/auth/enable-2faEnable the newly configured factor.
POST/auth/verify-2faVerify a TOTP code.
POST/auth/disable-2faDisable TOTP after the required verification.

Never log or store a TOTP setup secret, QR payload, token, access token or refresh token. For profile settings, signatures, app-specific passwords and the full TOTP contract, see the Settings API.

Next guideEndpoint catalog →

Last reviewed 27 November 2026.

Still stuck?

Chat with our support team. Tell us what you were doing and what you saw, and a person will pick it up. You can also email support@ration.works.

Buying or moving to Ration?

For plans, migration or an on-premise deployment, talk to our sales team.