Skip to main content
POST
/
api
/
v1
/
flows
/
execute
Execute Flow
curl --request POST \
  --url https://agent-studio.thena.ai/api/v1/flows/execute \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "flow_id": "<string>",
  "trigger_data": {},
  "variables": {},
  "priority": "normal",
  "scheduled_at": "2023-11-07T05:31:56Z",
  "timeout_seconds": 300,
  "retry_config": {},
  "metadata": {}
}
'
import requests

url = "https://agent-studio.thena.ai/api/v1/flows/execute"

payload = {
"flow_id": "<string>",
"trigger_data": {},
"variables": {},
"priority": "normal",
"scheduled_at": "2023-11-07T05:31:56Z",
"timeout_seconds": 300,
"retry_config": {},
"metadata": {}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
flow_id: '<string>',
trigger_data: {},
variables: {},
priority: 'normal',
scheduled_at: '2023-11-07T05:31:56Z',
timeout_seconds: 300,
retry_config: {},
metadata: {}
})
};

fetch('https://agent-studio.thena.ai/api/v1/flows/execute', 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://agent-studio.thena.ai/api/v1/flows/execute",
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([
'flow_id' => '<string>',
'trigger_data' => [

],
'variables' => [

],
'priority' => 'normal',
'scheduled_at' => '2023-11-07T05:31:56Z',
'timeout_seconds' => 300,
'retry_config' => [

],
'metadata' => [

]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);

$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://agent-studio.thena.ai/api/v1/flows/execute"

payload := strings.NewReader("{\n \"flow_id\": \"<string>\",\n \"trigger_data\": {},\n \"variables\": {},\n \"priority\": \"normal\",\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"timeout_seconds\": 300,\n \"retry_config\": {},\n \"metadata\": {}\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
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://agent-studio.thena.ai/api/v1/flows/execute")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"flow_id\": \"<string>\",\n \"trigger_data\": {},\n \"variables\": {},\n \"priority\": \"normal\",\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"timeout_seconds\": 300,\n \"retry_config\": {},\n \"metadata\": {}\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://agent-studio.thena.ai/api/v1/flows/execute")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"flow_id\": \"<string>\",\n \"trigger_data\": {},\n \"variables\": {},\n \"priority\": \"normal\",\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"timeout_seconds\": 300,\n \"retry_config\": {},\n \"metadata\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "execution": {
    "flow_id": "<string>",
    "agent_id": "<string>",
    "organization_id": "<string>",
    "execution_number": 123,
    "started_at": "2023-11-07T05:31:56Z",
    "id": "<string>",
    "trigger_data": {},
    "variables": {},
    "completed_at": "2023-11-07T05:31:56Z",
    "duration_ms": 123,
    "timeout_seconds": 300,
    "steps": [
      {
        "step_id": "<string>",
        "step_name": "<string>",
        "step_type": "<string>",
        "started_at": "2023-11-07T05:31:56Z",
        "tool_name": "<string>",
        "input_data": {},
        "output_data": {},
        "error_message": "<string>",
        "completed_at": "2023-11-07T05:31:56Z",
        "duration_ms": 123,
        "retry_count": 0,
        "metadata": {}
      }
    ],
    "final_output": {},
    "error_message": "<string>",
    "error_details": {},
    "retry_count": 0,
    "max_retries": 3,
    "parent_execution_id": "<string>",
    "tokens_used": 123,
    "tool_calls_count": 0,
    "cost_estimate": 123,
    "performance_metrics": {},
    "metadata": {},
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  },
  "message": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

x-api-key
string
header
required

Body

application/json

Request model for creating a flow execution.

flow_id
string
required

ID of the flow to execute

trigger_type
enum<string>
required

How the execution was triggered

Available options:
manual,
event,
scheduled,
api,
webhook,
test
trigger_data
Trigger Data · object

Data from the trigger event

variables
Variables · object

Additional variables for execution

priority
enum<string>
default:normal

Execution priority

Available options:
low,
normal,
high,
urgent
scheduled_at
string<date-time> | null

When to execute (for scheduled executions)

timeout_seconds
integer | null
default:300

Execution timeout in seconds

retry_config
Retry Config · object | null

Retry configuration

metadata
Metadata · object

Additional execution metadata

Response

Successful Response

Response model for flow execution operations.

execution
FlowExecution · object
required

Execution details

message
string
required

Response message