工作流运行
执行工作流
适用于:Workflow。
运行应用已发布的工作流并返回其输出,可以是单次 blocking 响应,也可以是 streaming 的 Server-Sent Events 流。需要已发布的工作流。
POST
/
workflows
/
run
curl --request POST \
--url https://{api_base_url}/workflows/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {
"query": "Translate this to French: Hello world"
},
"response_mode": "blocking",
"user": "user_workflow_456"
}
'{
"data": {
"created_at": 1705407629,
"elapsed_time": 1.23,
"error": null,
"finished_at": 1705407630,
"id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156",
"outputs": {
"result": "Bonjour le monde"
},
"status": "succeeded",
"total_steps": 3,
"total_tokens": 150,
"workflow_id": "7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345"
},
"task_id": "c3800678-a077-43df-a102-53f23ed20b88",
"workflow_run_id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156"
}Authorizations
Body
application/json
响应模式。使用 blocking 获取同步响应(Cloudflare 超时时间为 100 s),使用 streaming 获取服务器发送事件。未指定时默认为阻塞模式。
Available options:
streaming, blocking Response
请求成功。内容类型和结构取决于请求中的 response_mode 参数。
- 如果
response_mode为blocking,返回application/json和WorkflowBlockingResponse对象。 - 如果
response_mode为streaming,返回text/event-stream和ChunkWorkflowEvent对象流。
Last modified on September 30, 2026
Was this page helpful?
⌘I
curl --request POST \
--url https://{api_base_url}/workflows/run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {
"query": "Translate this to French: Hello world"
},
"response_mode": "blocking",
"user": "user_workflow_456"
}
'{
"data": {
"created_at": 1705407629,
"elapsed_time": 1.23,
"error": null,
"finished_at": 1705407630,
"id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156",
"outputs": {
"result": "Bonjour le monde"
},
"status": "succeeded",
"total_steps": 3,
"total_tokens": 150,
"workflow_id": "7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345"
},
"task_id": "c3800678-a077-43df-a102-53f23ed20b88",
"workflow_run_id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156"
}