> ## Documentation Index
> Fetch the complete documentation index at: https://pipedream.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Delay

export const DELAY_MIN_MAX_TIME = 'You can pause your workflow for as little as one millisecond, or as long as one year';

### Delay

<Frame>
  <iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/IBORwBnIZ-k" title="Delaying Workflow Steps" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />
</Frame>

Sometimes you need to wait a specific amount of time before the next step of your workflow proceeds. Pipedream supports this in one of two ways:

1. The built-in **Delay** actions
2. The `$.flow.delay` function in Node.js

{DELAY_MIN_MAX_TIME}. For example, we at Pipedream use this functionality to delay welcome emails to our customers until they’ve had a chance to use the product.

#### Delay actions

You can pause your workflow without writing code using the **Delay** actions:

1. Click the **+** button below any step
2. Search for the **Delay** app
3. Select the **Delay Workflow** action
4. Configure the action to delay any amount of time, up to one year

<Frame>
  <img src="https://mintcdn.com/pipedream/anb6FA0wpd8jtdUB/images/615bd561-image.png?fit=max&auto=format&n=anb6FA0wpd8jtdUB&q=85&s=d1628d8a70670e2a3ac375b55add9671" width="754" height="427" data-path="images/615bd561-image.png" />
</Frame>

#### `$.flow.delay`

If you need to delay a workflow within Node.js code, or you need detailed control over how delays occur, [see the docs on `$.flow.delay`](/workflows/building-workflows/code/nodejs/delay/).

#### The state of delayed executions

Delayed executions can hold one of three states:

* **Paused**: The execution is within the delay window, and the workflow is still paused
* **Resumed**: The workflow has been resumed at the end of its delay window automatically, or resumed manually
* **Cancelled**: The execution was cancelled manually

You’ll see the current state of an execution by [viewing its event data](/workflows/building-workflows/inspect/).

#### Cancelling or resuming execution manually

The [**Delay** actions](/workflows/building-workflows/control-flow/delay/#delay-actions) and [`$.flow.delay`](/workflows/building-workflows/code/nodejs/delay/) return two URLs each time they run:

<Frame>
  <img src="https://mintcdn.com/pipedream/h8oodpUDiyR1Ssvt/images/4b451f7e-Screen_Shot_2022-05-02_at_9.16.11_PM_ahw7tu.png?fit=max&auto=format&n=h8oodpUDiyR1Ssvt&q=85&s=935c687ab557a962aa62fe78c59513fa" width="1630" height="388" data-path="images/4b451f7e-Screen_Shot_2022-05-02_at_9.16.11_PM_ahw7tu.png" />
</Frame>

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 an HTTP request to either:

* Hitting the `cancel_url` will immediately cancel that execution
* Hitting the `resume_url` will immediately resume that execution early

If you use [`$.flow.delay`](/workflows/building-workflows/code/nodejs/delay/), you can send these URLs to your own system to handle cancellation / resumption. You can even email your customers to let them cancel / resume workflows that run on their behalf.
