options argument that controls per-call timeouts and one-off headers. The same RequestOptions shape works for regular requests and for Kotlin Flow streams.
RequestOptions
RequestOptions is a data class with two optional fields:
Override timeout per call
UsetimeoutMillis to set a shorter or longer bound for a single request.
Client.kt
30_000 milliseconds. See Client configuration for setting the default.
Inject one-off headers
Useheaders to add request correlation IDs, feature flags, or override a default value once.
Client.kt
Combining options
Pass both fields together when needed:Client.kt
Header merge order
The SDK builds the final header set in this order. Each step can overwrite the previous one:- Client default headers (
headerspassed to the constructor) accept: application/json(regular requests) oraccept: text/event-stream(streams)- Per-call
options.headers - Authentication header (
Authorizationorx-api-key) fromFigraniumAuthentication
Timeout and cancellation semantics
When a request exceeds the configured timeout, the underlyingOkHttpClient throws an IOException (for example, java.net.SocketTimeoutException). FigraniumException extends IOException, so transport failures surface naturally through the same catch block.
When the consuming coroutine is cancelled, the active Call is cancelled automatically and the flow or suspend function throws a CancellationException.
Client.kt
Stream timeouts
Streams have no default timeout. Passoptions = RequestOptions(timeoutMillis = 60_000) when you want a terminal deadline. The underlying OkHttpClient cancel or timeout will surface as an IOException.
Client.kt
Client Configuration
Set client-wide defaults for timeout, headers, and auth.
Errors
Learn how FigraniumException and transport failures are surfaced.