Skip to main content
createKomgaClient creates an isolated generated client backed by the platform Fetch API. The required option is baseUrl; authentication and transport settings are optional.

KomgaClientOptions

The public convenience options are: The client also accepts generated Fetch configuration fields that are not reserved by createKomgaClient, including signal. Per-operation options can additionally override parseAs, responseStyle, and throwOnError. Keep operation-specific overrides in the second argument to an operation. Standard RequestInit fields such as method, body, and generated path/query slots are controlled by each operation and should not be supplied to createKomgaClient.

Authentication

AuthConfig supports Basic and API-key authentication:
AuthConfig is limited to the Basic and API-key variants shown above. If a server-specific header is required, add it with headers or an application-owned interceptor. The SDK does not provide Bearer/JWT token configuration. Auth-owned headers take precedence over entries with the same name in headers: Basic auth sets Authorization, and API-key auth sets X-API-Key. Do not print a client’s resolved config because it may contain secrets.

Headers, credentials, and Fetch

Use custom headers for application metadata or server-specific headers:
credentials: 'include' asks browser Fetch to include cookies in cross-origin requests; Komga and the browser must also permit the exact origin through CORS. It does not create a session or log a user in. A custom Fetch wrapper is useful for tracing, proxies, or application-owned retry/cancellation behavior:
The SDK core uses native Fetch and has no default retry, cache, timeout, or runtime-validation layer. Supply a custom Fetch implementation or compose policies around operation calls when your application owns those concerns. A client instance keeps its own configuration; create separate clients when environments or policies differ.
Use HTTPS when sending Basic credentials. In production, the SDK warns when Basic auth is configured with an http: base URL; use HTTPS rather than suppressing the warning.

Per-operation options

The second argument to a generated operation can override client behavior for one call:
Generated operations still own their endpoint URL, method, path, query, and body mapping. Do not replace those slots with the removed grouped call shape.

Generated client access

For advanced integrations, the package also re-exports the generated createClient function and its GeneratedClientConfig type. createKomgaClient is the convenience entry point that applies Komga authentication and headers before creating that generated client. Most applications should use createKomgaClient so the auth precedence and per-instance configuration remain explicit.

Next steps