Update a token

POST /token/update


Description

The method allows updating the expiration time of a user’s permanent access token by its identifier. A JWT token in the header is required for access.


Request format

  • HTTP method: POST
  • URL: /token/update
  • Content-Type: application/json
  • Authorization: required

Request parameters

ParameterTypeWhere passedRequiredDescription
tokenstringHeaderUser JWT token

Request body (JSON)

FieldTypeRequiredDescription
tokenstringUser JWT token
token_idstringToken identifier (UUID)
expiresstringNew expiration time for the token (ISO 8601)

Example request (cURL)

curl -X POST "https://api.enface.ai/token/update" 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer jwt.temporary.token" 
  -d '{
    "token": "jwt.temporary.token",
    "token_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "expires": "2025-12-31T23:59:59.000Z"
  }'

Response examples

Success (200 OK)
{
  "code": 0,
  "status": "ok",
  "token": {
    "expires": "2025-12-31T23:59:59.000Z",
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}
Error (400 Bad Request)
{
  "message": "invalid schema",
  "status": "error"
}
Error (401 Unauthorized)
{
  "message": "access denied",
  "status": "error"
}