Skip to main content
POST
/
workflows
/
run
cURL
curl -N --request POST \
  --url 'https://{api_base_url}/workflows/run' \
  --header 'Authorization: Bearer {api_key}' \
  --header 'Content-Type: application/json' \
  --data '{"inputs": {"query": "Summarize this text: The quick brown fox jumps over the lazy dog."}, "response_mode": "streaming", "user": "{user}"}'
import requests

url = "https://{api_base_url}/workflows/run"

payload = {
"inputs": { "query": "Summarize this text: The quick brown fox jumps over the lazy dog." },
"response_mode": "streaming",
"user": "user_workflow_123"
}
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({
inputs: {query: 'Summarize this text: The quick brown fox jumps over the lazy dog.'},
response_mode: 'streaming',
user: 'user_workflow_123'
})
};

fetch('https://{api_base_url}/workflows/run', 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_base_url}/workflows/run",
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([
'inputs' => [
'query' => 'Summarize this text: The quick brown fox jumps over the lazy dog.'
],
'response_mode' => 'streaming',
'user' => 'user_workflow_123'
]),
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_base_url}/workflows/run"

payload := strings.NewReader("{\n \"inputs\": {\n \"query\": \"Summarize this text: The quick brown fox jumps over the lazy dog.\"\n },\n \"response_mode\": \"streaming\",\n \"user\": \"user_workflow_123\"\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_base_url}/workflows/run")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {\n \"query\": \"Summarize this text: The quick brown fox jumps over the lazy dog.\"\n },\n \"response_mode\": \"streaming\",\n \"user\": \"user_workflow_123\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{api_base_url}/workflows/run")

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 \"inputs\": {\n \"query\": \"Summarize this text: The quick brown fox jumps over the lazy dog.\"\n },\n \"response_mode\": \"streaming\",\n \"user\": \"user_workflow_123\"\n}"

response = http.request(request)
puts response.read_body
{
  "task_id": "c3800678-a077-43df-a102-53f23ed20b88",
  "workflow_run_id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156",
  "data": {
    "id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156",
    "workflow_id": "7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345",
    "status": "succeeded",
    "outputs": {
      "result": "Bonjour le monde"
    },
    "error": null,
    "elapsed_time": 1.23,
    "total_tokens": 150,
    "total_steps": 3,
    "created_at": 1705407629,
    "finished_at": 1705407630
  }
}

Authorizations

Authorization
string
header
required

Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).

Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).

Body

application/json
inputs
object
required

Key-value pairs for workflow input variables. Discover the variable names and types your app expects from the user_input_form field of Get App Parameters.

File-type variables take an array of file objects with type, transfer_method, and either url or upload_file_id.

user
string
required

End-user identifier, defined by your app and unique within it. Scopes data access: a workflow run and its files are only visible to later requests that carry the same user. See End User Identity.

response_mode
enum<string>

Response mode. Use blocking for synchronous responses (Cloudflare timeout is 100 s), or streaming for Server-Sent Events. When omitted, defaults to blocking behavior.

Available options:
streaming,
blocking
files
object[] | null

File list. Suitable when files need to be combined with text for input, available only when the model supports Vision capability. To attach a local file, first upload it via Upload File and use the returned id as upload_file_id with transfer_method: local_file.

Response

Successful response. The content type and structure depend on the response_mode parameter in the request.

  • If response_mode is blocking, returns application/json with a WorkflowBlockingResponse object.
  • If response_mode is streaming, returns text/event-stream with a stream of ChunkWorkflowEvent objects.
task_id
string<uuid>

Task ID for the in-progress execution. Use this with Stop Workflow Task to cancel a running workflow. Only valid during execution.

workflow_run_id
string<uuid>

Persistent identifier for this workflow run record. Use this with Get Workflow Run Detail to retrieve results after execution.

data
object