curl --request POST \
--url https://api.example.com/api/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>"
}
'{
"success": true,
"message": "<string>",
"data": {
"user": {
"_id": "<string>",
"name": "<string>",
"email": "<string>",
"role": "<string>",
"isActive": true,
"lastLogin": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
},
"token": "<string>"
}
}Authenticate and obtain an access token
curl --request POST \
--url https://api.example.com/api/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>"
}
'{
"success": true,
"message": "<string>",
"data": {
"user": {
"_id": "<string>",
"name": "<string>",
"email": "<string>",
"role": "<string>",
"isActive": true,
"lastLogin": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
},
"token": "<string>"
}
}{
"success": false,
"message": "Credenciales inválidas"
}
{
"success": false,
"message": "Validation failed",
"errors": [
{
"field": "email",
"message": "Email inválido"
}
]
}
{
"success": false,
"message": "Demasiados intentos de autenticación. Intenta en 15 minutos.",
"retryAfter": 900
}
curl -X POST https://api.cuido.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "SecurePass123"
}'
{
"success": true,
"message": "Inicio de sesión exitoso",
"data": {
"user": {
"_id": "507f1f77bcf86cd799439011",
"name": "Juan Pérez",
"email": "[email protected]",
"role": "user",
"isActive": true,
"lastLogin": "2026-03-05T10:35:00.000Z",
"createdAt": "2026-03-05T10:30:00.000Z",
"updatedAt": "2026-03-05T10:35:00.000Z"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1MDdmMWY3N2JjZjg2Y2Q3OTk0MzkwMTEiLCJ0aW1lc3RhbXAiOjE3MDk2MzYxMDAwMDAsImlhdCI6MTcwOTYzNjEwMCwiZXhwIjoxNzEwMjQwOTAwLCJpc3MiOiJjbGF1ZGUtcHJvbXB0LWFwaSIsInN1YiI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSJ9.xyz789abc"
}
}
lastLogin field is automatically updated on each successful login