Skip to main content
The auth API handles the complete identity lifecycle: account creation, credential-based login, JWT token management, email verification, password recovery, and OAuth sign-in via Google or GitHub. All endpoints are mounted under the /api/auth/ prefix.

POST /api/auth/register

Create a new user account. After registration, a verification email is sent to the provided address.
string
required
The user’s email address. Must be a valid email format and not already registered.
string
required
The user’s password in plain text. It is hashed before storage.
string
The user’s display name. Optional.
ResponseUserResponse:
string
required
UUID of the newly created user.
string
required
The registered email address.
string
The user’s display name, if provided.
string
Profile picture URL. null for newly registered users.
boolean
required
Whether the account is active. true by default on registration.
boolean
required
Whether the email has been verified. false until the verification link is clicked.
string
The OAuth provider used to sign in (google, github), or null for password-based accounts.
string
required
Current subscription status (e.g., free, active, cancelled).
string
required
Subscription tier (e.g., free, pro).
string
required
ISO 8601 timestamp of when the account was created.

POST /api/auth/login

Authenticate with email and password. Returns a JWT access token and refresh token.
string
required
The user’s registered email address.
string
required
The user’s password.
ResponseToken:
string
required
JWT access token. Valid for 30 minutes. Pass this in the Authorization header.
string
required
JWT refresh token. Use this to obtain a new access token after expiry.
string
required
Always "bearer".
object
The authenticated user object. See UserResponse fields above.

POST /api/auth/refresh

Exchange a valid refresh token for a new access token and refresh token pair. Both tokens are rotated on every call.
string
required
A valid, unexpired refresh token previously issued by /api/auth/login or a prior /api/auth/refresh call.
ResponseToken (same shape as login, user field is null):

POST /api/auth/logout

Log out the current user. Because JWTs are stateless, the server does not invalidate the token — the client is responsible for discarding both tokens from storage. No request body required.
Response:

GET /api/auth/me

Return the profile of the currently authenticated user. Headers:
string
required
Bearer <access_token>
ResponseUserResponse (see fields above):

POST /api/auth/verify-email

Verify a user’s email address using the token sent to them after registration.
string
required
The verification token extracted from the link in the verification email.
Response:
If the email was already verified, the response is:

POST /api/auth/resend-verification

Resend the verification email to a registered address. This endpoint always returns 200 regardless of whether the email is registered, to prevent email enumeration.
string
required
The email address to resend the verification link to.
Response:

POST /api/auth/forgot-password

Request a password reset email. Like resend-verification, this always returns 200 to prevent email enumeration.
string
required
The email address associated with the account.
Response:

POST /api/auth/verify-reset-token

Check whether a password reset token is still valid before presenting the reset form to the user.
string
required
The password reset token from the reset email link.
Response:
Returns 400 with {"detail": "Invalid or expired reset token"} if the token is invalid or expired.

POST /api/auth/reset-password

Set a new password using a valid password reset token.
string
required
The password reset token from the reset email link.
string
required
The new password to set for the account.
Response:

GET /api/auth/oauth/

Initiate an OAuth sign-in flow. Returns the authorization URL that you redirect the user to. Supported providers are google and github.
string
required
The OAuth provider to use. Must be google or github. The provider must be configured in your backend settings.
Response:
string
required
The full URL to redirect the user to in order to begin the OAuth flow.
string
required
A CSRF state token. Pass this back when handling the OAuth callback to validate the flow.
After the user authorizes the app, the provider redirects to GET /api/auth/callback/{provider}, which exchanges the code for tokens and redirects the browser to {FRONTEND_URL}/auth/callback?access_token=...&refresh_token=....
The callback endpoint is handled automatically by the backend — you do not need to call it directly. Configure your OAuth app’s redirect URI to point to {your-backend-url}/api/auth/callback/{provider}.