$.flow.suspend and $.flow.rerun to pause a workflow and resume it later.
This is useful when you want to:
- Pause a workflow until someone manually approves it
- Poll an external API until some job completes, and proceed with the workflow when it’s done
- Trigger an external API to start a job, pause the workflow, and resume it when the external API sends an HTTP callback
$.flow.suspend
Use $.flow.suspend when you want to pause a workflow and proceed with the remaining steps only when manually approved or cancelled.
For example, you can suspend a workflow and send yourself a link to manually resume or cancel the rest of the workflow:

resume_url and cancel_url
In general, calling $.flow.suspend returns a cancel_url and resume_url that lets you cancel or resume paused executions. Since Pipedream pauses your workflow at the end of the step, you can pass these URLs to any external service before the workflow pauses. If that service accepts a callback URL, it can trigger the resume_url when its work is complete.
These URLs are specific to a single execution of your workflow. While the workflow is paused, you can load these in your browser or send any HTTP request to them:
- Sending an HTTP request to the
cancel_urlwill cancel that execution - Sending an HTTP request to the
resume_urlwill resume that execution
$resume_data step export of the suspended step. For example, if you call $.flow.suspend within a step named code, the $resume_data export should contain the data sent in the resume_url request:

resume_url have the same limits as any HTTP request to Pipedream, but you can send larger payloads using our large payload or large file interfaces.
Default timeout of 24 hours
By default,$.flow.suspend will automatically cancel the workflow after 24 hours. You can set your own timeout (in milliseconds) as the first argument:
$.flow.rerun
$.flow.rerun when you want to run a specific step of a workflow multiple times. This is useful when you need to start a job in an external API and poll for its completion, or have the service call back to the step and let you process the HTTP request within the step.
Retrying a Failed API Request
$.flow.rerun can be used to conditionally retry a failed API request due to a service outage or rate limit reached. Place the $.flow.rerun call within a catch block to only retry the API request if an error is thrown:
Polling for the status of an external job
Sometimes you need to poll for the status of an external job until it completes.$.flow.rerun lets you rerun a specific step multiple times:
$.flow.rerun accepts the following arguments:
Accept an HTTP callback from an external service
When you trigger a job in an external service, and that service can send back data in an HTTP callback to Pipedream, you can process that data within the same step using$.flow.rerun:
Passing context to $.flow.rerun
Within a Node.js code step, $.context.run.context contains the context passed from the prior call to rerun. This lets you pass data from one run to another. For example, if you call:
$.context.run.context will contain:

maxRetries
By default, maxRetries is 10.
When you exceed maxRetries, the workflow proceeds to the next step. If you need to handle this case with an exception, throw an error from the step:
Behavior when testing
When you’re building a workflow and test a step with$.flow.suspend or $.flow.rerun, it will not suspend the workflow, and you’ll see a message like the following:
Workflow execution canceled — this may be due to $.flow.suspend() usage (not supported in test)
These functions will only suspend and resume when run in production.
Credits when using suspend / rerun
You are not charged for the time your workflow is suspended during a $.flow.rerun or $.flow.suspend. Only when workflows are resumed will compute time count toward credit usage.
When a suspended workflow reawakens, it will reset the credit counter.Each rerun or reawakening from a suspension will count as a new fresh credit.