Workflow API reference

Detailed documentation on the workflow API

Component format

A Dapr workflow.yaml component file has the following structure:

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. spec:
  6. type: workflow.<TYPE>
  7. version: v1.0-alpha1
  8. metadata:
  9. - name: <NAME>
  10. value: <VALUE>
SettingDescription
metadata.nameThe name of the workflow component.
spec/metadataAdditional metadata parameters specified by workflow component

Supported workflow methods

POST start workflow request

  1. POST http://localhost:3500/v1.0-alpha1/workflows/<workflowComponentName>/<workflowName>/<instanceId>/start

POST terminate workflow request

  1. POST http://localhost:3500/v1.0-alpha1/workflows/<workflowComponentName>/<instanceId>/terminate

GET workflow request

  1. GET http://localhost:3500/v1.0-alpha1/workflows/<workflowComponentName>/<workflowName>/<instanceId>

URL parameters

ParameterDescription
workflowComponentNameCurrent default is dapr for Dapr Workflows
workflowNameIdentify the workflow type
instanceIdUnique value created for each run of a specific workflow

Headers

As part of the start HTTP request, the caller can optionally include one or more dapr-workflow-metadata HTTP request headers. The format of the header value is a list of {key}={value} values, similar to the format for HTTP cookie request headers. These key/value pairs are saved in the workflow instance’s metadata and can be made available for search (in cases where the workflow implementation supports this kind of search).

HTTP responses

Response codes

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

Examples of response body for each method

POST start workflow response body

  1. "WFInfo": {
  2. "instance_id": "SampleWorkflow"
  3. }

POST terminate workflow response body

  1. HTTP/1.1 202 Accepted
  2. Server: fasthttp
  3. Date: Thu, 12 Jan 2023 21:31:16 GMT
  4. Content-Type: application/json
  5. Content-Length: 139
  6. Traceparent: 00-e3dedffedbeb9efbde9fbed3f8e2d8-5f38960d43d24e98-01
  7. Connection: close

GET workflow response body

  1. HTTP/1.1 202 Accepted
  2. Server: fasthttp
  3. Date: Thu, 12 Jan 2023 21:31:16 GMT
  4. Content-Type: application/json
  5. Content-Length: 139
  6. Traceparent: 00-e3dedffedbeb9efbde9fbed3f8e2d8-5f38960d43d24e98-01
  7. Connection: close
  8. {
  9. "WFInfo": {
  10. "instance_id": "SampleWorkflow"
  11. },
  12. "start_time": "2023-01-12T21:31:13Z",
  13. "metadata": {
  14. "status": "Running",
  15. "task_queue": "WorkflowSampleQueue"
  16. }
  17. }

Next Steps

Last modified February 16, 2023: remove left over todo links (67e809ab)