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": {
"token": "<string>"
},
"timestamp": "<string>"
}Authenticate a user and receive an authentication 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": {
"token": "<string>"
},
"timestamp": "<string>"
}POST /api/auth/login
Bearer {token} for authenticated endpoints.curl -X POST https://api.portfoliohub.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securePassword123"
}'
{
"success": true,
"message": "Login exitoso",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
},
"timestamp": "2026-03-09T14:30:00.123Z"
}
{
"success": false,
"message": "Error de validación",
"data": {
"email": "must be a well-formed email address",
"password": "must not be blank"
},
"timestamp": "2026-03-09T14:30:00.123Z"
}
{
"success": false,
"message": "Credenciales inválidas",
"data": null,
"timestamp": "2026-03-09T14:30:00.123Z"
}
| Status Code | Description |
|---|---|
| 200 | User successfully authenticated and token generated |
| 400 | Invalid request body or validation errors |
| 401 | Invalid email or password |
| 500 | Internal server error |
Authorization header of subsequent requests:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...