POST /api/auth/login
Authenticate with email and password to receive JWT tokens for API access.
Request Body
User’s email address. Must be a valid email format.
User’s password. Minimum 8 characters.
Response
Indicates if the request was successful
User’s unique identifier (UUID)
User’s role: org_admin, branch_manager, cashier, waiter, or kitchen
Organization ID the user belongs to
Array of branch IDs the user has access to
JWT access token for authenticating API requests
JWT refresh token for obtaining new access tokens (valid for 7 days)
Error Responses
Returned when credentials are invalid or user account is inactive.{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Credenciales inválidas"
}
}
Example Request
curl -X POST https://api.restai.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securepassword123"
}'
Example Response
{
"success": true,
"data": {
"user": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "[email protected]",
"name": "John Doe",
"role": "org_admin",
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"branches": ["123e4567-e89b-12d3-a456-426614174002"]
},
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}