Class: WorkflowsResource#

Defined in: sdk-js/src/v4/resources/workflows.ts:41

client.workflows.* — the primary surface for creating and controlling automations. A "workflow" is one trigger + a DAG of nodes that fires when the trigger condition matches. This resource covers the full lifecycle: create, list, retrieve, pause / resume, cancel, manual trigger, dry-run simulation, and fee estimation.

Executions produced by these workflows are read via ExecutionsResource.

Constructors#

Constructor#

new WorkflowsResource(transport: Transport): WorkflowsResource;

Defined in: sdk-js/src/v4/resources/workflows.ts:42

Parameters#

ParameterType
transportTransport

Returns#

WorkflowsResource

Methods#

create()#

create(req: object): Promise<{
  id: string;
  name?: string;
  owner: string;
  smartWalletAddress: string;
  chainId?: number;
  trigger: object & 
     | object & object
     | object & object
     | object & object
     | object & object
    | object & object;
  nodes: readonly object & 
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
    | object & object[];
  edges?: readonly object[];
  inputVariables?: {
   [key: string]: unknown;
  };
  status: "failed" | "completed" | "running" | "disabled" | "enabled";
  startAt?: number;
  expiredAt?: number;
  maxExecution?: number;
  executionCount?: number;
  createdAt?: number;
  completedAt?: number;
}>;

Defined in: sdk-js/src/v4/resources/workflows.ts:45

POST /workflows

Parameters#

ParameterTypeDescription
req{ name?: string; smartWalletAddress: string; chainId?: number; trigger: object & | object & object | object & object | object & object | object & object | object & object; nodes: readonly object & | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object[]; edges?: readonly object[]; inputVariables?: { [key: string]: unknown; }; startAt?: number; expiredAt?: number; maxExecution?: number; }-
req.name?string-
req.smartWalletAddressstring-
req.chainId?numberDescription Default chain. Triggers and nodes may override.
req.triggerobject & | object & object | object & object | object & object | object & object | object & object-
req.nodesreadonly object & | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object[]-
req.edges?readonly object[]-
req.inputVariables?{ [key: string]: unknown; }-
req.startAt?numberFormat: int64
req.expiredAt?numberFormat: int64
req.maxExecution?numberFormat: int64

Returns#

Promise<{ id: string; name?: string; owner: string; smartWalletAddress: string; chainId?: number; trigger: object & | object & object | object & object | object & object | object & object | object & object; nodes: readonly object & | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object[]; edges?: readonly object[]; inputVariables?: { [key: string]: unknown; }; status: "failed" | "completed" | "running" | "disabled" | "enabled"; startAt?: number; expiredAt?: number; maxExecution?: number; executionCount?: number; createdAt?: number; completedAt?: number; }>


list()#

list(params?: ListWorkflowsParams): Promise<{
  data: readonly object[];
  pageInfo: {
     hasNextPage: boolean;
     hasPreviousPage: boolean;
     startCursor?: string;
     endCursor?: string;
  };
}>;

Defined in: sdk-js/src/v4/resources/workflows.ts:54

GET /workflows

Parameters#

ParameterType
params?ListWorkflowsParams

Returns#

Promise<{ data: readonly object[]; pageInfo: { hasNextPage: boolean; hasPreviousPage: boolean; startCursor?: string; endCursor?: string; }; }>


retrieve()#

retrieve(id: string): Promise<{
  id: string;
  name?: string;
  owner: string;
  smartWalletAddress: string;
  chainId?: number;
  trigger: object & 
     | object & object
     | object & object
     | object & object
     | object & object
    | object & object;
  nodes: readonly object & 
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
    | object & object[];
  edges?: readonly object[];
  inputVariables?: {
   [key: string]: unknown;
  };
  status: "failed" | "completed" | "running" | "disabled" | "enabled";
  startAt?: number;
  expiredAt?: number;
  maxExecution?: number;
  executionCount?: number;
  createdAt?: number;
  completedAt?: number;
}>;

Defined in: sdk-js/src/v4/resources/workflows.ts:62

GET /workflows/

Parameters#

ParameterType
idstring

Returns#

Promise<{ id: string; name?: string; owner: string; smartWalletAddress: string; chainId?: number; trigger: object & | object & object | object & object | object & object | object & object | object & object; nodes: readonly object & | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object[]; edges?: readonly object[]; inputVariables?: { [key: string]: unknown; }; status: "failed" | "completed" | "running" | "disabled" | "enabled"; startAt?: number; expiredAt?: number; maxExecution?: number; executionCount?: number; createdAt?: number; completedAt?: number; }>


cancel()#

cancel(id: string): Promise<void>;

Defined in: sdk-js/src/v4/resources/workflows.ts:72

DELETE /workflows/ — cancel is the public verb in v4 (Stripe convention) even though the engine removes the record.

Parameters#

ParameterType
idstring

Returns#

Promise<void>


pause()#

pause(id: string): Promise<{
  id: string;
  name?: string;
  owner: string;
  smartWalletAddress: string;
  chainId?: number;
  trigger: object & 
     | object & object
     | object & object
     | object & object
     | object & object
    | object & object;
  nodes: readonly object & 
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
    | object & object[];
  edges?: readonly object[];
  inputVariables?: {
   [key: string]: unknown;
  };
  status: "failed" | "completed" | "running" | "disabled" | "enabled";
  startAt?: number;
  expiredAt?: number;
  maxExecution?: number;
  executionCount?: number;
  createdAt?: number;
  completedAt?: number;
}>;

Defined in: sdk-js/src/v4/resources/workflows.ts:80

POST /workflows/:pause

Parameters#

ParameterType
idstring

Returns#

Promise<{ id: string; name?: string; owner: string; smartWalletAddress: string; chainId?: number; trigger: object & | object & object | object & object | object & object | object & object | object & object; nodes: readonly object & | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object[]; edges?: readonly object[]; inputVariables?: { [key: string]: unknown; }; status: "failed" | "completed" | "running" | "disabled" | "enabled"; startAt?: number; expiredAt?: number; maxExecution?: number; executionCount?: number; createdAt?: number; completedAt?: number; }>


resume()#

resume(id: string): Promise<{
  id: string;
  name?: string;
  owner: string;
  smartWalletAddress: string;
  chainId?: number;
  trigger: object & 
     | object & object
     | object & object
     | object & object
     | object & object
    | object & object;
  nodes: readonly object & 
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
     | object & object
    | object & object[];
  edges?: readonly object[];
  inputVariables?: {
   [key: string]: unknown;
  };
  status: "failed" | "completed" | "running" | "disabled" | "enabled";
  startAt?: number;
  expiredAt?: number;
  maxExecution?: number;
  executionCount?: number;
  createdAt?: number;
  completedAt?: number;
}>;

Defined in: sdk-js/src/v4/resources/workflows.ts:88

POST /workflows/:resume

Parameters#

ParameterType
idstring

Returns#

Promise<{ id: string; name?: string; owner: string; smartWalletAddress: string; chainId?: number; trigger: object & | object & object | object & object | object & object | object & object | object & object; nodes: readonly object & | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object[]; edges?: readonly object[]; inputVariables?: { [key: string]: unknown; }; status: "failed" | "completed" | "running" | "disabled" | "enabled"; startAt?: number; expiredAt?: number; maxExecution?: number; executionCount?: number; createdAt?: number; completedAt?: number; }>


trigger()#

trigger(id: string, req: object): Promise<{
  executionId: string;
  status: "error" | "failed" | "pending" | "success";
  startAt?: number;
  endAt?: number;
  error?: string;
}>;

Defined in: sdk-js/src/v4/resources/workflows.ts:96

POST /workflows/:trigger

Parameters#

ParameterTypeDescription
idstring-
req{ triggerType: "block" | "manual" | "event" | "fixedTime" | "cron"; triggerOutput?: { [key: string]: unknown; }; triggerInput?: { [key: string]: unknown; }; isBlocking?: boolean; }-
req.triggerType"block" | "manual" | "event" | "fixedTime" | "cron"-
req.triggerOutput?{ [key: string]: unknown; }Description Type-specific output payload (BlockTrigger.Output, EventTrigger.Output, etc.) that simulates what the operator would have observed. Defined alongside execution schemas.
req.triggerInput?{ [key: string]: unknown; }-
req.isBlocking?booleanDescription When true, wait for the execution to complete and return its result.

Returns#

Promise<{ executionId: string; status: "error" | "failed" | "pending" | "success"; startAt?: number; endAt?: number; error?: string; }>


simulate()#

simulate(req: object): Promise<{
  id: string;
  workflowId: string;
  chainId?: number;
  index?: number;
  startAt: number;
  endAt?: number;
  status: "error" | "failed" | "pending" | "success";
  error?: string;
  steps?: readonly object[];
  executionFee?: {
     amount: string;
     unit: "USD" | "WEI" | "PERCENTAGE";
  };
  cogs?: readonly object[];
  valueFee?: {
     fee: {
        amount: string;
        unit: "USD" | "WEI" | "PERCENTAGE";
     };
     tier: "unspecified" | "tier1" | "tier2" | "tier3";
     valueBase?: string;
     classificationMethod?: "ruleBased" | "llm";
     confidence?: number;
     reason?: string;
  };
}>;

Defined in: sdk-js/src/v4/resources/workflows.ts:105

POST /workflows:simulate — runs without persisting.

Parameters#

ParameterType
req{ chainId?: number; trigger: object & | object & object | object & object | object & object | object & object | object & object; nodes: readonly object & | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object[]; edges?: readonly object[]; inputVariables: { [key: string]: unknown; }; }
req.chainId?number
req.triggerobject & | object & object | object & object | object & object | object & object | object & object
req.nodesreadonly object & | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object[]
req.edges?readonly object[]
req.inputVariables{ [key: string]: unknown; }

Returns#

Promise<{ id: string; workflowId: string; chainId?: number; index?: number; startAt: number; endAt?: number; status: "error" | "failed" | "pending" | "success"; error?: string; steps?: readonly object[]; executionFee?: { amount: string; unit: "USD" | "WEI" | "PERCENTAGE"; }; cogs?: readonly object[]; valueFee?: { fee: { amount: string; unit: "USD" | "WEI" | "PERCENTAGE"; }; tier: "unspecified" | "tier1" | "tier2" | "tier3"; valueBase?: string; classificationMethod?: "ruleBased" | "llm"; confidence?: number; reason?: string; }; }>


estimateFees()#

estimateFees(req: object): Promise<{
  chainId: number;
  nativeToken?: {
     symbol: string;
     decimals: number;
  };
  executionFee: {
     amount: string;
     unit: "USD" | "WEI" | "PERCENTAGE";
  };
  cogs: readonly object[];
  valueFee: {
     fee: {
        amount: string;
        unit: "USD" | "WEI" | "PERCENTAGE";
     };
     tier: "unspecified" | "tier1" | "tier2" | "tier3";
     valueBase?: string;
     classificationMethod?: "ruleBased" | "llm";
     confidence?: number;
     reason?: string;
  };
  discounts?: readonly object[];
  pricingModel?: string;
}>;

Defined in: sdk-js/src/v4/resources/workflows.ts:114

POST /workflows:estimateFees

Parameters#

ParameterTypeDescription
req{ chainId?: number; trigger: object & | object & object | object & object | object & object | object & object | object & object; nodes: readonly object & | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object[]; edges?: readonly object[]; runner?: string; createdAt: number; expireAt: number; maxExecution: number; inputVariables?: { [key: string]: unknown; }; }-
req.chainId?number-
req.triggerobject & | object & object | object & object | object & object | object & object | object & object-
req.nodesreadonly object & | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object | object & object[]-
req.edges?readonly object[]-
req.runner?stringDescription Smart wallet address used for gas estimation (overrides settings.runner).
req.createdAtnumberFormat: int64
req.expireAtnumberFormat: int64
req.maxExecutionnumberFormat: int64
req.inputVariables?{ [key: string]: unknown; }-

Returns#

Promise<{ chainId: number; nativeToken?: { symbol: string; decimals: number; }; executionFee: { amount: string; unit: "USD" | "WEI" | "PERCENTAGE"; }; cogs: readonly object[]; valueFee: { fee: { amount: string; unit: "USD" | "WEI" | "PERCENTAGE"; }; tier: "unspecified" | "tier1" | "tier2" | "tier3"; valueBase?: string; classificationMethod?: "ruleBased" | "llm"; confidence?: number; reason?: string; }; discounts?: readonly object[]; pricingModel?: string; }>


count()#

count(params?: CountWorkflowsParams): Promise<{
  total: number;
}>;

Defined in: sdk-js/src/v4/resources/workflows.ts:123

GET /workflows:count

Parameters#

ParameterType
params?CountWorkflowsParams

Returns#

Promise<{ total: number; }>