Workflows
Create a workflow
Creates a draft from a graph of steps, the same graph the editor builds. Invite reviewers, then activate it. Needs workflow:write. A key whose signup is not confirmed yet can create drafts.
POST
/
api
/
workflows
Create a workflow
curl --request POST \
--url https://api.hitl.sh/v1/api/workflows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Refund approval",
"description": "A support lead approves or denies refunds.",
"nodes": [
{
"id": "trigger-1",
"type": "trigger",
"position": {
"x": 0,
"y": 0
},
"data": {
"triggerType": "webhook"
}
},
{
"id": "review-1",
"type": "review",
"position": {
"x": 0,
"y": 200
},
"data": {
"label": "Approve refund",
"requestText": "Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?",
"responseType": "single_select",
"priority": "high",
"timeout": "7200",
"responseConfig": {
"options": [
{
"value": "approve",
"label": "Approve refund"
},
{
"value": "deny",
"label": "Deny"
}
],
"required": true
}
}
},
{
"id": "end-1",
"type": "end",
"position": {
"x": 0,
"y": 400
},
"data": {
"label": "End"
}
}
],
"edges": [
{
"id": "e1",
"source": "trigger-1",
"target": "review-1"
},
{
"id": "e2",
"source": "review-1",
"target": "end-1"
}
]
}
'import requests
url = "https://api.hitl.sh/v1/api/workflows"
payload = {
"name": "Refund approval",
"description": "A support lead approves or denies refunds.",
"nodes": [
{
"id": "trigger-1",
"type": "trigger",
"position": {
"x": 0,
"y": 0
},
"data": { "triggerType": "webhook" }
},
{
"id": "review-1",
"type": "review",
"position": {
"x": 0,
"y": 200
},
"data": {
"label": "Approve refund",
"requestText": "Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?",
"responseType": "single_select",
"priority": "high",
"timeout": "7200",
"responseConfig": {
"options": [
{
"value": "approve",
"label": "Approve refund"
},
{
"value": "deny",
"label": "Deny"
}
],
"required": True
}
}
},
{
"id": "end-1",
"type": "end",
"position": {
"x": 0,
"y": 400
},
"data": { "label": "End" }
}
],
"edges": [
{
"id": "e1",
"source": "trigger-1",
"target": "review-1"
},
{
"id": "e2",
"source": "review-1",
"target": "end-1"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Refund approval',
description: 'A support lead approves or denies refunds.',
nodes: [
{
id: 'trigger-1',
type: 'trigger',
position: {x: 0, y: 0},
data: {triggerType: 'webhook'}
},
{
id: 'review-1',
type: 'review',
position: {x: 0, y: 200},
data: {
label: 'Approve refund',
requestText: 'Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?',
responseType: 'single_select',
priority: 'high',
timeout: '7200',
responseConfig: {
options: [{value: 'approve', label: 'Approve refund'}, {value: 'deny', label: 'Deny'}],
required: true
}
}
},
{id: 'end-1', type: 'end', position: {x: 0, y: 400}, data: {label: 'End'}}
],
edges: [
{id: 'e1', source: 'trigger-1', target: 'review-1'},
{id: 'e2', source: 'review-1', target: 'end-1'}
]
})
};
fetch('https://api.hitl.sh/v1/api/workflows', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hitl.sh/v1/api/workflows",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Refund approval',
'description' => 'A support lead approves or denies refunds.',
'nodes' => [
[
'id' => 'trigger-1',
'type' => 'trigger',
'position' => [
'x' => 0,
'y' => 0
],
'data' => [
'triggerType' => 'webhook'
]
],
[
'id' => 'review-1',
'type' => 'review',
'position' => [
'x' => 0,
'y' => 200
],
'data' => [
'label' => 'Approve refund',
'requestText' => 'Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?',
'responseType' => 'single_select',
'priority' => 'high',
'timeout' => '7200',
'responseConfig' => [
'options' => [
[
'value' => 'approve',
'label' => 'Approve refund'
],
[
'value' => 'deny',
'label' => 'Deny'
]
],
'required' => true
]
]
],
[
'id' => 'end-1',
'type' => 'end',
'position' => [
'x' => 0,
'y' => 400
],
'data' => [
'label' => 'End'
]
]
],
'edges' => [
[
'id' => 'e1',
'source' => 'trigger-1',
'target' => 'review-1'
],
[
'id' => 'e2',
'source' => 'review-1',
'target' => 'end-1'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hitl.sh/v1/api/workflows"
payload := strings.NewReader("{\n \"name\": \"Refund approval\",\n \"description\": \"A support lead approves or denies refunds.\",\n \"nodes\": [\n {\n \"id\": \"trigger-1\",\n \"type\": \"trigger\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"data\": {\n \"triggerType\": \"webhook\"\n }\n },\n {\n \"id\": \"review-1\",\n \"type\": \"review\",\n \"position\": {\n \"x\": 0,\n \"y\": 200\n },\n \"data\": {\n \"label\": \"Approve refund\",\n \"requestText\": \"Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?\",\n \"responseType\": \"single_select\",\n \"priority\": \"high\",\n \"timeout\": \"7200\",\n \"responseConfig\": {\n \"options\": [\n {\n \"value\": \"approve\",\n \"label\": \"Approve refund\"\n },\n {\n \"value\": \"deny\",\n \"label\": \"Deny\"\n }\n ],\n \"required\": true\n }\n }\n },\n {\n \"id\": \"end-1\",\n \"type\": \"end\",\n \"position\": {\n \"x\": 0,\n \"y\": 400\n },\n \"data\": {\n \"label\": \"End\"\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"e1\",\n \"source\": \"trigger-1\",\n \"target\": \"review-1\"\n },\n {\n \"id\": \"e2\",\n \"source\": \"review-1\",\n \"target\": \"end-1\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hitl.sh/v1/api/workflows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Refund approval\",\n \"description\": \"A support lead approves or denies refunds.\",\n \"nodes\": [\n {\n \"id\": \"trigger-1\",\n \"type\": \"trigger\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"data\": {\n \"triggerType\": \"webhook\"\n }\n },\n {\n \"id\": \"review-1\",\n \"type\": \"review\",\n \"position\": {\n \"x\": 0,\n \"y\": 200\n },\n \"data\": {\n \"label\": \"Approve refund\",\n \"requestText\": \"Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?\",\n \"responseType\": \"single_select\",\n \"priority\": \"high\",\n \"timeout\": \"7200\",\n \"responseConfig\": {\n \"options\": [\n {\n \"value\": \"approve\",\n \"label\": \"Approve refund\"\n },\n {\n \"value\": \"deny\",\n \"label\": \"Deny\"\n }\n ],\n \"required\": true\n }\n }\n },\n {\n \"id\": \"end-1\",\n \"type\": \"end\",\n \"position\": {\n \"x\": 0,\n \"y\": 400\n },\n \"data\": {\n \"label\": \"End\"\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"e1\",\n \"source\": \"trigger-1\",\n \"target\": \"review-1\"\n },\n {\n \"id\": \"e2\",\n \"source\": \"review-1\",\n \"target\": \"end-1\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hitl.sh/v1/api/workflows")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Refund approval\",\n \"description\": \"A support lead approves or denies refunds.\",\n \"nodes\": [\n {\n \"id\": \"trigger-1\",\n \"type\": \"trigger\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"data\": {\n \"triggerType\": \"webhook\"\n }\n },\n {\n \"id\": \"review-1\",\n \"type\": \"review\",\n \"position\": {\n \"x\": 0,\n \"y\": 200\n },\n \"data\": {\n \"label\": \"Approve refund\",\n \"requestText\": \"Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?\",\n \"responseType\": \"single_select\",\n \"priority\": \"high\",\n \"timeout\": \"7200\",\n \"responseConfig\": {\n \"options\": [\n {\n \"value\": \"approve\",\n \"label\": \"Approve refund\"\n },\n {\n \"value\": \"deny\",\n \"label\": \"Deny\"\n }\n ],\n \"required\": true\n }\n }\n },\n {\n \"id\": \"end-1\",\n \"type\": \"end\",\n \"position\": {\n \"x\": 0,\n \"y\": 400\n },\n \"data\": {\n \"label\": \"End\"\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"e1\",\n \"source\": \"trigger-1\",\n \"target\": \"review-1\"\n },\n {\n \"id\": \"e2\",\n \"source\": \"review-1\",\n \"target\": \"end-1\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": false,
"msg": "Workflow created",
"data": {
"id": "6af2ce4e8207961501f59472",
"name": "Refund approval",
"description": "A support lead approves, denies or escalates refunds over $100.",
"status": "draft",
"trigger": {
"type": "webhook",
"webhook_id": "wf_26db308d0ea2bfd5427999311a169b3b"
},
"steps": 6,
"has_review": true,
"runnable": false,
"execution_count": 0,
"last_executed_at": null,
"created_at": "2026-11-10T07:57:02.477Z",
"updated_at": "2026-11-10T07:57:05.452Z"
}
}{
"error": true,
"msg": "Invalid execution id"
}{
"error": true,
"msg": "Invalid API key"
}{
"error": true,
"code": "confirmation_required",
"msg": "Confirm the signup first: ask your human for the code in the email"
}Authorizations
Your API key: hitl_live_…
Body
application/json
⌘I
Create a workflow
curl --request POST \
--url https://api.hitl.sh/v1/api/workflows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Refund approval",
"description": "A support lead approves or denies refunds.",
"nodes": [
{
"id": "trigger-1",
"type": "trigger",
"position": {
"x": 0,
"y": 0
},
"data": {
"triggerType": "webhook"
}
},
{
"id": "review-1",
"type": "review",
"position": {
"x": 0,
"y": 200
},
"data": {
"label": "Approve refund",
"requestText": "Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?",
"responseType": "single_select",
"priority": "high",
"timeout": "7200",
"responseConfig": {
"options": [
{
"value": "approve",
"label": "Approve refund"
},
{
"value": "deny",
"label": "Deny"
}
],
"required": true
}
}
},
{
"id": "end-1",
"type": "end",
"position": {
"x": 0,
"y": 400
},
"data": {
"label": "End"
}
}
],
"edges": [
{
"id": "e1",
"source": "trigger-1",
"target": "review-1"
},
{
"id": "e2",
"source": "review-1",
"target": "end-1"
}
]
}
'import requests
url = "https://api.hitl.sh/v1/api/workflows"
payload = {
"name": "Refund approval",
"description": "A support lead approves or denies refunds.",
"nodes": [
{
"id": "trigger-1",
"type": "trigger",
"position": {
"x": 0,
"y": 0
},
"data": { "triggerType": "webhook" }
},
{
"id": "review-1",
"type": "review",
"position": {
"x": 0,
"y": 200
},
"data": {
"label": "Approve refund",
"requestText": "Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?",
"responseType": "single_select",
"priority": "high",
"timeout": "7200",
"responseConfig": {
"options": [
{
"value": "approve",
"label": "Approve refund"
},
{
"value": "deny",
"label": "Deny"
}
],
"required": True
}
}
},
{
"id": "end-1",
"type": "end",
"position": {
"x": 0,
"y": 400
},
"data": { "label": "End" }
}
],
"edges": [
{
"id": "e1",
"source": "trigger-1",
"target": "review-1"
},
{
"id": "e2",
"source": "review-1",
"target": "end-1"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Refund approval',
description: 'A support lead approves or denies refunds.',
nodes: [
{
id: 'trigger-1',
type: 'trigger',
position: {x: 0, y: 0},
data: {triggerType: 'webhook'}
},
{
id: 'review-1',
type: 'review',
position: {x: 0, y: 200},
data: {
label: 'Approve refund',
requestText: 'Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?',
responseType: 'single_select',
priority: 'high',
timeout: '7200',
responseConfig: {
options: [{value: 'approve', label: 'Approve refund'}, {value: 'deny', label: 'Deny'}],
required: true
}
}
},
{id: 'end-1', type: 'end', position: {x: 0, y: 400}, data: {label: 'End'}}
],
edges: [
{id: 'e1', source: 'trigger-1', target: 'review-1'},
{id: 'e2', source: 'review-1', target: 'end-1'}
]
})
};
fetch('https://api.hitl.sh/v1/api/workflows', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hitl.sh/v1/api/workflows",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Refund approval',
'description' => 'A support lead approves or denies refunds.',
'nodes' => [
[
'id' => 'trigger-1',
'type' => 'trigger',
'position' => [
'x' => 0,
'y' => 0
],
'data' => [
'triggerType' => 'webhook'
]
],
[
'id' => 'review-1',
'type' => 'review',
'position' => [
'x' => 0,
'y' => 200
],
'data' => [
'label' => 'Approve refund',
'requestText' => 'Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?',
'responseType' => 'single_select',
'priority' => 'high',
'timeout' => '7200',
'responseConfig' => [
'options' => [
[
'value' => 'approve',
'label' => 'Approve refund'
],
[
'value' => 'deny',
'label' => 'Deny'
]
],
'required' => true
]
]
],
[
'id' => 'end-1',
'type' => 'end',
'position' => [
'x' => 0,
'y' => 400
],
'data' => [
'label' => 'End'
]
]
],
'edges' => [
[
'id' => 'e1',
'source' => 'trigger-1',
'target' => 'review-1'
],
[
'id' => 'e2',
'source' => 'review-1',
'target' => 'end-1'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hitl.sh/v1/api/workflows"
payload := strings.NewReader("{\n \"name\": \"Refund approval\",\n \"description\": \"A support lead approves or denies refunds.\",\n \"nodes\": [\n {\n \"id\": \"trigger-1\",\n \"type\": \"trigger\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"data\": {\n \"triggerType\": \"webhook\"\n }\n },\n {\n \"id\": \"review-1\",\n \"type\": \"review\",\n \"position\": {\n \"x\": 0,\n \"y\": 200\n },\n \"data\": {\n \"label\": \"Approve refund\",\n \"requestText\": \"Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?\",\n \"responseType\": \"single_select\",\n \"priority\": \"high\",\n \"timeout\": \"7200\",\n \"responseConfig\": {\n \"options\": [\n {\n \"value\": \"approve\",\n \"label\": \"Approve refund\"\n },\n {\n \"value\": \"deny\",\n \"label\": \"Deny\"\n }\n ],\n \"required\": true\n }\n }\n },\n {\n \"id\": \"end-1\",\n \"type\": \"end\",\n \"position\": {\n \"x\": 0,\n \"y\": 400\n },\n \"data\": {\n \"label\": \"End\"\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"e1\",\n \"source\": \"trigger-1\",\n \"target\": \"review-1\"\n },\n {\n \"id\": \"e2\",\n \"source\": \"review-1\",\n \"target\": \"end-1\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hitl.sh/v1/api/workflows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Refund approval\",\n \"description\": \"A support lead approves or denies refunds.\",\n \"nodes\": [\n {\n \"id\": \"trigger-1\",\n \"type\": \"trigger\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"data\": {\n \"triggerType\": \"webhook\"\n }\n },\n {\n \"id\": \"review-1\",\n \"type\": \"review\",\n \"position\": {\n \"x\": 0,\n \"y\": 200\n },\n \"data\": {\n \"label\": \"Approve refund\",\n \"requestText\": \"Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?\",\n \"responseType\": \"single_select\",\n \"priority\": \"high\",\n \"timeout\": \"7200\",\n \"responseConfig\": {\n \"options\": [\n {\n \"value\": \"approve\",\n \"label\": \"Approve refund\"\n },\n {\n \"value\": \"deny\",\n \"label\": \"Deny\"\n }\n ],\n \"required\": true\n }\n }\n },\n {\n \"id\": \"end-1\",\n \"type\": \"end\",\n \"position\": {\n \"x\": 0,\n \"y\": 400\n },\n \"data\": {\n \"label\": \"End\"\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"e1\",\n \"source\": \"trigger-1\",\n \"target\": \"review-1\"\n },\n {\n \"id\": \"e2\",\n \"source\": \"review-1\",\n \"target\": \"end-1\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hitl.sh/v1/api/workflows")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Refund approval\",\n \"description\": \"A support lead approves or denies refunds.\",\n \"nodes\": [\n {\n \"id\": \"trigger-1\",\n \"type\": \"trigger\",\n \"position\": {\n \"x\": 0,\n \"y\": 0\n },\n \"data\": {\n \"triggerType\": \"webhook\"\n }\n },\n {\n \"id\": \"review-1\",\n \"type\": \"review\",\n \"position\": {\n \"x\": 0,\n \"y\": 200\n },\n \"data\": {\n \"label\": \"Approve refund\",\n \"requestText\": \"Refund ${{trigger.body.amount}} to {{trigger.body.customer.name}}?\",\n \"responseType\": \"single_select\",\n \"priority\": \"high\",\n \"timeout\": \"7200\",\n \"responseConfig\": {\n \"options\": [\n {\n \"value\": \"approve\",\n \"label\": \"Approve refund\"\n },\n {\n \"value\": \"deny\",\n \"label\": \"Deny\"\n }\n ],\n \"required\": true\n }\n }\n },\n {\n \"id\": \"end-1\",\n \"type\": \"end\",\n \"position\": {\n \"x\": 0,\n \"y\": 400\n },\n \"data\": {\n \"label\": \"End\"\n }\n }\n ],\n \"edges\": [\n {\n \"id\": \"e1\",\n \"source\": \"trigger-1\",\n \"target\": \"review-1\"\n },\n {\n \"id\": \"e2\",\n \"source\": \"review-1\",\n \"target\": \"end-1\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": false,
"msg": "Workflow created",
"data": {
"id": "6af2ce4e8207961501f59472",
"name": "Refund approval",
"description": "A support lead approves, denies or escalates refunds over $100.",
"status": "draft",
"trigger": {
"type": "webhook",
"webhook_id": "wf_26db308d0ea2bfd5427999311a169b3b"
},
"steps": 6,
"has_review": true,
"runnable": false,
"execution_count": 0,
"last_executed_at": null,
"created_at": "2026-11-10T07:57:02.477Z",
"updated_at": "2026-11-10T07:57:05.452Z"
}
}{
"error": true,
"msg": "Invalid execution id"
}{
"error": true,
"msg": "Invalid API key"
}{
"error": true,
"code": "confirmation_required",
"msg": "Confirm the signup first: ask your human for the code in the email"
}