Start a Workflow
How to start a workflow via API
Besides starting a workflow from the Sample Dashboard, you can also start a workflow via API.
Prerequisites
To start a workflow, you will require two things
-
A SampleHC API key (see Authentication)
-
The slug (unique identifier) of the workflow you want to start
To find a workflow slug, from the workflow page, click the Edit button at the top right.
On the edit page, next to the title of the workflow (e.g., Sample Workflow Template), you will see the slug (e.g.,
sample-workflow-template
).
Making a request
Below are examples of how to start a workflow with different types of request bodies. Remember to replace YOUR_API_KEY
with your actual API key and <my-workflow-slug>
with the slug of your workflow.
Using application/json
If you want to send data as a JSON object, use the Content-Type: application/json
header. The body should be a JSON object, optionally containing a startData
field.
Using multipart/form-data
If you need to include files or send data as form fields, use multipart/form-data
. curl
will set the Content-Type
header automatically when you use the -F
option.
Any form fields you send will be collected into the startData
. If you send files, they will be processed and their resulting identifiers or content will also be part of startData
.