Skip to content

Library API

Browse library roots, inspect files, and read storage summaries.

Try it with a token

Create a bearer token with the Authentication flow before running these examples.

Library roots

List library roots

http
GET /api/library/roots
Authorization: Bearer <token>
bash
curl -sS \
  -H "Authorization: Bearer $OMNILUX_TOKEN" \
  http://your-server:4000/api/library/roots

Response:

json
[
  {
    "id": 1,
    "path": "/data/movies",
    "name": "Movies",
    "mediaType": "movie",
    "fileCount": 342,
    "totalSizeBytes": 2748779069440,
    "lastScanAt": "2024-01-01T12:00:00Z"
  }
]

Library-root management exists in the server admin surface, but the public API docs focus on read operations.

Library files

List files

http
GET /api/library/files
Authorization: Bearer <token>
bash
curl -sS \
  -H "Authorization: Bearer $OMNILUX_TOKEN" \
  "http://your-server:4000/api/library/files?mediaType=movie&search=inception&limit=10"

Query parameters:

ParameterTypeDescription
mediaTypestringFilter by media type: movie, tv, music, book, audiobook, comic, game
rootIdnumberFilter by library root ID
searchstringFull-text search on title and metadata
sortstringSort field: title, addedAt, year, size
orderstringasc or desc
limitnumberMax results (default: 50)
offsetnumberPagination offset

Response:

json
{
  "items": [
    {
      "id": 1,
      "path": "/data/movies/Inception (2010)/Inception (2010).mkv",
      "title": "Inception",
      "year": 2010,
      "mediaType": "movie",
      "sizeBytes": 4294967296,
      "duration": 8880,
      "codec": "h265",
      "resolution": "2160p",
      "hdr": true,
      "container": "mkv",
      "addedAt": "2024-01-01T12:00:00Z",
      "metadata": {
        "tmdbId": 27205,
        "overview": "A thief who steals corporate secrets...",
        "genres": ["Action", "Science Fiction"],
        "posterUrl": "/artwork/movies/27205/poster.jpg",
        "rating": 8.4
      }
    }
  ],
  "total": 342,
  "limit": 50,
  "offset": 0
}

Get file detail

http
GET /api/library/files/:id
Authorization: Bearer <token>

Returns full file detail including all metadata, embedded tracks (audio, subtitle, video), and external subtitle files.

bash
curl -sS \
  -H "Authorization: Bearer $OMNILUX_TOKEN" \
  http://your-server:4000/api/library/files/1

Response:

json
{
  "id": 1,
  "path": "/data/movies/Inception (2010)/Inception (2010).mkv",
  "title": "Inception",
  "year": 2010,
  "mediaType": "movie",
  "overview": "A thief who steals corporate secrets through dream-sharing technology is given the inverse task of planting an idea.",
  "runtimeSeconds": 8880,
  "artwork": {
    "posterUrl": "/artwork/movies/27205/poster.jpg",
    "backdropUrl": "/artwork/movies/27205/backdrop.jpg"
  },
  "tracks": [
    { "index": 0, "type": "video", "codec": "hevc", "resolution": "2160p", "hdr": true },
    { "index": 1, "type": "audio", "codec": "eac3", "language": "en", "channels": "5.1" },
    { "index": 2, "type": "subtitle", "codec": "subrip", "language": "en", "forced": false }
  ],
  "subtitles": [
    { "path": "/data/movies/Inception (2010)/Inception (2010).en.srt", "language": "en" }
  ]
}

Metadata editing and scan orchestration are admin workflows and are intentionally not covered in detail here.

Storage analytics

Get stats

http
GET /api/library/stats
Authorization: Bearer <token>
bash
curl -sS \
  -H "Authorization: Bearer $OMNILUX_TOKEN" \
  http://your-server:4000/api/library/stats

Response:

json
{
  "totalFiles": 1250,
  "totalSizeBytes": 10995116277760,
  "byMediaType": {
    "movie": { "count": 342, "sizeBytes": 4398046511104 },
    "tv": { "count": 580, "sizeBytes": 5497558138880 },
    "music": { "count": 328, "sizeBytes": 1099511627776 }
  },
  "byCodec": {
    "h265": 420,
    "h264": 502
  },
  "byResolution": {
    "2160p": 120,
    "1080p": 680,
    "720p": 122
  }
}