Skip to main content

Async Polling

When your workflow takes more than a few seconds to complete, use the async pattern: fire the trigger, then poll for status and retrieve results when done. This is the recommended approach for integrations that need to programmatically retrieve workflow results.

How It Works

1

Trigger the workflow asynchronously

Call the trigger endpoint with x-api-wait: false (or omit the header entirely). The API returns immediately with an empty body. Two response headers contain the IDs you need for polling:
  • X-Pf-Run-Id: The unique identifier for this workflow run
  • X-Pf-Automation-Id: The automation/workflow ID
Response headers:
2

Poll for status

Check the status endpoint until the workflow completes. Poll every 2-5 seconds for typical workflows.
Polling endpoints always use the webhook-style URL format (/ext/webhook/{apiKey}/...) — even if you triggered the workflow using the API endpoint with X-API-KEY header authentication.
Response:
Status values:
3

Fetch the results

Once the status is COMPLETE, retrieve the full results:
Response:

Complete Examples

Bash

JavaScript / TypeScript

Python

Designated Output

If your trigger has a designated output configured, the results response includes a top-level designatedOutput field with a direct link to the output file:
To download just the designated output:

Best Practices

  • Poll interval: Every 2-5 seconds for most workflows. For long-running workflows, poll every 10-30 seconds.
  • Set a timeout: Add a maximum polling duration to avoid infinite loops in production.
  • Handle errors: Always check for FAILED and TIMEOUT statuses in your polling loop.
  • Use step status: The stepStatus field in the status response lets you track progress of multi-step workflows while they run.