Skip to main content
Administrative operations require the role documented by the endpoint. The generated functions accept flat parameters and an options object containing the client. They return { data, error, request, response } by default.
Use an HTTPS base URL when sending Basic credentials. The claim endpoint is the only operation in this guide that is intended to run before authentication.

Claim the server

Check whether the initial admin account has been created:
Create the initial admin account. The generated operation sends the credentials as the X-Komga-Email and X-Komga-Password headers:
The claim endpoint can be called only once. After a successful claim, create an authenticated client with createKomgaClient before calling admin operations.

Server settings

Read settings:
Update only the fields you need. updateServerSettings takes a settingsUpdateDto flat parameter; the generated call returns a no-content response on success:
Common SettingsUpdateDto fields include:

Operational cautions

The task queue is shared by scans, metadata refreshes, imports, and thumbnail generation. emptyTaskQueue cancels pending work; it does not undo work that has already completed and it does not return a task list. Use it as a maintenance action, not as a polling mechanism. Historical events are paginated. HistoricalEventDto includes an id, timestamp, type, string-valued properties, and optional bookId and seriesId; keep requesting pages until the page is marked last when exporting an audit trail. The announcements response is a JSON feed. Its items contain id, title, optional summary/content_html, and a _komga.read flag. Mark only the IDs you have displayed; markAnnouncementsRead accepts an array in its flat body parameter and returns 204 with no payload. Directory browsing is an admin helper for choosing library roots. Send both path and showFiles in directoryRequestDto; the server can reject paths that are outside its configured filesystem or container mount. Do not treat a listing as permission to read arbitrary files.
emptyTaskQueue, settings updates, imports, duplicate-page actions, directory browsing, and thumbnail management are administrative operations. A 403 means the authenticated account lacks the endpoint’s required role; it is not a malformed SDK call.

Review known duplicate pages

Known hashes can be filtered by one or more action values (DELETE_AUTO, DELETE_MANUAL, or IGNORE) in addition to page, size, and sort. The result is paginated and each entry includes its match count, optional byte size, action, and timestamps:
Use getPageHashMatches before deleting when you need to review the affected books. deleteDuplicatePagesByPageHash removes all matches; deleteSingleMatchByPageHash removes one PageHashMatchDto returned by the matches endpoint. Both actions are destructive and should be followed by a fresh query rather than assuming the previous page is still current.
The duplicate thumbnail endpoints accept an optional resize query parameter only for unknown hashes. Image results are Blob | File; they are not JSON metadata.

Duplicate-review recipe

For a review UI, list a small page of unknown hashes, load previews sequentially (or with a bounded queue), and classify each hash before deleting:
Do not create object URLs for previews without revoking them, and do not run an unbounded parallel delete loop against a large library.

Server information and announcements

These operations take only the client in their options object:
Mark announcements as read by passing the array as the flat body parameter. Success is HTTP 204:

Tasks and historical events

Clear pending tasks with emptyTaskQueue. It returns HTTP 204 and no payload:
List historical events with flat pagination parameters:

Directory browsing

getDirectoryListing maps the directoryRequestDto parameter to the request body. The DTO requires both path and showFiles:

Duplicate page detection

List unknown hashes and inspect a thumbnail. Both operations use flat parameters; thumbnail responses are Blob | File values:
List matches for a hash and classify it:
getKnownPageHashes accepts action, page, size, and sort directly. getKnownPageHashThumbnail({ pageHash }, { client }) returns Blob | File. Deleting one match uses the generated pageHashMatchDto parameter. Pass a match returned by getPageHashMatches when you need this narrower operation:

Transient books

Scan a folder, analyze a transient book, and fetch its page representation:
Import books with the bookImportBatchDto parameter. The endpoint returns HTTP 202 with an unknown response body, so do not read result.data as an imported book list:
copyMode controls what happens to the source file: Each BookImportDto requires sourceFile and seriesId. Set destinationName to control the library filename, or upgradeBookId when the import should replace an existing book. The import is accepted asynchronously (202), so monitor the library or history rather than expecting imported books in result.data.

Client settings

Global settings are sent as a map from setting name to ClientSettingGlobalUpdateDto:

Error handling

Generated calls are non-throwing by default. Check result.error and use result.response?.status for transport status. To make the throwing boundary explicit, use unwrap; it raises a typed KomgaApiError:

Next steps

Users

Manage users and their permissions.

Libraries

Configure and scan libraries.

Authentication

Configure Basic or API-key authentication.

Troubleshooting

Diagnose authentication and request failures.