Skip to main content
SDK 1.0 is a clean cutover from the layered 0.x client. Generated Komga operations are the public API, a client is created per integration, operation parameters are flat, and requests resolve to structured results unless you explicitly call unwrap.

What changed

Do not carry over the removed service layer, Ky/Zod request wrappers, legacy error classes, or a global interceptor policy. If an integration needs retries, caching, timeout handling, or tracing, wrap fetch or the operation in that integration.

Create a client

The supported auth variants are API key and Basic Auth. headers, credentials, and a custom native fetch implementation are optional client settings. Do not copy a 0.x Bearer-auth configuration into auth: the 1.0 client does not expose a Bearer auth variant.

Flatten every operation call

In 0.x, a call commonly looked like this:
In 1.0, the generated names tell you where each value goes. getBooks has a required bookSearch body value; pagination and sorting remain flat:
Path values use their generated names, such as { id: 'collection-123' } for collection operations and { bookId: 'book-123' } for book operations. Request bodies use generated DTO parameter names such as collectionCreationDto, readProgressUpdateDto, and userUpdateDto.

Endpoint and operation mapping

Use the current generated operation rather than the old route directly: getBooksBySeriesId remains generated only for compatibility with the schema and is marked deprecated. New 1.0 code should use getBooks with a seriesId search condition so filtering and pagination use one current list operation.

Handle results and errors

Generated operations resolve to { data, error, request, response } and do not throw for an HTTP error by default. This makes it possible to inspect both the status and the server’s error body:
Use the structured result for expected failures (for example, an optional lookup). Use unwrap as the explicit throwing boundary for a request that must succeed. Successful no-content operations return data: undefined; that is not an error.

Move request policies into application code

SDK 1.0 uses native Fetch and does not configure retries, caching, validation, or timeouts. Supply a custom Fetch implementation when policy belongs at the transport boundary:
Keep policy-specific tests around this Fetch wrapper; the Testing guide shows deterministic native Response fixtures.

Migrate TypeScript imports

Generated request and response types are available from the package’s types entry point:
Prefer inference from an operation call when a type is used only once. Do not maintain a parallel 0.x request schema: generated DTO fields and operation parameter names are the source of truth.

Migration checklist

1

Create one client instance

Configure createKomgaClient with the server URL and the API key or Basic Auth credentials your application owns.
2

Replace service calls

Import generated operations directly and move path, query, and request values into their flat generated names. Pass { client } as the second argument.
3

Update endpoint-specific searches

Replace legacy book/series list routes with getBooks/getSeries; use bookSearch.condition.seriesId for books in a series.
4

Choose result handling

Check result.error for non-throwing flows, or pass the result to unwrap when the call should raise KomgaApiError.
5

Move policies and tests

Put retries, caching, timeouts, and tracing in the custom Fetch or application layer. Inject native Fetch in unit tests and use a Komga instance for integration tests.

Next steps