JavaScript / TypeScript
Client options
All options are optional.
| Option | Default | Description |
|---|---|---|
baseURL | https://api.umanthir.com | API address. Must use https; http is allowed only for localhost. |
apiKey | — | Sent as Authorization: Bearer <apiKey>. Never logged. See API keys. |
timeout | 30000 | Timeout of each attempt, in milliseconds. |
maxRetries | 2 | Retries after a network error, 429, 502, 503 or 520 (GET only). |
fetch | global fetch | Custom fetch implementation. |
logLevel | "warn" | "off", "error", "warn", "info" or "debug". In Node.js, UMANTHIR_LOG sets it when the option is absent. |
debug | false | Shortcut for logLevel: "debug". |
logger | console | Any object with debug, info, warn and error methods (pino, winston, ...). |
logBodies | false | Include response bodies, truncated to 2 KB, in debug logs. |
onRequest | — | Called before every attempt, with redacted headers. |
onResponse | — | Called after every attempt that got a response. |
onWarning | — | Called for every warning. See Warnings. |
Every method also accepts per-call options as its last argument: { signal, timeout, maxRetries }.
Next: Resources.