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
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:getBooks has a required bookSearch body value; pagination and sorting remain flat:
{ 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:
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:Response fixtures.
Migrate TypeScript imports
Generated request and response types are available from the package’stypes entry point:
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
- Start with Quickstart.
- Configure authentication in Authentication.
- Test injected Fetch and structured failures in Testing.