Skip to main content
POST
/
auth
/
login
Login
curl --request POST \
  --url https://api.example.com/auth/login \
  --header 'Content-Type: application/json' \
  --data '
{
  "identifier": "<string>",
  "password": "<string>"
}
'
{
  "message": "Credenciales inválidas"
}

Request

Authenticate a user using either their username or email along with their password.
identifier
string
required
The username or email of the user
password
string
required
The user’s password

Response

message
string
Success message indicating login status
token
string
JWT authentication token for subsequent requests
user
object
Information about the authenticated user

Examples

curl -X POST https://api.maytravel.com/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "identifier": "john_doe",
    "password": "mypassword123"
  }'

Success Response

{
  "message": "Login exitoso",
  "token": "JWT_GENERADO_AQUI",
  "user": {
    "user": "john_doe",
    "email": "john@example.com",
    "role": "user"
  }
}

Error Responses

{
  "message": "Credenciales inválidas"
}

Error Codes

401
error
Invalid credentials - The identifier or password is incorrect
500
error
Internal server error - An unexpected error occurred during authentication

Build docs developers (and LLMs) love