Workflow API reference

Dapr provides users with the ability to interact with workflows through its built-in workflow engine, which is implemented using Dapr Actors.

To interact with the workflow engine, see [how to author]https://v1-19.docs.dapr.io/developing-applications/building-blocks/workflow/howto-author-workflow/ and manage workflows.

HTTP API reference (Deprecated)

Below is the reference for the Dapr Workflow API. This API is deprecated and will eventually be removed.

Start workflow request

Start a workflow instance with the given name. Both query parameters are optional and independent of each other; see the table below.

POST http://localhost:<daprPort>/v1.0/workflows/<workflowComponentName>/<workflowName>/start?instanceID=<instanceID>&appID=<appID>

Note that workflow instance IDs can only contain alphanumeric characters, underscores, and dashes.

URL parameters

ParameterDescription
workflowComponentNameUse dapr for Dapr Workflows
workflowNameIdentify the workflow type
instanceID(Optional) Unique value created for each run of a specific workflow
appID(Optional) App ID of the application that should host the workflow instance. Defaults to the local app. The target app must be in the same namespace and its workflow access policy governs whether the call is permitted.

Request content

Any request content will be passed to the workflow as input. The Dapr API passes the content as-is without attempting to interpret it.

HTTP response codes

CodeDescription
202Accepted
400Request was malformed
500Request formatted correctly, error in dapr code. This includes error code ERR_START_WORKFLOW when a workflow with the given instance ID already exists and is not yet reusable (it, or one of its child workflows, is not in a terminal state)

Response content

The API call will provide a response similar to this:

{
    "instanceID": "12345678"
}

Terminate workflow request

Terminate a running workflow instance with the given name and instance ID.

POST http://localhost:<daprPort>/v1.0/workflows/<workflowComponentName>/<instanceId>/terminate

URL parameters

ParameterDescription
workflowComponentNameUse dapr for Dapr Workflows
instanceIdUnique value created for each run of a specific workflow
appID(Optional) App ID of the application hosting the workflow instance. Defaults to the local app. The target app must be in the same namespace and its workflow access policy governs whether the call is permitted.

HTTP response codes

CodeDescription
202Accepted
400Request was malformed
500Request formatted correctly, error in dapr code

Response content

This API does not return any content.

Raise Event request

For workflow components that support subscribing to external events, such as the Dapr Workflow engine, you can use the following “raise event” API to deliver a named event to a specific workflow instance.

POST http://localhost:<daprPort>/v1.0/workflows/<workflowComponentName>/<instanceID>/raiseEvent/<eventName>

URL parameters

ParameterDescription
workflowComponentNameUse dapr for Dapr Workflows
instanceIdUnique value created for each run of a specific workflow
appID(Optional) App ID of the application hosting the workflow instance. Defaults to the local app. The target app must be in the same namespace and its workflow access policy governs whether the call is permitted.
eventNameThe name of the event to raise

HTTP response codes

CodeDescription
202Accepted
400Request was malformed
500Request formatted correctly, error in dapr code or underlying component

Response content

None.

Pause workflow request

Pause a running workflow instance.

POST http://localhost:<daprPort>/v1.0/workflows/<workflowComponentName>/<instanceId>/pause

URL parameters

ParameterDescription
workflowComponentNameUse dapr for Dapr Workflows
instanceIdUnique value created for each run of a specific workflow
appID(Optional) App ID of the application hosting the workflow instance. Defaults to the local app. The target app must be in the same namespace and its workflow access policy governs whether the call is permitted.

HTTP response codes

CodeDescription
202Accepted
400Request was malformed
500Error in Dapr code or underlying component

Response content

None.

Resume workflow request

Resume a paused workflow instance.

POST http://localhost:<daprPort>/v1.0/workflows/<workflowComponentName>/<instanceId>/resume

URL parameters

ParameterDescription
workflowComponentNameUse dapr for Dapr Workflows
instanceIdUnique value created for each run of a specific workflow
appID(Optional) App ID of the application hosting the workflow instance. Defaults to the local app. The target app must be in the same namespace and its workflow access policy governs whether the call is permitted.

HTTP response codes

CodeDescription
202Accepted
400Request was malformed
500Error in Dapr code

Response content

None.

Purge workflow request

Purge the workflow state from your state store with the workflow’s instance ID.

POST http://localhost:<daprPort>/v1.0/workflows/<workflowComponentName>/<instanceId>/purge

URL parameters

ParameterDescription
workflowComponentNameUse dapr for Dapr Workflows
instanceIdUnique value created for each run of a specific workflow
appID(Optional) App ID of the application hosting the workflow instance. Defaults to the local app. The target app must be in the same namespace and its workflow access policy governs whether the call is permitted.

HTTP response codes

CodeDescription
202Accepted
400Request was malformed
500Error in Dapr code

Response content

None.

Get workflow request

Get information about a given workflow instance.

GET http://localhost:<daprPort>/v1.0/workflows/<workflowComponentName>/<instanceId>

URL parameters

ParameterDescription
workflowComponentNameUse dapr for Dapr Workflows
instanceIdUnique value created for each run of a specific workflow
appID(Optional) App ID of the application hosting the workflow instance. Defaults to the local app. The target app must be in the same namespace and its workflow access policy governs whether the call is permitted.

HTTP response codes

CodeDescription
200OK
400Request was malformed
500Error in Dapr code

Response content

The API call will provide a JSON response similar to this:

{
  "createdAt": "2023-01-12T21:31:13Z",
  "instanceID": "12345678",
  "lastUpdatedAt": "2023-01-12T21:31:13Z",
  "properties": {
    "property1": "value1",
    "property2": "value2",
  },
  "runtimeStatus": "RUNNING",
 }
ParameterDescription
runtimeStatusThe status of the workflow instance. Values include: "RUNNING", "COMPLETED", "CONTINUED_AS_NEW", "FAILED", "CANCELED", "TERMINATED", "PENDING", "SUSPENDED"

The properties map does not include dapr.workflow.output when runtimeStatus is "FAILED". A failed workflow has no successful output. Instead, the properties map carries the failure in these keys:

ParameterDescription
dapr.workflow.failure.error_typeThe error type for a workflow with runtimeStatus "FAILED".
dapr.workflow.failure.error_messageThe error message for a workflow with runtimeStatus "FAILED".
dapr.workflow.failure.stack_traceThe stack trace for a workflow with runtimeStatus "FAILED", when available.