template_workflow.en.mdx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. import { CodeGroup } from '../code.tsx'
  2. import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from '../md.tsx'
  3. # Workflow App API
  4. Workflow applications offers non-session support and is ideal for translation, article writing, summarization AI, and more.
  5. <div>
  6. ### Base URL
  7. <CodeGroup title="Code" targetCode={props.appDetail.api_base_url}>
  8. ```javascript
  9. ```
  10. </CodeGroup>
  11. ### Authentication
  12. The Service API uses `API-Key` authentication.
  13. <i>**Strongly recommend storing your API Key on the server-side, not shared or stored on the client-side, to avoid possible API-Key leakage that can lead to serious consequences.**</i>
  14. For all API requests, include your API Key in the `Authorization` HTTP Header, as shown below:
  15. <CodeGroup title="Code">
  16. ```javascript
  17. Authorization: Bearer {API_KEY}
  18. ```
  19. </CodeGroup>
  20. </div>
  21. ---
  22. <Heading
  23. url='/workflows/run'
  24. method='POST'
  25. title='Execute workflow'
  26. name='#Execute-Workflow'
  27. />
  28. <Row>
  29. <Col>
  30. Execute workflow, cannot be executed without a published workflow.
  31. ### Request Body
  32. - `inputs` (object) Required
  33. Allows the entry of various variable values defined by the App.
  34. The `inputs` parameter contains multiple key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable.
  35. The workflow application requires at least one key/value pair to be inputted.
  36. - `response_mode` (string) Required
  37. The mode of response return, supporting:
  38. - `streaming` Streaming mode (recommended), implements a typewriter-like output through SSE ([Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)).
  39. - `blocking` Blocking mode, returns result after execution is complete. (Requests may be interrupted if the process is long)
  40. <i>Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds.</i>
  41. - `user` (string) Required
  42. User identifier, used to define the identity of the end-user for retrieval and statistics.
  43. Should be uniquely defined by the developer within the application.
  44. - `files` (array[object]) Optional
  45. File list, suitable for inputting files combined with text understanding and answering questions, available only when the model supports Vision capability.
  46. - `type` (string) Supported type:
  47. - `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB')
  48. - `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG')
  49. - `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR')
  50. - `video` ('MP4', 'MOV', 'MPEG', 'MPGA')
  51. - `transfer_method` (string) Transfer method, `remote_url` for image URL / `local_file` for file upload
  52. - `url` (string) Image URL (when the transfer method is `remote_url`)
  53. - `upload_file_id` (string) Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`)
  54. ### Response
  55. When `response_mode` is `blocking`, return a CompletionResponse object.
  56. When `response_mode` is `streaming`, return a ChunkCompletionResponse stream.
  57. ### CompletionResponse
  58. Returns the App result, `Content-Type` is `application/json`.
  59. - `workflow_run_id` (string) Unique ID of workflow execution
  60. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  61. - `data` (object) detail of result
  62. - `id` (string) ID of workflow execution
  63. - `workflow_id` (string) ID of related workflow
  64. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  65. - `outputs` (json) Optional content of output
  66. - `error` (string) Optional reason of error
  67. - `elapsed_time` (float) Optional total seconds to be used
  68. - `total_tokens` (int) Optional tokens to be used
  69. - `total_steps` (int) default 0
  70. - `created_at` (timestamp) start time
  71. - `finished_at` (timestamp) end time
  72. ### ChunkCompletionResponse
  73. Returns the stream chunks outputted by the App, `Content-Type` is `text/event-stream`.
  74. Each streaming chunk starts with `data:`, separated by two newline characters `\n\n`, as shown below:
  75. <CodeGroup>
  76. ```streaming {{ title: 'Response' }}
  77. data: {"event": "message", "task_id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "Hi", "created_at": 1705398420}\n\n
  78. ```
  79. </CodeGroup>
  80. The structure of the streaming chunks varies depending on the `event`:
  81. - `event: workflow_started` workflow starts execution
  82. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  83. - `workflow_run_id` (string) Unique ID of workflow execution
  84. - `event` (string) fixed to `workflow_started`
  85. - `data` (object) detail
  86. - `id` (string) Unique ID of workflow execution
  87. - `workflow_id` (string) ID of related workflow
  88. - `sequence_number` (int) Self-increasing serial number, self-increasing in the App, starting from 1
  89. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  90. - `event: node_started` node execution started
  91. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  92. - `workflow_run_id` (string) Unique ID of workflow execution
  93. - `event` (string) fixed to `node_started`
  94. - `data` (object) detail
  95. - `id` (string) Unique ID of workflow execution
  96. - `node_id` (string) ID of node
  97. - `node_type` (string) type of node
  98. - `title` (string) name of node
  99. - `index` (int) Execution sequence number, used to display Tracing Node sequence
  100. - `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path
  101. - `inputs` (array[object]) Contents of all preceding node variables used in the node
  102. - `created_at` (timestamp) timestamp of start, e.g., 1705395332
  103. - `event: node_finished` node execution ends, success or failure in different states in the same event
  104. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  105. - `workflow_run_id` (string) Unique ID of workflow execution
  106. - `event` (string) fixed to `node_finished`
  107. - `data` (object) detail
  108. - `id` (string) Unique ID of workflow execution
  109. - `node_id` (string) ID of node
  110. - `node_type` (string) type of node
  111. - `title` (string) name of node
  112. - `index` (int) Execution sequence number, used to display Tracing Node sequence
  113. - `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path
  114. - `inputs` (array[object]) Contents of all preceding node variables used in the node
  115. - `process_data` (json) Optional node process data
  116. - `outputs` (json) Optional content of output
  117. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  118. - `error` (string) Optional reason of error
  119. - `elapsed_time` (float) Optional total seconds to be used
  120. - `execution_metadata` (json) meta data
  121. - `total_tokens` (int) optional tokens to be used
  122. - `total_price` (decimal) optional Total cost
  123. - `currency` (string) optional e.g. `USD` / `RMB`
  124. - `created_at` (timestamp) timestamp of start, e.g., 1705395332
  125. - `event: workflow_finished` workflow execution ends, success or failure in different states in the same event
  126. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  127. - `workflow_run_id` (string) Unique ID of workflow execution
  128. - `event` (string) fixed to `workflow_finished`
  129. - `data` (object) detail
  130. - `id` (string) ID of workflow execution
  131. - `workflow_id` (string) ID of related workflow
  132. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  133. - `outputs` (json) Optional content of output
  134. - `error` (string) Optional reason of error
  135. - `elapsed_time` (float) Optional total seconds to be used
  136. - `total_tokens` (int) Optional tokens to be used
  137. - `total_steps` (int) default 0
  138. - `created_at` (timestamp) start time
  139. - `finished_at` (timestamp) end time
  140. - `event: tts_message` TTS audio stream event, that is, speech synthesis output. The content is an audio block in Mp3 format, encoded as a base64 string. When playing, simply decode the base64 and feed it into the player. (This message is available only when auto-play is enabled)
  141. - `task_id` (string) Task ID, used for request tracking and the stop response interface below
  142. - `message_id` (string) Unique message ID
  143. - `audio` (string) The audio after speech synthesis, encoded in base64 text content, when playing, simply decode the base64 and feed it into the player
  144. - `created_at` (int) Creation timestamp, e.g.: 1705395332
  145. - `event: tts_message_end` TTS audio stream end event, receiving this event indicates the end of the audio stream.
  146. - `task_id` (string) Task ID, used for request tracking and the stop response interface below
  147. - `message_id` (string) Unique message ID
  148. - `audio` (string) The end event has no audio, so this is an empty string
  149. - `created_at` (int) Creation timestamp, e.g.: 1705395332
  150. - `event: ping` Ping event every 10 seconds to keep the connection alive.
  151. ### Errors
  152. - 400, `invalid_param`, abnormal parameter input
  153. - 400, `app_unavailable`, App configuration unavailable
  154. - 400, `provider_not_initialize`, no available model credential configuration
  155. - 400, `provider_quota_exceeded`, model invocation quota insufficient
  156. - 400, `model_currently_not_support`, current model unavailable
  157. - 400, `workflow_request_error`, workflow execution failed
  158. - 500, internal server error
  159. </Col>
  160. <Col sticky>
  161. <CodeGroup title="Request" tag="POST" label="/workflows/run" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/run' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}>
  162. ```bash {{ title: 'cURL' }}
  163. curl -X POST '${props.appDetail.api_base_url}/workflows/run' \
  164. --header 'Authorization: Bearer {api_key}' \
  165. --header 'Content-Type: application/json' \
  166. --data-raw '{
  167. "inputs": {},
  168. "response_mode": "streaming",
  169. "user": "abc-123"
  170. }'
  171. ```
  172. </CodeGroup>
  173. ### Blocking Mode
  174. <CodeGroup title="Response">
  175. ```json {{ title: 'Response' }}
  176. {
  177. "workflow_run_id": "djflajgkldjgd",
  178. "task_id": "9da23599-e713-473b-982c-4328d4f5c78a",
  179. "data": {
  180. "id": "fdlsjfjejkghjda",
  181. "workflow_id": "fldjaslkfjlsda",
  182. "status": "succeeded",
  183. "outputs": {
  184. "text": "Nice to meet you."
  185. },
  186. "error": null,
  187. "elapsed_time": 0.875,
  188. "total_tokens": 3562,
  189. "total_steps": 8,
  190. "created_at": 1705407629,
  191. "finished_at": 1727807631
  192. }
  193. }
  194. ```
  195. </CodeGroup>
  196. ### Streaming Mode
  197. <CodeGroup title="Response">
  198. ```streaming {{ title: 'Response' }}
  199. data: {"event": "workflow_started", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "workflow_id": "dfjasklfjdslag", "sequence_number": 1, "created_at": 1679586595}}
  200. data: {"event": "node_started", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "node_id": "dfjasklfjdslag", "node_type": "start", "title": "Start", "index": 0, "predecessor_node_id": "fdljewklfklgejlglsd", "inputs": {}, "created_at": 1679586595}}
  201. data: {"event": "node_finished", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "node_id": "dfjasklfjdslag", "node_type": "start", "title": "Start", "index": 0, "predecessor_node_id": "fdljewklfklgejlglsd", "inputs": {}, "outputs": {}, "status": "succeeded", "elapsed_time": 0.324, "execution_metadata": {"total_tokens": 63127864, "total_price": 2.378, "currency": "USD"}, "created_at": 1679586595}}
  202. data: {"event": "workflow_finished", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "workflow_id": "dfjasklfjdslag", "outputs": {}, "status": "succeeded", "elapsed_time": 0.324, "total_tokens": 63127864, "total_steps": "1", "created_at": 1679586595, "finished_at": 1679976595}}
  203. data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
  204. data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
  205. ```
  206. </CodeGroup>
  207. </Col>
  208. </Row>
  209. ---
  210. <Heading
  211. url='/workflows/run/:workflow_id'
  212. method='GET'
  213. title='Get Workflow Run Detail'
  214. name='#get-workflow-run-detail'
  215. />
  216. <Row>
  217. <Col>
  218. Retrieve the current execution results of a workflow task based on the workflow execution ID.
  219. ### Path
  220. - `workflow_id` (string) Workflow ID, can be obtained from the streaming chunk return
  221. ### Response
  222. - `id` (string) ID of workflow execution
  223. - `workflow_id` (string) ID of related workflow
  224. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  225. - `inputs` (json) content of input
  226. - `outputs` (json) content of output
  227. - `error` (string) reason of error
  228. - `total_steps` (int) total steps of task
  229. - `total_tokens` (int) total tokens to be used
  230. - `created_at` (timestamp) start time
  231. - `finished_at` (timestamp) end time
  232. - `elapsed_time` (float) total seconds to be used
  233. </Col>
  234. <Col sticky>
  235. ### Request Example
  236. <CodeGroup title="Request" tag="GET" label="/workflows/run/:workflow_id" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_id' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json'`}>
  237. ```bash {{ title: 'cURL' }}
  238. curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_id' \
  239. -H 'Authorization: Bearer {api_key}' \
  240. -H 'Content-Type: application/json'
  241. ```
  242. </CodeGroup>
  243. ### Response Example
  244. <CodeGroup title="Response">
  245. ```json {{ title: 'Response' }}
  246. {
  247. "id": "b1ad3277-089e-42c6-9dff-6820d94fbc76",
  248. "workflow_id": "19eff89f-ec03-4f75-b0fc-897e7effea02",
  249. "status": "succeeded",
  250. "inputs": "{\"sys.files\": [], \"sys.user_id\": \"abc-123\"}",
  251. "outputs": null,
  252. "error": null,
  253. "total_steps": 3,
  254. "total_tokens": 0,
  255. "created_at": "Thu, 18 Jul 2024 03:17:40 -0000",
  256. "finished_at": "Thu, 18 Jul 2024 03:18:10 -0000",
  257. "elapsed_time": 30.098514399956912
  258. }
  259. ```
  260. </CodeGroup>
  261. </Col>
  262. </Row>
  263. ---
  264. <Heading
  265. url='/workflows/tasks/:task_id/stop'
  266. method='POST'
  267. title='Stop Generate'
  268. name='#stop-generatebacks'
  269. />
  270. <Row>
  271. <Col>
  272. Only supported in streaming mode.
  273. ### Path
  274. - `task_id` (string) Task ID, can be obtained from the streaming chunk return
  275. ### Request Body
  276. - `user` (string) Required
  277. User identifier, used to define the identity of the end-user, must be consistent with the user passed in the send message interface.
  278. ### Response
  279. - `result` (string) Always returns "success"
  280. </Col>
  281. <Col sticky>
  282. ### Request Example
  283. <CodeGroup title="Request" tag="POST" label="/workflows/tasks/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{"user": "abc-123"}'`}>
  284. ```bash {{ title: 'cURL' }}
  285. curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \
  286. -H 'Authorization: Bearer {api_key}' \
  287. -H 'Content-Type: application/json' \
  288. --data-raw '{
  289. "user": "abc-123"
  290. }'
  291. ```
  292. </CodeGroup>
  293. ### Response Example
  294. <CodeGroup title="Response">
  295. ```json {{ title: 'Response' }}
  296. {
  297. "result": "success"
  298. }
  299. ```
  300. </CodeGroup>
  301. </Col>
  302. </Row>
  303. ---
  304. <Heading
  305. url='/parameters'
  306. method='GET'
  307. title='Get Application Information'
  308. name='#parameters'
  309. />
  310. <Row>
  311. <Col>
  312. Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values.
  313. ### Query
  314. <Properties>
  315. <Property name='user' type='string' key='user'>
  316. User identifier, defined by the developer's rules, must be unique within the application.
  317. </Property>
  318. </Properties>
  319. ### Response
  320. - `user_input_form` (array[object]) User input form configuration
  321. - `text-input` (object) Text input control
  322. - `label` (string) Variable display label name
  323. - `variable` (string) Variable ID
  324. - `required` (bool) Whether it is required
  325. - `default` (string) Default value
  326. - `paragraph` (object) Paragraph text input control
  327. - `label` (string) Variable display label name
  328. - `variable` (string) Variable ID
  329. - `required` (bool) Whether it is required
  330. - `default` (string) Default value
  331. - `select` (object) Dropdown control
  332. - `label` (string) Variable display label name
  333. - `variable` (string) Variable ID
  334. - `required` (bool) Whether it is required
  335. - `default` (string) Default value
  336. - `options` (array[string]) Option values
  337. - `file_upload` (object) File upload configuration
  338. - `image` (object) Image settings
  339. Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`
  340. - `enabled` (bool) Whether it is enabled
  341. - `number_limits` (int) Image number limit, default is 3
  342. - `transfer_methods` (array[string]) List of transfer methods, remote_url, local_file, must choose one
  343. - `system_parameters` (object) System parameters
  344. - `file_size_limit` (int) Document upload size limit (MB)
  345. - `image_file_size_limit` (int) Image file upload size limit (MB)
  346. - `audio_file_size_limit` (int) Audio file upload size limit (MB)
  347. - `video_file_size_limit` (int) Video file upload size limit (MB)
  348. </Col>
  349. <Col sticky>
  350. <CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters?user=abc-123'`}>
  351. ```bash {{ title: 'cURL' }}
  352. curl -X GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \
  353. --header 'Authorization: Bearer {api_key}'
  354. ```
  355. </CodeGroup>
  356. <CodeGroup title="Response">
  357. ```json {{ title: 'Response' }}
  358. {
  359. "user_input_form": [
  360. {
  361. "paragraph": {
  362. "label": "Query",
  363. "variable": "query",
  364. "required": true,
  365. "default": ""
  366. }
  367. }
  368. ],
  369. "file_upload": {
  370. "image": {
  371. "enabled": false,
  372. "number_limits": 3,
  373. "detail": "high",
  374. "transfer_methods": [
  375. "remote_url",
  376. "local_file"
  377. ]
  378. }
  379. },
  380. "system_parameters": {
  381. "file_size_limit": 15,
  382. "image_file_size_limit": 10,
  383. "audio_file_size_limit": 50,
  384. "video_file_size_limit": 100
  385. }
  386. }
  387. ```
  388. </CodeGroup>
  389. </Col>
  390. </Row>
  391. ---
  392. <Heading
  393. url='/workflows/logs'
  394. method='GET'
  395. title='Get workflow logs'
  396. name='#Get-Workflow-Logs'
  397. />
  398. <Row>
  399. <Col>
  400. Returns workflow logs, with the first page returning the latest `{limit}` messages, i.e., in reverse order.
  401. ### Query
  402. <Properties>
  403. <Property name='keyword' type='string' key='keyword'>
  404. Keyword to search
  405. </Property>
  406. <Property name='status' type='string' key='status'>
  407. succeeded/failed/stopped
  408. </Property>
  409. <Property name='page' type='int' key='page'>
  410. current page, default is 1.
  411. </Property>
  412. <Property name='limit' type='int' key='limit'>
  413. How many chat history messages to return in one request, default is 20.
  414. </Property>
  415. </Properties>
  416. ### Response
  417. - `page` (int) Current page
  418. - `limit` (int) Number of returned items, if input exceeds system limit, returns system limit amount
  419. - `total` (int) Number of total items
  420. - `has_more` (bool) Whether there is a next page
  421. - `data` (array[object]) Log list
  422. - `id` (string) ID
  423. - `workflow_run` (object) Workflow run
  424. - `id` (string) ID
  425. - `version` (string) Version
  426. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  427. - `error` (string) Optional reason of error
  428. - `elapsed_time` (float) total seconds to be used
  429. - `total_tokens` (int) tokens to be used
  430. - `total_steps` (int) default 0
  431. - `created_at` (timestamp) start time
  432. - `finished_at` (timestamp) end time
  433. - `created_from` (string) Created from
  434. - `created_by_role` (string) Created by role
  435. - `created_by_account` (string) Optional Created by account
  436. - `created_by_end_user` (object) Created by end user
  437. - `id` (string) ID
  438. - `type` (string) Type
  439. - `is_anonymous` (bool) Is anonymous
  440. - `session_id` (string) Session ID
  441. - `created_at` (timestamp) create time
  442. </Col>
  443. <Col sticky>
  444. <CodeGroup title="Request" tag="GET" label="/workflows/logs" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/logs'\\\n --header 'Authorization: Bearer {api_key}'`}>
  445. ```bash {{ title: 'cURL' }}
  446. curl -X GET '${props.appDetail.api_base_url}/workflows/logs?limit=1'
  447. --header 'Authorization: Bearer {api_key}'
  448. ```
  449. </CodeGroup>
  450. ### Response Example
  451. <CodeGroup title="Response">
  452. ```json {{ title: 'Response' }}
  453. {
  454. "page": 1,
  455. "limit": 1,
  456. "total": 7,
  457. "has_more": true,
  458. "data": [
  459. {
  460. "id": "e41b93f1-7ca2-40fd-b3a8-999aeb499cc0",
  461. "workflow_run": {
  462. "id": "c0640fc8-03ef-4481-a96c-8a13b732a36e",
  463. "version": "2024-08-01 12:17:09.771832",
  464. "status": "succeeded",
  465. "error": null,
  466. "elapsed_time": 1.3588523610014818,
  467. "total_tokens": 0,
  468. "total_steps": 3,
  469. "created_at": 1726139643,
  470. "finished_at": 1726139644
  471. },
  472. "created_from": "service-api",
  473. "created_by_role": "end_user",
  474. "created_by_account": null,
  475. "created_by_end_user": {
  476. "id": "7f7d9117-dd9d-441d-8970-87e5e7e687a3",
  477. "type": "service_api",
  478. "is_anonymous": false,
  479. "session_id": "abc-123"
  480. },
  481. "created_at": 1726139644
  482. }
  483. ]
  484. }
  485. ```
  486. </CodeGroup>
  487. </Col>
  488. </Row>