Skip to content

Wait Task

"type" : "WAIT"

The Wait task (WAIT) is used to pause the workflow until a certain duration, until a timestamp, or until an external signal is received. It is a no-op task that remains IN_PROGRESS until the configured time has passed or the task is completed externally, at which point it is marked as COMPLETED.

Task parameters

Use these parameters inside inputParameters in the Wait task configuration. You can configure the Wait task using either duration or until in inputParameters.

Parameter Type Description Required / Optional
duration String The wait duration in the format x days y hours z minutes aa seconds. The accepted units in this field are:
  • days, or d for days
  • hours, hrs, or h for hours
  • minutes, mins, or m for minutes
  • seconds, secs, or s for seconds
Required for duration wait type.
until String The datetime and timezone to wait until, in one of the following formats:
  • yyyy-MM-dd HH:mm z
  • yyyy-MM-dd HH:mm
  • yyyy-MM-dd

For example, 2024-04-30 15:20 GMT+04:00.
Required for until wait type.
yield Available since: v5.2.95 and later Boolean When set to true, the synchronous API returns immediately instead of holding the HTTP connection open until the Wait task completes or waitForSeconds is reached. The duration timer still runs in the background, and the workflow is not skipped. The default value is false. Optional.

When to use yield: true

If you are executing a workflow synchronously or sending a signal to a running task synchronously, and the next task is a long-running WAIT with a duration (for example, 1 hour), your HTTP client would normally be blocked until the Wait task completes or waitForSeconds is reached. Set yield: true to receive an immediate response while the WAIT continues running in the background.

JSON configuration

Here is the task configuration for a Wait task.

Using duration

{
    "name": "wait",
    "taskReferenceName": "wait_ref",
    "inputParameters": {
        "duration": "10m20s"
    },
    "type": "WAIT"
}

Using until

{
    "name": "wait",
    "taskReferenceName": "wait_ref",
    "inputParameters": {
        "until": "2022-12-31 11:59"
    },
    "type": "WAIT"
}

Using signal

{
  "name": "wait",
  "taskReferenceName": "wait_ref",
  "type": "WAIT",
  "inputParameters": {
  }
}

Examples

Wait for a fixed duration

Wait for 30 seconds before proceeding:

{
  "name": "wait_30s",
  "taskReferenceName": "wait_30s_ref",
  "type": "WAIT",
  "inputParameters": {
    "duration": "30 seconds"
  }
}

Wait for 2 hours and 30 minutes:

{
  "name": "wait_2h30m",
  "taskReferenceName": "wait_2h30m_ref",
  "type": "WAIT",
  "inputParameters": {
    "duration": "2 hours 30 minutes"
  }
}

Wait until a specific date/time

Wait until a specific timestamp:

{
  "name": "wait_until_deadline",
  "taskReferenceName": "wait_deadline_ref",
  "type": "WAIT",
  "inputParameters": {
    "until": "2025-06-15 09:00 GMT+00:00"
  }
}

Wait until a date/time provided as workflow input:

{
  "name": "wait_until_input_time",
  "taskReferenceName": "wait_input_ref",
  "type": "WAIT",
  "inputParameters": {
    "until": "${workflow.input.scheduledTime}"
  }
}

Wait for an external signal (no duration)

When no duration or until is specified, the Wait task pauses indefinitely until it is completed externally via the Task Update API or an event handler:

{
  "name": "wait_for_signal",
  "taskReferenceName": "signal_ref",
  "type": "WAIT"
}

Complete the task externally:

curl -X POST '<YOUR-CLUSTER-URL>/api/tasks/{workflowId}/signal_ref/COMPLETED/sync' \
  -H 'Content-Type: application/json' \
  -d '{"approvedBy": "admin"}'

Using yield: true with a duration wait

This example configures a Wait task to pause execution for 1 hour while allowing the synchronous API to return immediately.

{
  "name": "wait",
  "taskReferenceName": "wait_ref",
  "type": "WAIT",
  "inputParameters": {
    "duration": "1 hour",
    "yield": true
  }
}

When the workflow reaches this task, the 1-hour timer starts in the background. If you are executing the workflow synchronously or sending a signal to a running task synchronously, the response is returned immediately instead of holding the HTTP connection open until waitForSeconds is reached.

Overriding the Wait task

The Task Update API (POST api/tasks) can be used to set the status of the Wait task to COMPLETED prior to the configured wait duration or timestamp.

If the workflow does not require a specific wait duration or timestamp, it is recommended to directly use the Human task instead, which waits for an external trigger.