workflow CLI command

Detailed information on the workflow CLI command

Manage Dapr workflow instances.

Commands

CommandDescription
dapr workflow runStart a new workflow instance
dapr workflow listList workflow instances
dapr workflow historyGet workflow execution history
dapr workflow purgePurge workflow instances
dapr workflow suspendSuspend a workflow
dapr workflow resumeResume a workflow
dapr workflow terminateTerminate a workflow
dapr workflow raise-eventRaise an external event
dapr workflow rerunRe-run a workflow

Flags

  -a, --app-id string      The app ID owner of the workflow instance
  -h, --help               help for workflow
  -k, --kubernetes         Target a Kubernetes dapr installation
  -n, --namespace string   Namespace to perform workflow operation on (default "default")

Examples

List workflows

dapr workflow list --app-id myapp

Start a workflow

dapr workflow run MyWorkflow --app-id myapp --input '{"key": "value"}'

Kubernetes mode

dapr workflow list -k -n production --app-id myapp

List workflow instances for a given application.

Usage

dapr workflow list [flags]

Flags

NameTypeDescription
--app-id, -astring(Required) The app ID owner of the workflow instances
--filter-name, -wstringFilter workflows by name
--filter-status, -sstringFilter by status: RUNNING, COMPLETED, FAILED, CANCELED, TERMINATED, PENDING, SUSPENDED
--filter-max-age, -mstringFilter workflows started within duration or timestamp (e.g., “300ms”, “1.5h”, “2023-01-02T15:04:05”)
--output, -ostringOutput format: short, wide, yaml, json (default “short”)
--kubernetes, -kboolTarget a Kubernetes Dapr installation
--namespace, -nstringKubernetes namespace (default “default”)

Examples

Basic usage

dapr workflow list --app-id myapp

Filter by status

dapr workflow list --app-id myapp --filter-status RUNNING

Filter by workflow name

dapr workflow list --app-id myapp --filter-name OrderProcessing

Filter by age

# Workflows from last 24 hours
dapr workflow list --app-id myapp --filter-max-age 24h

# Workflows after specific date
dapr workflow list --app-id myapp --filter-max-age 2024-01-01T00:00:00Z

JSON output

dapr workflow list --app-id myapp --output json

Purge workflow instances with terminal states (COMPLETED, FAILED, TERMINATED).

Usage

dapr workflow purge [instance-id] [flags]

Flags

NameTypeDescription
--app-id, -astring(Required) The app ID owner of the workflow instances
--allboolPurge all terminal workflow instances (use with caution)
--all-older-thanstringPurge instances older than duration or timestamp (e.g., “24h”, “2023-01-02T15:04:05Z”)
--kubernetes, -kboolTarget a Kubernetes Dapr installation
--namespace, -nstringKubernetes namespace (default “default”)

Examples

Purge a specific instance

dapr workflow purge wf-12345 --app-id myapp

Purge instances older than 30 days

dapr workflow purge --app-id myapp --all-older-than 720h

Purge instances older than specific date

dapr workflow purge --app-id myapp --all-older-than 2023-12-01T00:00:00Z

Purge all terminal instances (dangerous!)

dapr workflow purge --app-id myapp --all

Purge force (no workflow runtime, dangerous!)

dapr workflow purge wf-12345 --app-id myapp --force