Authentication API Documentation
Overview
The Authentication API provides endpoints for user authentication, password management, and token refresh functionality.Base URL
/api/v1/auth
Authentication
Most endpoints require authentication using an API key in the request headers:X-API-KEY: Your API key
Endpoints
Login
Authenticates a user and returns access and refresh tokens. Endpoint:POST /login
Request Body:
- The refresh token is returned as an HTTP-only cookie
- If
rememberMeis true, the refresh token cookie will have a longer expiration time - The cookie is secure and SameSite=None to prevent CSRF attacks
Forgot Password
Initiates the password reset process by sending an OTP to the user’s email. Endpoint:GET /forgot-password/{email}
Path Parameters:
email: User’s email address
Change Password
Changes the user’s password using the OTP received from the forgot password process. Endpoint:POST /change-password
Request Body:
Refresh Token
Refreshes the access token using the refresh token from the cookie. Endpoint:GET /refresh-token
Cookies:
refreshToken: The refresh token received during login
- A new refresh token is returned as an HTTP-only cookie
- The cookie is secure and SameSite=None to prevent CSRF attacks
Setup Password
Sets up the initial password for a user. Endpoint:POST /setup-password
Headers:
X-API-KEY: API key for authentication
Error Responses
All endpoints may return the following error responses: 401 UnauthorizedNotes
- All passwords must meet the system’s security requirements
- OTPs expire after 10 minutes
- Refresh tokens are stored as HTTP-only cookies for security
- Access tokens should be included in the Authorization header for protected endpoints
- Tenant users cannot set up passwords