To authenticate and receive a token, make a POST request to the following endpoint:
POST /api/login
{
"user_name": "john_doe",
"password": "password"
}
{
"status": "success",
"code": 200,
"message": "Login successful",
"data": {
"user": {
"id": 2,
"user_name": "john_doe",
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"mobile": "1234567890",
"status": "1",
"created_at": "2025-06-24T04:26:31.000000Z"
},
"token": "your_jwt_token_here"
}
}
{
"status": "error",
"code": 401,
"message": "Unauthorized",
"data": null
}
{
"status": "error",
"code": 422,
"message": "Validation error",
"data": [
"The password field is required."
]
}
Unauthorized error with a 401 status code.