Skip to main content
Variables make workflows reusable by parameterizing values that change between runs. They are defined in the workflow’s variables field and resolved when the job is submitted.
{
  variables: {
    orgId: { type: "param" },
    startDate: { type: "dateOffset", days: -30 },
  },
  steps: [
    {
      service: "shopify",
      operation: "listOrders",
      params: {
        orgId: "{{var.orgId}}",
        created_at_min: "{{var.startDate}}",
      },
      outputTable: "raw_orders",
      outputSchema: { ... },
    },
  ],
}

Variable types

param

User-provided values passed at submission time:
variables: {
  orgId: { type: "param" },
  includeArchived: { type: "param", optional: true, default: false },
}
Required param variables must be provided when the job is submitted. Optional variables use the default value when omitted.

dateOffset

A date relative to the submission time:
variables: {
  startDate: { type: "dateOffset", days: -30 },
  endDate: { type: "dateOffset", days: 0 },
}
days: -30 resolves to an ISO date string 30 days before submission. days: 0 resolves to the current date.

now

The current ISO timestamp at submission time:
variables: {
  syncTimestamp: { type: "now" },
}

Using variables

Reference variables with {{var.variableName}} syntax. In service params:
params: {
  orgId: "{{var.orgId}}",
  created_at_min: "{{var.startDate}}",
}
In SQL steps:
sql: `
  SELECT *
  FROM raw_orders
  WHERE created_at >= '{{var.startDate}}'
    AND org_id = '{{var.orgId}}'
`
Variables in SQL queries are automatically parameterized to prevent SQL injection and formatting issues.
In branch conditions:
branch: {
  condition: "{{var.includeOptionalSync}}",
}

Template syntax

SyntaxResolvedContext
{{var.X}}At submission timeWorkflow variables
{{item.X}}During forEach iterationSource table row columns
Both can be used together in the same step:
params: {
  orgId: "{{var.orgId}}",
  userId: "{{item.user_id}}",
  since: "{{var.startDate}}",
}

Submitting with variables

When submitting a job programmatically, pass variable values in the params object:
await client.submitJob({
  job: syncOrders,
  params: {
    orgId: "org_abc123",
    appId: "my-app",
  },
});
Scheduled workflows define their parameter values in schedules.json:
{
  "workflow": "./src/server/workflows/syncOrders.ts",
  "params": {
    "orgId": "org_abc123",
    "appId": "my-app"
  }
}
Variables with type: "dateOffset" and type: "now" are resolved automatically — you don’t pass values for them at submission time.

Validation

Check
{{var.*}} references resolve to defined variables
{{item.*}} references exist in the forEach source table’s output schema