Skip to main content

Node SDK

@fluidgrids/sdk is the official TypeScript SDK for FluidGrids. It covers the FluidGrids workflow surface (workflows, runs, nodes, credentials, webhooks, scheduled jobs) and the shared platform modules (auth, workspaces, organisations, tags, files, billing, notifications, support and more) in one typed client. It needs Node.js 24.11 or later (or Bun 1.3.14 or later) and works as an ES module or from CommonJS.

Install​

npm install @fluidgrids/sdk
# or
bun add @fluidgrids/sdk

Quick start​

import { FluidGridsSDK } from '@fluidgrids/sdk';

const sdk = new FluidGridsSDK({
accessToken: process.env.FG_ACCESS_TOKEN,
refreshToken: process.env.FG_REFRESH_TOKEN,
});

// Workspace calls need a workspace token as well as the platform token.
await sdk.auth.issueWorkspaceToken(workspaceId, organizationId);

const page = await sdk.fluidgrids.workflows.list({ status: 'ACTIVE', limit: 20 });
console.log(page.items.map((workflow) => workflow.workflowKey));

const run = await sdk.fluidgrids.workflows.trigger({
workflowKey: 'invoice-sync',
version: '1.0.0',
triggerNodeId: 'start',
triggerData: { amount: 42 },
idempotencyKey: 'invoice-sync-2026-10-21',
});

const finished = await sdk.fluidgrids.runs.waitForCompletion(run.runId, { timeout: 600_000 });
const logs = await sdk.fluidgrids.runs.logs(run.runId, { minLevel: 'WARN' });

idempotencyKey makes a retried trigger return the original run instead of starting another one.

Signing in​

The SDK never asks for a password. Get tokens with one of the sdk.auth flows:

FlowUse it forMethods
Device codeScripts and tools a person runs: the user approves a code in their browserloginWithDeviceCode() returns { userCode, verificationUri, promise }
PKCEYour own app that signs users inbuildAuthorizationUrl(), then exchangeAuthCode(code, codeVerifier)
Client credentialsAutomation acting as an app, with no userloginWithClientCredentials(clientId, clientSecret)

Register apps and create their credentials under Developer Portal in the app. Then call issueWorkspaceToken(workspaceId, organizationId) for the workspace you act in; fetchWorkspaces() lists the ones available to you. With autoRefresh (on by default) the SDK refreshes the access token before it expires and calls onTokenRefresh with the new pair so you can store it.

Configuration​

OptionEnvironment variableDefault
workspaceEndpointFLUIDGRIDS_WORKSPACE_ENDPOINThttps://graphqlworkspaces.burdenoff.com/workspaces/graphql
globalEndpointFLUIDGRIDS_GLOBAL_ENDPOINThttps://graphql.burdenoff.com/global/graphql
productOriginFLUIDGRIDS_ORIGINhttps://app.fluidgrids.ai for production, https://alphaapp.fluidgrids.ai for alpha

For alpha, point both endpoints at the alpha gateways (https://alphagraphqlworkspaces.burdenoff.com/workspaces/graphql and https://alphagraphql.burdenoff.com/global/graphql). The workflow operations are product-scoped and the gateway works out the product from the request's Origin, which Node does not send by itself; the SDK sets it for the production and alpha gateways. Set productOrigin only if you use another gateway.

Other options: timeout (per request, in milliseconds), signal (an AbortSignal for every request), logLevel or your own logger, and tokenStore to keep tokens somewhere other than memory.

The FluidGrids module​

NamespaceOperations
fluidgrids.workflowslist, get({ id } | { workflowKey, version }), versions, create, update, delete, trigger, publish, activate, deactivate, archive, duplicate, importTemplate
fluidgrids.runslist, get, logs, cancel, pause, resume, retryNode(runId, nodeId), waitForCompletion
fluidgrids.nodeslist, get(nodeType, nodeVersion)
fluidgrids.credentialslist, get, listTypes, create, authenticateWithApiKey, authenticateWithBasicAuth, update, delete, test
fluidgrids.webhookslist, get, create, update, delete, toggle
fluidgrids.scheduledJobslist, get, create, update, delete, setEnabled
fluidgrids.dashboardsummary, usage({ startDate, endDate })
fluidgrids.searchsearch, byEntityType
fluidgrids.adminsystemInfo

List methods return { items, total, hasMore } and take limit and offset. A credential is an integration connection and is created in two steps: create (no secret material), then authenticateWithApiKey or authenticateWithBasicAuth. Every type (FluidgridsWorkflow, FluidgridsRun, FluidgridsTriggerWorkflowInput, …) is exported from @fluidgrids/sdk.

Each call is permission-checked against your roles; see Permissions and Access Control.

Errors​

Failed calls throw typed errors you can catch by class:

import {
AuthenticationError,
AuthorizationError,
FluidGridsError,
RateLimitError,
ValidationError,
} from '@fluidgrids/sdk';

try {
await sdk.fluidgrids.workflows.trigger({ workflowKey: 'invoice-sync', version: '1.0.0', triggerNodeId: 'start' });
} catch (error) {
if (error instanceof AuthenticationError) {
// sign in again
} else if (error instanceof AuthorizationError) {
// your role lacks the permission
} else if (error instanceof RateLimitError) {
// back off; a plan quota or a rate limit was hit
} else if (error instanceof ValidationError || error instanceof FluidGridsError) {
console.error(error.message);
}
}

Next steps​