Create a new permanent access token

POST /token/create


Description

The method creates a new permanent access token with a specified expiration time (number of days or exact date and time). A JWT token in the header is required for access.


Request format

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

Request parameters

ParameterTypeWhere passedRequiredDescription
tokenstringHeaderUser JWT token

Request body (JSON)

FieldTypeRequiredDescription
tokenstringToken identifier (e.g., UUID)
expiresstringToken expiration datetime (ISO 8601) or number of days

Example request (cURL)

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

Response examples

Success (200 OK)
{
  "message": "new token created",
  "status": "ok",
  "token": {
    "expires": "2020-04-27T23:09:06.970Z",
    "id": "1252cb60-88dc-11ea-b6b1-bc0e87309155"
  }
}
Error (400 Bad Request)
{
  "message": "invalid schema",
  "status": "error"
}
Error (401 Unauthorized)
{
  "message": "access denied",
  "status": "error"
}