Skip to main content

Execute Workflow Synchronously

Endpoint: POST /api/workflow/execute/{name}

Starts a workflow execution synchronously. This method returns a response after a specified waitForSeconds has passed or when a specified waitUntilTaskRef task completes, whichever completes first.

Path parameters

ParameterDescriptionTypeRequired/ Optional
nameThe name of the workflow to be started.stringRequired.

Query parameters

ParameterDescriptionTypeRequired/ Optional
versionThe workflow version. If unspecified, the latest version will be used.integerOptional.

Request body

Contains the workflow inputs. Format the request as an object containing key-value pairs.

Example

{
"someKey": "someValue",
"anotherKey": {}
}

Header parameters

ParameterDescriptionTypeRequired/ Optional
X-Idempotency-keyA unique, user-generated key to prevent duplicate workflow executions. Idempotency data is retained for the life of the workflow execution.stringOptional.
X-on-conflictThe idempotency strategy for handling duplicate requests. Supported values:
  • RETURN_EXISTING—Return the workflowId of the workflow instance with the same idempotency key.
  • FAIL—Start a new workflow instance only if there are no workflow executions with the same idempotency key.
  • FAIL_ON_RUNNING—Start a new workflow instance only if there are no RUNNING or PAUSED workflows with the same idempotency key. Completed workflows can run again.
stringRequired if X-Idempotency-key is specified.
requestIdA user-generated request ID, which can be used to track the API request.stringOptional.
waitUntilTaskRefThe reference name of the task to wait for before returning a response.

Note: If the workflow is incomplete, the response will return 206.
stringOptional.
waitForSecondsThe duration in seconds to wait before returning a response. Default is 10.integerOptional.

Response

Returns the workflow output.

Examples

Execute a workflow synchronously

Request

curl -X 'POST' \
'https://<YOUR_CLUSTER>/api/workflow/execute/someWorkflow' \
-H 'accept: application/json' \
-H 'waitForSeconds: 15' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"input1": "someValue"
}'

Response

{
"output": {
"output1": "anotherValue",
"output2": "yetAnotherValue"
"
}
}