Skip to main content
Komga SDK 1.0 exposes the Komga API as generated operation functions. The functions map directly to the OpenAPI operations and use generated TypeScript types. The SDK no longer includes domain-service classes, handwritten DTO schemas, or service-specific error hierarchies.

The 1.0 call shape

Create a client once, then pass it in the operation options. Operation parameters are flat: endpoint inputs are properties of the first argument rather than nested transport-slot objects.
The default result contains { data, error, request, response }. It does not throw for an API error by default. Use unwrap when a call site should throw a KomgaApiError instead.
For an operation with no endpoint parameters, the options object is the only argument. For example, call getLibraries({ client }).

Operation families

The generated barrel re-exports operation functions and their generated response and error types. Common operations include: The generated types are the source of truth for each operation’s parameters and response. The API Reference links to the Komga 1.25.0 OpenAPI document used by the generated surface.

Build a domain workflow in your application

A domain workflow can compose operations without reintroducing a second SDK abstraction:
Keep application-specific caching, authorization decisions, pagination state, and UI models in the wrapper. Do not silently assume that a successful result has every optional page field populated.

Common book workflows

Read book details and pages as separate generated operations:
Metadata updates use the generated DTO property and return 204 No Content on success:
Read-progress updates follow the same result contract. Use page or completed according to the generated ReadProgressUpdateDto:

Series, library, and administrative workflows

Series metadata and library configuration mutations carry permissions documented on the generated operation. For example:
The generated comments mark operations that require ADMIN or another role. A 403 should be surfaced to the operator; do not retry unchanged credentials. Library scans are server-side work and may complete after the operation returns, so track task state through the Komga endpoints or UI rather than treating the request as a synchronous import.

Collections and read lists

These endpoints are not domain-service methods in 1.0. Call them directly with their generated query names:
Use content ?? [] and inspect error before rendering page data. See Pagination for list iteration and sorting.

Migration from service wrappers

Replace a service method with an operation import and a client option: Wrap the new call with unwrap only if throwing behavior is preferable. BookSearch currently contains fullTextSearch and an optional generated condition; pass that generated shape directly instead of the former service-layer search object.

What moved to the application

The core SDK intentionally stays close to Fetch and the generated contract:
  • Runtime response validation is optional and consumer-owned. See Runtime validation.
  • Retries, caching, pagination state, and query-library integration belong in the application layer.
  • Request and response lifecycle hooks are low-level generated-client interceptors. See Request customization.
  • HTTP failures are represented in the result or converted to KomgaApiError by unwrap. See Result handling.
Use generated operations and types directly; do not instantiate removed service classes or import runtime DTO schemas from the SDK.

Next steps

Direct API functions

Call generated operations with flat parameters.

Pagination

Handle generated page responses and list parameters.

Configuration

Configure authentication and Fetch behavior.