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 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:
Per-operation options
The second argument to a generated operation can override client behavior for one call:Generated client access
For advanced integrations, the package also re-exports the generatedcreateClient 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
- Call operations with flat parameters: Direct API functions
- Observe the generated Fetch lifecycle: Request customization
- Handle
{ data, error, request, response }: Result handling