Skip to main content

ChurnKitOptions

Options reference

apiKey required

Your FlowsBuilt API key. Get one from the Console.

env

Target API environment. Defaults to 'production'.

baseUrl

Override the API base URL entirely — takes precedence over env. Useful for self-hosted or proxy setups.

timeout

Request timeout in milliseconds. Default: 15000 (15 seconds).

maxRetries

Maximum number of attempts for retryable failures (network errors, 429, 5xx). Default: 3.
  • 1 = no retries (fail fast — use for non-idempotent writes if needed)
  • 5 = extra durability for high-stakes calls
Retries use exponential backoff with jitter.

onRequest

Called once before the first HTTP attempt. Use it to inject trace IDs, correlation IDs, or log outgoing requests.
onRequest fires once per SDK call — not on each retry. Mutations to ctx.headers apply to all retry attempts.

onResponse

Called after every HTTP response, including each retry attempt. Use it to record per-attempt latency metrics.

Full example