Skip to main content
These examples use generated Komga API 1.25 operations. Values such as libraryId and deep are flat parameters, followed by { client }. Generated results are non-throwing by default.
Most operations in this guide require ADMIN role.

Library CRUD operations

List all libraries

getLibraries accepts { client } as its options argument because it has no parameter object:

Get a library by ID

Update a library

updateLibraryById returns void data on success:

Delete a library

This removes the library configuration but does not delete underlying files. The successful response has no data:

Library maintenance operations

Scan library

deep is an optional flat query parameter:
Library scans run as background tasks. The accepted response has no useful data payload; monitor Komga tasks separately.
Do not assume that the scan has finished when the request resolves. If you need a strict sequence (scan → analyze → refresh), observe the server’s task state between calls; otherwise, these operations may overlap.

Analyze library

Refresh metadata

Empty trash

Book maintenance

Analyze a book

Refresh book metadata

Delete a book file

This permanently deletes the book file from disk and cannot be undone.

Delete series files

This permanently deletes all book files in the series from disk and cannot be undone.

Update book metadata

Batch update book metadata

updateBookMetadataByBatch takes a flat body map keyed by book ID. It does not accept an ids plus metadata object:

Metadata reset and batch semantics

Book and series metadata updates are partial: omitted fields remain unchanged. The API update contract permits null to unset a scalar metadata field, while an empty array such as tags: [] clears a collection. Lock flags are independent and must be updated explicitly. Both single-item metadata updates and updateBookMetadataByBatch return 204 No Content; re-fetch items if the caller needs the resulting DTO. The batch endpoint’s flat body is a map from book ID to its own BookMetadataUpdateDto. It is not an { ids, metadata } envelope; each map value may contain a different partial update.

Common workflows

Full library refresh

The maintenance operations return accepted responses, so check error after each request:
libraryAnalyze, libraryRefreshMetadata, and thumbnail regeneration are also queued administrative tasks. A maintenance runner should record which requests were accepted and let Komga’s task system report completion rather than treating a successful HTTP response as completed work.

Batch operations on a library

Use the SearchConditionLibraryId condition inside bookSearch to list only books from one library:

Library statistics

Maintenance scheduler

Error handling

Next steps

Libraries

Learn about library creation and configuration.

Admin

Server administration and settings.

Book Content

Access book pages and thumbnails.

Series Discovery

Browse and discover series.