Skip to content

Users API

User management, profile, and preferences.

List users

http
GET /api/auth/users
Authorization: Bearer <admin-token>

Response:

json
[
  {
    "id": 1,
    "username": "admin",
    "role": "admin",
    "createdAt": "2024-01-01T00:00:00Z"
  },
  {
    "id": 2,
    "username": "family",
    "role": "user",
    "createdAt": "2024-01-15T12:00:00Z"
  }
]

Create user

http
POST /api/auth/register
Authorization: Bearer <admin-token>
Content-Type: application/json

{
  "username": "newuser",
  "password": "secure-password",
  "role": "user"
}

Response:

json
{
  "id": 3,
  "username": "newuser",
  "role": "user",
  "createdAt": "2024-01-20T10:00:00Z"
}

Update user

http
PUT /api/auth/users/:id
Authorization: Bearer <admin-token>
Content-Type: application/json

{
  "role": "admin",
  "password": "new-password"
}

Only admins can change roles. Users can change their own password via the profile endpoint.

Delete user

http
DELETE /api/auth/users/:id
Authorization: Bearer <admin-token>

Deletes the user and their sessions. Watch history and preferences are also removed.

Current user profile

Get profile

http
GET /api/auth/me
Authorization: Bearer <token>

Response:

json
{
  "id": 1,
  "username": "admin",
  "role": "admin",
  "preferences": {
    "defaultQuality": "original",
    "defaultSubtitleLanguage": "en",
    "defaultAudioLanguage": "en",
    "theme": "dark"
  },
  "createdAt": "2024-01-01T00:00:00Z"
}

Update preferences

http
PUT /api/auth/me/preferences
Authorization: Bearer <token>
Content-Type: application/json

{
  "defaultQuality": "1080p",
  "defaultSubtitleLanguage": "es",
  "theme": "dark"
}

Response:

json
{
  "saved": true
}

Use OmniLux, run your own server, or build on the platform.