Skip to main content
If you’re running multi-step data operations manually—creating datasets, refreshing views, then building derived tables—workflows let you define the entire pipeline once and execute it automatically. Tasks run in sequence, each waiting for the previous one to finish before starting.
For a deeper understanding of how workflows relate to the jobs system, see Workflow Orchestration. For complete API details, see the Workflows API Reference.

Prerequisites

What you’ll learn

  • How to view and manage workflows in the UI
  • How to define a workflow specification in YAML
  • How to create and trigger workflows via the API
  • How to chain multiple tasks with dependencies
  • How to pass data between tasks using export and variable expressions
  • How to schedule workflows for automatic execution
  • How to monitor workflow runs and troubleshoot failures

Managing workflows in the UI

You can view and manage your workflows from Workflows, under Objects in the navigation rail. The workflows page displays all your workflows in a table with the following information:
  • Name — the workflow’s name (links to the detail page)
  • Status — whether the workflow is Active or Archived
  • Data Plane — which data plane the workflow runs on
  • Created — when the workflow was created
The workflows list is scoped to the data plane currently selected in the context selector. Switch data planes from the context selector to see workflows that run on a different data plane. Status filter chip counts reflect only the workflows visible for the selected data plane.

Workflow actions

From the workflows table or the detail page, you can perform these actions on each workflow:
  • Trigger — manually start a new run of an active workflow
  • Archive — deactivate a workflow so it no longer runs on its schedule
  • Copy ID — copy the workflow ID to your clipboard

Viewing workflow details

Click any workflow name to open its detail page, which has two tabs:
  • Definition — displays the full YAML specification with syntax highlighting
  • Runs — shows the run history with status, start time, and duration for each execution
Workflow creation and editing are currently available through the API only. Use the UI to monitor, trigger, and archive workflows you’ve created via the API.

Defining a workflow

Workflows use the Serverless Workflow DSL in YAML format. A workflow is a list of tasks that execute sequentially in the order you define them.

Minimal example

Here’s the simplest possible workflow—a single task that creates a materialized view:
Every workflow has two sections: Each task has a unique name (the key), a call specifying which task to run, and with providing the task’s parameters.

Supported tasks

Workflows support these operations:
To run a single NQL statement without authoring a workflow specification, use POST /v1/nql/execute — it wraps the statement in a one-task workflow for you. Within a hand-authored specification, use CreateMaterializedViewIfNotExists to execute a SELECT query and persist its results.

Creating and running a workflow

Step 1: Create the workflow

Send the YAML specification as a string in a JSON body, with the ID of the data plane the workflow runs on. This example uses jq to read the YAML file into the request:
The workflow’s data plane is set here and applies to every run. The response’s id is the workflow ID that you’ll use for all subsequent operations. Add "trigger_immediately": true to the body to start the first run as well. The response then also carries its run_id. See Create a workflow for every field.

Step 2: Trigger a run

Start a run of the workflow. The request has no body, because the run uses the data plane the workflow was created with:
Each trigger creates a new run and returns its run_id right away. The run is pending until it starts executing. The workflow’s tasks execute sequentially—each task waits for the previous one to complete before starting.

Step 3: Check the status

Monitor the run to see how it’s progressing. Fetch the run you triggered by its run_id:
The response is the run on its own, with the same fields as its entry in the list of runs. A run_id that doesn’t belong to the workflow returns 404. To see every run of the workflow, including scheduled ones, list them instead:
Both endpoints need read access to workflows and a token issued to a user.
Each task in a workflow creates its own job in the underlying jobs system. Jobs created by workflows are automatically tagged with workflow_enqueued, making them easy to filter when checking job history. On the Jobs page, select Workflow Enqueued in the Status filter or paste a workflow_id or workflow_run_id into the search bar to scope the table to a single workflow or run. The Jobs API accepts the same workflow_id and workflow_run_id query parameters — see Filtering by workflow.

Chaining dependent tasks

The real power of workflows is chaining operations that depend on each other. Tasks run in order, so later tasks can reference datasets created by earlier ones.

Example: Create a source dataset, then derive from it

The second task references company_data.active_users_source—the dataset created by the first task. The workflow ensures the first task completes before the second one starts.
When referencing datasets created by earlier tasks, use the fully qualified path: company_data.dataset_name.

Example: Refresh multiple views in sequence

This ensures raw_events is refreshed before event_aggregates, which may depend on it.

Passing data between tasks

Beyond referencing datasets by name, workflows can pass structured data between tasks using export and variable expressions. This is useful when a downstream task needs metadata from an upstream task — like a dataset ID, row count, or status value.
For the complete syntax reference, see Task output, Export, and Variable expressions in the specification reference.

Exporting task output to workflow context

Every task produces a JSON output object after execution. Use export.as with a jq expression to capture values into the workflow context ($context):
After this task runs, $context.datasetId contains the ID of the created dataset.

Using variable expressions in parameters

Use ${…} in parameter values to inject data from the previous task’s output (.) or the workflow context ($context). Use jq string interpolation \(expr) to embed values inside strings:
A pure ${…} expression (as the entire parameter value) preserves the JSON type. When used inside a string or with ${"..."}, the result is always a string.

Complete example

This workflow creates a materialized view, captures its dataset ID in the workflow context, then logs the operation using both direct output access and context:
Here’s what happens at each step:
  1. createView creates the materialized view. Its output includes datasetId. The export.as expression merges this into $context as datasetId.
  2. logCreatedDataset uses .datasetId — the direct output of the previous task — in a variable expression to insert a log record.
  3. logFromContext uses $context.datasetId to access the same value via the accumulated workflow context. This is useful when the value was exported several tasks ago and is no longer in the immediately preceding output.

Scheduling workflows

Instead of triggering runs manually, you can set workflows to run on a schedule using cron expressions. Add a schedule block to your workflow specification:

Common schedules

Run your workflow manually at least once before adding a schedule. This lets you verify it works correctly without waiting for the next scheduled run.

Handling errors

Workflows use fail-fast behavior: if any task fails, execution stops immediately and remaining tasks are skipped. The workflow run status becomes failed. To investigate a failure:
  1. Check the workflow run status via the runs endpoint
  2. Read the run’s failure_reason. Its task_name names the task that failed (null when the run failed outside a task), and its message is the error that stopped the run
  3. Query the individual job using its job_id for detailed error information
failure_reason is also set on a canceled run, and is null on a run that neither failed nor was canceled. A few runs report no failure_reason even when they failed; for those, fall back to the task’s job.

Common errors


Best practices

  • Name workflows clearly. Use descriptive names that explain what the workflow does (e.g., daily-audience-refresh rather than workflow-1).
  • Version your workflows. Increment the version when you change the specification to maintain a clear history.
  • Start with a single task. Build and test one task at a time before assembling multi-step pipelines.
  • Test before scheduling. Run workflows manually to confirm they work before setting up automatic execution.

Limitations

  • Sequential only — tasks execute one at a time in order; parallel execution is not supported
  • No conditional logic — all tasks run unconditionally; there is no if/else branching
  • No loops — iterative operations are not supported
  • No automatic retries — failed tasks are not retried automatically

Workflow Orchestration

How workflows work and why they’re designed this way

Task Reference

Complete reference for all supported workflow tasks and parameters

Workflows API Reference

Complete API documentation for workflow endpoints

Creating Materialized Views

How to create and manage materialized views used in workflow tasks