Skip to main content
The Figranium class takes a single options object. Every option is optional; the SDK falls back to sensible defaults so a local install works with new Figranium({ apiKey }).

Constructor options

string
Absolute URL of your Figranium server. Must use http or https. Trailing slashes are trimmed. Defaults to http://localhost:11345.
string
API key sent as Authorization: Bearer <key> by default. Mutually exclusive with session.
string
Header name for the API key. Either "authorization" (default) or "x-api-key".
boolean
Set to true to send credentials (fetch(..., { credentials: "include" })) so cookies are attached to every request. Required for settings.* endpoints. Mutually exclusive with apiKey.
number
Client-wide default timeout for non-stream requests, in milliseconds. Defaults to 30_000 (30 seconds). Streams have no default timeout.
function
Any fetch-compatible implementation. Useful for tracing, retries, cookie jars, test doubles, or proxying through instrumented HTTP clients.
HeadersInit
Default headers merged into every request. Per-call headers override these.

Option details

baseUrl

apiKey and apiKeyHeader

Pass apiKey to authenticate every request with an API key. By default the key is sent as Authorization: Bearer <key>. Set apiKeyHeader: "x-api-key" if your deployment expects that header.
apiKey and session are mutually exclusive. See Authentication.

session

Set session: true to send credentials (fetch(..., { credentials: "include" })) so cookies are attached to every request. Required for settings.* endpoints, which are session-only.
Node’s built-in fetch does not keep a cookie jar. For Node-based administration, provide a cookie-aware fetch implementation through the fetch option.

timeoutMs

Client-wide default timeout for non-stream requests, in milliseconds. Defaults to 30_000 (30 seconds). Streams have no default timeout; set a per-call timeoutMs if you want a terminal deadline.
Individual requests can override this per call with { timeoutMs }. See Request options.

fetch

Provide any fetch-compatible implementation. Useful for tracing, retries, cookie jars, test doubles, or proxying through instrumented HTTP clients.

headers

Default headers merged into every request. Per-call headers override these.

Complete example

Client resources

The Figranium instance exposes one property per resource, plus a few top-level convenience helpers. Top-level shortcuts:
  • figranium.runTask(id, input?) proxies to tasks.run.
  • figranium.scrape(input) proxies to execution.scrape.
  • figranium.agent(input) proxies to execution.agent.
  • figranium.headful(input) proxies to execution.headful.