SDK reference
SDK reference

createFlowmark

Create a configured client for the runtime where the work happens.

Node.js

import { createFlowmark } from "@flowmarkdev/node"
import type { FlowmarkClient, FlowmarkConfig } from "@flowmarkdev/node"

// Signature: createFlowmark(config?: FlowmarkConfig): FlowmarkClient
const flowmark = createFlowmark({
  environment: "production",
  release: "2026.10.2",
})
OptionTypeRequired
apiKeystringOption or FLOWMARK_API_KEY
apiUrlstringOption or FLOWMARK_API_URL in production
environmentstringNo
releasestringNo
onInstrumentationError(error, event) => voidNo; defaults to warning logs

The client returns workflow(), flush() and shutdown(). Reuse it across work; close it at the process boundary. Creating it validates server settings and can throw FlowmarkConfigError. Starting a workflow can also throw for invalid run context or a closed client.

See configuration for URL rules and precedence.

Next.js

import { createFlowmark } from "@flowmarkdev/node/next"

const flowmark = createFlowmark()
// Exposes workflow() only; no flush() or shutdown().

Accepts the same server options but creates a request-scoped delivery client when workflow() is called. Call it only in supported Route Handler or Server Action contexts; after() drains after the response. Invalid configuration/context can throw when starting the run. See Next.js integration.

Browser

import { createFlowmark } from "@flowmarkdev/node/browser"
import type { BrowserFlowmarkConfig } from "@flowmarkdev/node/browser"

const flowmark = createFlowmark({
  publicKey: "fm_browser_...",
  apiUrl: "https://your-flowmark-api.example",
})
OptionMeaning
publicKeyPublic browser-write key for direct ingestion
apiUrlAPI origin, required with publicKey
proxyPathSame-origin absolute route; defaults to /api/flowmark
environment, releaseDefault run metadata
onInstrumentationErrorOptional delivery/validation failure callback

Direct settings and proxyPath are mutually exclusive. Creation is SSR-safe; the first workflow() validates browser context/settings and must run in an event handler or effect. No React provider or environment-file loader is needed. See browser integration.

On this page