Execute Workflow
curl --request POST \
--url https://api.example.com/workflows/{workflow_id}/runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'message=<string>' \
--data stream=true \
--data background=false \
--data 'session_id=<string>' \
--data 'user_id=<string>' \
--data version=123 \
--data 'factory_input=<string>'import requests
url = "https://api.example.com/workflows/{workflow_id}/runs"
payload = {
"message": "<string>",
"stream": "true",
"background": "false",
"session_id": "<string>",
"user_id": "<string>",
"version": "123",
"factory_input": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
message: '<string>',
stream: 'true',
background: 'false',
session_id: '<string>',
user_id: '<string>',
version: '123',
factory_input: '<string>'
})
};
fetch('https://api.example.com/workflows/{workflow_id}/runs', 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.example.com/workflows/{workflow_id}/runs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "message=%3Cstring%3E&stream=true&background=false&session_id=%3Cstring%3E&user_id=%3Cstring%3E&version=123&factory_input=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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.example.com/workflows/{workflow_id}/runs"
payload := strings.NewReader("message=%3Cstring%3E&stream=true&background=false&session_id=%3Cstring%3E&user_id=%3Cstring%3E&version=123&factory_input=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
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.example.com/workflows/{workflow_id}/runs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("message=%3Cstring%3E&stream=true&background=false&session_id=%3Cstring%3E&user_id=%3Cstring%3E&version=123&factory_input=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/workflows/{workflow_id}/runs")
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/x-www-form-urlencoded'
request.body = "message=%3Cstring%3E&stream=true&background=false&session_id=%3Cstring%3E&user_id=%3Cstring%3E&version=123&factory_input=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"run_id": "<string>",
"run_input": "<string>",
"events": [
{}
],
"workflow_id": "<string>",
"user_id": "<string>",
"content": "<string>",
"content_type": "<string>",
"status": "<string>",
"step_results": [
{}
],
"step_executor_runs": [
{}
],
"step_requirements": [
{}
],
"pause_kind": "<string>",
"paused_step_name": "<string>",
"paused_step_index": 123,
"metrics": {},
"created_at": "2023-11-07T05:31:56Z",
"reasoning_content": "<string>",
"reasoning_steps": [
{}
],
"references": [
{}
],
"citations": {},
"reasoning_messages": [
{}
],
"images": [
{}
],
"videos": [
{}
],
"audio": [
{}
],
"files": [
{}
],
"response_audio": {}
}{
"run_id": "<string>",
"session_id": "<string>",
"status": "PENDING"
}{
"detail": "Bad request"
}{
"detail": "Unauthenticated access"
}{
"detail": "Not found"
}{
"detail": [
{
"loc": [
"body",
"endpoint"
],
"msg": "Value error, Endpoint must be a path, not a full URL",
"type": "value_error"
}
]
}{
"detail": "Internal server error"
}Workflows
Execute Workflow
Execute a workflow with the provided input data. Workflows can run in streaming or batch mode.
Execution Modes:
- Streaming (
stream=true): Real-time step-by-step execution updates via SSE - Non-Streaming (
stream=false): Complete workflow execution with final result
Workflow Execution Process:
- Input validation against workflow schema
- Sequential or parallel step execution based on workflow design
- Data flow between steps with transformation
- Error handling and automatic retries where configured
- Final result compilation and response
Session Management: Workflows support session continuity for stateful execution across multiple runs.
POST
/
workflows
/
{workflow_id}
/
runs
Execute Workflow
curl --request POST \
--url https://api.example.com/workflows/{workflow_id}/runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'message=<string>' \
--data stream=true \
--data background=false \
--data 'session_id=<string>' \
--data 'user_id=<string>' \
--data version=123 \
--data 'factory_input=<string>'import requests
url = "https://api.example.com/workflows/{workflow_id}/runs"
payload = {
"message": "<string>",
"stream": "true",
"background": "false",
"session_id": "<string>",
"user_id": "<string>",
"version": "123",
"factory_input": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
message: '<string>',
stream: 'true',
background: 'false',
session_id: '<string>',
user_id: '<string>',
version: '123',
factory_input: '<string>'
})
};
fetch('https://api.example.com/workflows/{workflow_id}/runs', 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.example.com/workflows/{workflow_id}/runs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "message=%3Cstring%3E&stream=true&background=false&session_id=%3Cstring%3E&user_id=%3Cstring%3E&version=123&factory_input=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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.example.com/workflows/{workflow_id}/runs"
payload := strings.NewReader("message=%3Cstring%3E&stream=true&background=false&session_id=%3Cstring%3E&user_id=%3Cstring%3E&version=123&factory_input=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
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.example.com/workflows/{workflow_id}/runs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("message=%3Cstring%3E&stream=true&background=false&session_id=%3Cstring%3E&user_id=%3Cstring%3E&version=123&factory_input=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/workflows/{workflow_id}/runs")
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/x-www-form-urlencoded'
request.body = "message=%3Cstring%3E&stream=true&background=false&session_id=%3Cstring%3E&user_id=%3Cstring%3E&version=123&factory_input=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"run_id": "<string>",
"run_input": "<string>",
"events": [
{}
],
"workflow_id": "<string>",
"user_id": "<string>",
"content": "<string>",
"content_type": "<string>",
"status": "<string>",
"step_results": [
{}
],
"step_executor_runs": [
{}
],
"step_requirements": [
{}
],
"pause_kind": "<string>",
"paused_step_name": "<string>",
"paused_step_index": 123,
"metrics": {},
"created_at": "2023-11-07T05:31:56Z",
"reasoning_content": "<string>",
"reasoning_steps": [
{}
],
"references": [
{}
],
"citations": {},
"reasoning_messages": [
{}
],
"images": [
{}
],
"videos": [
{}
],
"audio": [
{}
],
"files": [
{}
],
"response_audio": {}
}{
"run_id": "<string>",
"session_id": "<string>",
"status": "PENDING"
}{
"detail": "Bad request"
}{
"detail": "Unauthenticated access"
}{
"detail": "Not found"
}{
"detail": [
{
"loc": [
"body",
"endpoint"
],
"msg": "Value error, Endpoint must be a path, not a full URL",
"type": "value_error"
}
]
}{
"detail": "Internal server error"
}Authorizations
Body
application/x-www-form-urlencoded
Response
Workflow executed successfully
Was this page helpful?