Endpoints for generating and invalidating tokens.
POST /api2/tokens anyoneDELETE /api2/tokens viewerPOST /api2/tokens
{
"username":"denis",
"password":"Qwerty123"
}{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NjUzNDMwODksImhvc3RuYW1lIjoiIiwibmJmIjoxNTY1MjU2Njg5LCJwYXNzd29yZCI6IlF3ZXJ0eTEyMyIsInBvcnQiOiIwIiwicm9sZSI6ImFkbWluIiwic2VjcmV0IjoiIiwidXNlcm5hbWUiOiJkZW5pcyJ9.KpPHV_j3ZZKJNDAxSJEf8rkibGcOfEpGszcay1VUMsc",
"role": "admin",
"id": 21,
"source": "local"
}DELETE /api2/tokens
Invalidates all active tokens for the authenticated user, effectively logging them out from all sessions/devices. Once invalidated, the tokens cannot be used for further API requests.
Authorization: Bearer <your-token>
{
"message": "All tokens invalidated successfully"
}Note: If the user has no tracked tokens, the response will be:
{
"message": "Logged out successfully"
}If the Authorization header is missing:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Authorization header is required"
}