Skip to main content
Workflow approvals let you pause a workflow at a specific step and wait for a human to approve it before continuing. This is useful for deployment gates, compliance reviews, content approval, and any process that requires human judgment.

How Approvals Work

  1. Step Configuration: A workflow step is configured with type: "approval" and a list of authorized approvers.
  2. Approval Request: When the workflow engine reaches that step, it creates a WorkflowStepApproval record and pauses the step in waiting_for_approval status.
  3. Timeout: If approval_timeout_secs is configured, the approval automatically expires if no action is taken within the window.
  4. Human Action: An authorized approver calls the approve API endpoint.
  5. Resumption: Once approved, the step completes and the workflow engine triggers downstream dependent steps.

Defining an Approval Step

When creating a workflow, add a step with type: "approval":

Approval Step Fields

Approval steps require at least one approver in the approval_approvers list. The API rejects workflow creation if this field is empty.

Approving a Step

When a workflow reaches an approval step, call the approve endpoint:

Request Body

The approver field is required and must identify the person or system approving the step.

Response

Approval Data Model

The WorkflowStepApproval record tracks the full approval lifecycle:

Approval Timeouts

If approval_timeout_secs is set, the approval automatically expires after the specified duration:
Set approval_timeout_secs to 0 or omit it for no timeout. The step will wait indefinitely until someone approves it.
When an approval times out:
  • The approval status is set to rejected with a timeout error message
  • The step run transitions to failed
  • The workflow follows its normal failure handling (which may include step retry logic)

Multiple Approval Gates

You can have multiple approval steps in a single workflow:

Monitoring Approvals

Check Pending Approvals

List workflow runs with steps waiting for approval:

Webhook Notifications

When a step enters the waiting_for_approval state, a workflow run webhook event is published. Configure your notification system (Slack, email, PagerDuty) to listen for these events and alert the appropriate approvers.
Approval steps do not require a job_id since they don’t execute any job. They exist purely as workflow control flow gates.

Event Trigger Integration

Approval steps automatically create a parallel Event Trigger when the workflow engine starts them. This means approvals can be resolved via either:
  1. The approve API endpoint (legacy): POST /v1/workflow-runs/{id}/steps/{ref}/approve
  2. The event trigger API: POST /v1/events/{eventKey}/send with the approval’s event key
The event trigger provides additional capabilities:
  • Real-time SSE streaming of approval status
  • Webhook notifications when the approval is resolved
  • Integration with external approval systems via the standard event API
Event trigger creation for approval steps is non-fatal. If the trigger creation fails (e.g., duplicate event key), the approval step still works normally via the legacy approve endpoint.

Best Practices

  1. Use descriptive step refs: Name approval steps clearly (e.g., security-review, prod-deploy-gate) so approvers understand what they are approving
  2. Set reasonable timeouts: Avoid indefinite waits in production workflows. Set timeouts and handle the failure case
  3. Limit approver lists: Keep the approver list small and specific. Anyone in the list can approve
  4. Combine with conditions: Use step conditions to skip approval gates in low-risk scenarios (e.g., skip prod approval for hotfixes)
  5. Monitor pending approvals: Set up alerts for approvals that have been pending beyond a reasonable threshold
  6. Consider event triggers for complex approvals: For multi-party or external system approvals, use wait_for_event steps instead of approval steps for more flexibility