Base URL
Authentication Flow
- Login: Authenticate with email and password to receive access and refresh tokens
- Access: Use the access token (stored in cookies) to access protected endpoints
- Refresh: When the access token expires, use the refresh token to obtain a new one
- Logout: Clear all authentication cookies to end the session
Token Management
Tokens are automatically managed through HTTP-only cookies:access_token: Short-lived token for API accessrefresh_token: Long-lived token for refreshing access tokens
httpOnly: falsesecure: true(HTTPS only in production)sameSite: none(allows cross-site requests)
Role-Based Access Control
The API supports two employee roles:- Administrador: Full access to all endpoints including employee management
- Asistente de Gerencia: Limited access (role-specific permissions)
Available Endpoints
Register Employee
Create a new employee account
Login
Authenticate and receive tokens
Logout
End the current session
Refresh Token
Obtain a new access token
Get Current User
Get role of authenticated user
Manage Employees
List, update, or delete employees
Error Handling
All endpoints follow a consistent error response format:200: Success201: Resource created successfully400: Bad request or validation error401: Unauthorized (invalid token or insufficient permissions)500: Internal server error