Overview
Access the Workflows API:Workflows
Manage workflow definitions.Create or update a workflow
Create or modify a workflow definition.Name for the workflow
Your Cloudflare account ID
The exported Workflow class name from your Worker
The Worker script that contains the Workflow class
The workflow ID
The workflow name
The Workflow class name
The associated Worker script
ISO 8601 timestamp when the workflow was created
ISO 8601 timestamp when the workflow was last modified
List workflows
Retrieve all workflows in your account.Your Cloudflare account ID
Filter workflows by name
Page number for pagination
Number of workflows per page (default: 20, max: 100)
Instance count statistics
Number of queued instances
Number of running instances
Number of completed instances
Number of errored instances
Get a workflow
Retrieve details about a specific workflow.The workflow name
Your Cloudflare account ID
Delete a workflow
Delete a workflow definition.The workflow name to delete
Your Cloudflare account ID
Instances
Manage workflow execution instances.Create an instance
Start a new workflow instance.The workflow name
Your Cloudflare account ID
Parameters to pass to the workflow instance
The instance ID
The workflow name
Instance status: ‘queued’, ‘running’, ‘complete’, ‘errored’, or ‘terminated’
ISO 8601 timestamp when the instance was created
List instances
Retrieve all instances for a workflow.The workflow name
Your Cloudflare account ID
Filter by status: ‘queued’, ‘running’, ‘complete’, ‘errored’, ‘paused’, ‘waiting’, ‘terminated’, or ‘waitingForPause’
Page number for pagination
Number of instances per page (default: 20, max: 100)
Get an instance
Retrieve details about a specific workflow instance.The workflow name
The instance ID
Your Cloudflare account ID
The instance ID
Current instance status
The workflow output (if completed)
Error details (if errored)
Bulk instance operations
Terminate or pause multiple instances.The workflow name
Your Cloudflare account ID
Action to perform: ‘terminate’ or ‘pause’
Array of instance IDs to act on
Versions
Track workflow version history.List versions
Retrieve version history for a workflow.Get a version
Retrieve details about a specific workflow version.Defining workflows in Workers
Define a Workflow class in your Worker:Best practices
- Idempotent steps: Each step should be idempotent to handle retries
- Step naming: Use descriptive step names for easier debugging
- Error handling: Use try-catch blocks within steps for granular error handling
- State management: Store state in step results, not in memory
- Timeouts: Be aware of step execution time limits
- Monitoring: Regularly check instance status and error rates