User authorization

POST /user/login


Description

The method is used to authorize a user by email and password. Upon successful authentication, a temporary JWT access token is returned. You can specify the token validity duration.


Request format

  • HTTP method: POST
  • URL: /user/login
  • Content-Type: application/json
  • Authorization: not required

Request parameters

ParameterTypeRequiredDescription
emailstringUser email address
passwordstringUser password
valid_daysintegerNumber of days the token will remain valid. 0 — until logout

Example request (cURL)

curl -X POST "https://api.enface.ai/user/login" 
  -H "Content-Type: application/json" 
  -d '{
    "email": "test@enface.ai",
    "password": "password",
    "valid_days": 0
  }'

Response examples

Success (200 OK)
{
  "status": "ok",
  "token": "jwt.temporary.token"
}
Error (400 Bad Request)
{
  "message": "invalid schema",
  "status": "error"
}
Error (403 Invalid user credentials)
{
  "message": "invalid user credentials",
  "status": "error"
}