template_chat.en.mdx 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  1. import { CodeGroup } from '../code.tsx'
  2. import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from '../md.tsx'
  3. # Chat App API
  4. Chat applications support session persistence, allowing previous chat history to be used as context for responses. This can be applicable for chatbots, customer service AI, etc.
  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='/chat-messages'
  24. method='POST'
  25. title='Send Chat Message'
  26. name='#Send-Chat-Message'
  27. />
  28. <Row>
  29. <Col>
  30. Send a request to the chat application.
  31. ### Request Body
  32. <Properties>
  33. <Property name='query' type='string' key='query'>
  34. User Input/Question content
  35. </Property>
  36. <Property name='inputs' type='object' key='inputs'>
  37. Allows the entry of various variable values defined by the App.
  38. 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.
  39. </Property>
  40. <Property name='response_mode' type='string' key='response_mode'>
  41. The mode of response return, supporting:
  42. - `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)).
  43. - `blocking` Blocking mode, returns result after execution is complete. (Requests may be interrupted if the process is long)
  44. Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds.
  45. <i>Note: blocking mode is not supported in Agent Assistant mode</i>
  46. </Property>
  47. <Property name='user' type='string' key='user'>
  48. User identifier, used to define the identity of the end-user for retrieval and statistics.
  49. Should be uniquely defined by the developer within the application.
  50. </Property>
  51. <Property name='conversation_id' type='string' key='conversation_id'>
  52. Converation ID, to continue the conversation based on previous chat records, it is necessary to pass the previous message's conversation_id.
  53. </Property>
  54. <Property name='files' type='array[object]' key='files'>
  55. File list, suitable for inputting files (images) combined with text understanding and answering questions, available only when the model supports Vision capability.
  56. - `type` (string) Supported type: `image` (currently only supports image type)
  57. - `transfer_method` (string) Transfer method, `remote_url` for image URL / `local_file` for file upload
  58. - `url` (string) Image URL (when the transfer method is `remote_url`)
  59. - `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`)
  60. </Property>
  61. <Property name='auto_generate_name' type='bool' key='auto_generate_name'>
  62. Auto-generate title, default is `false`.
  63. Can achieve async title generation by calling the conversation rename API and setting `auto_generate` to true.
  64. </Property>
  65. </Properties>
  66. ### Response
  67. When response_mode is blocking, return a CompletionResponse object.
  68. When response_mode is streaming, return a ChunkCompletionResponse stream.
  69. ### ChatCompletionResponse
  70. Returns the complete App result, `Content-Type` is `application/json`.
  71. - `message_id` (string) Unique message ID
  72. - `conversation_id` (string) Conversation ID
  73. - `mode` (string) App mode, fixed as `chat`
  74. - `answer` (string) Complete response content
  75. - `metadata` (object) Metadata
  76. - `usage` (Usage) Model usage information
  77. - `retriever_resources` (array[RetrieverResource]) Citation and Attribution List
  78. - `created_at` (int) Message creation timestamp, e.g., 1705395332
  79. ### ChunkChatCompletionResponse
  80. Returns the stream chunks outputted by the App, `Content-Type` is `text/event-stream`.
  81. Each streaming chunk starts with `data:`, separated by two newline characters `\n\n`, as shown below:
  82. <CodeGroup>
  83. ```streaming {{ title: 'Response' }}
  84. data: {"event": "message", "task_id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "Hi", "created_at": 1705398420}\n\n
  85. ```
  86. </CodeGroup>
  87. The structure of the streaming chunks varies depending on the `event`:
  88. - `event: message` LLM returns text chunk event, i.e., the complete text is output in a chunked fashion.
  89. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  90. - `message_id` (string) Unique message ID
  91. - `conversation_id` (string) Conversation ID
  92. - `answer` (string) LLM returned text chunk content
  93. - `created_at` (int) Creation timestamp, e.g., 1705395332
  94. - `event: agent_message` LLM returns text chunk event, i.e., with Agent Assistant enabled, the complete text is output in a chunked fashion (Only supported in Agent mode)
  95. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  96. - `message_id` (string) Unique message ID
  97. - `conversation_id` (string) Conversation ID
  98. - `answer` (string) LLM returned text chunk content
  99. - `created_at` (int) Creation timestamp, e.g., 1705395332
  100. - `event: agent_thought` thought of Agent, contains the thought of LLM, input and output of tool calls (Only supported in Agent mode)
  101. - `id` (string) Agent thought ID, every iteration has a unique agent thought ID
  102. - `task_id` (string) (string) Task ID, used for request tracking and the below Stop Generate API
  103. - `message_id` (string) Unique message ID
  104. - `position` (int) Position of current agent thought, each message may have multiple thoughts in order.
  105. - `thought` (string) What LLM is thinking about
  106. - `observation` (string) Response from tool calls
  107. - `tool` (string) A list of tools represents which tools are called,split by ;
  108. - `tool_input` (string) Input of tools in JSON format. Like: `{"dalle3": {"prompt": "a cute cat"}}`.
  109. - `created_at` (int) Creation timestamp, e.g., 1705395332
  110. - `message_files` (array[string]) Refer to message_file event
  111. - `file_id` (string) File ID
  112. - `conversation_id` (string) Conversation ID
  113. - `event: message_file` Message file event, a new file has created by tool
  114. - `id` (string) File unique ID
  115. - `type` (string) File type,only allow "image" currently
  116. - `belongs_to` (string) Belongs to, it will only be an 'assistant' here
  117. - `url` (string) Remote url of file
  118. - `conversation_id` (string) Conversation ID
  119. - `event: message_end` Message end event, receiving this event means streaming has ended.
  120. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  121. - `message_id` (string) Unique message ID
  122. - `conversation_id` (string) Conversation ID
  123. - `metadata` (object) Metadata
  124. - `usage` (Usage) Model usage information
  125. - `retriever_resources` (array[RetrieverResource]) Citation and Attribution List
  126. - `event: message_replace` Message content replacement event.
  127. When output content moderation is enabled, if the content is flagged, then the message content will be replaced with a preset reply through this event.
  128. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  129. - `message_id` (string) Unique message ID
  130. - `conversation_id` (string) Conversation ID
  131. - `answer` (string) Replacement content (directly replaces all LLM reply text)
  132. - `created_at` (int) Creation timestamp, e.g., 1705395332
  133. - `event: error`
  134. Exceptions that occur during the streaming process will be output in the form of stream events, and reception of an error event will end the stream.
  135. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  136. - `message_id` (string) Unique message ID
  137. - `status` (int) HTTP status code
  138. - `code` (string) Error code
  139. - `message` (string) Error message
  140. - `event: ping` Ping event every 10 seconds to keep the connection alive.
  141. ### Errors
  142. - 404, Conversation does not exists
  143. - 400, `invalid_param`, abnormal parameter input
  144. - 400, `app_unavailable`, App configuration unavailable
  145. - 400, `provider_not_initialize`, no available model credential configuration
  146. - 400, `provider_quota_exceeded`, model invocation quota insufficient
  147. - 400, `model_currently_not_support`, current model unavailable
  148. - 400, `completion_request_error`, text generation failed
  149. - 500, internal server error
  150. </Col>
  151. <Col sticky>
  152. <CodeGroup title="Request" tag="POST" abel="/chat-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "What are the specs of the iPhone 13 Pro Max?",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123"\n "files": [\n {\n "type": "images",\n "transfer_method": "remote_url"\n "url": "https://cloud.dify.ai/logo/logo-site.png"\n }\n ]\n},'`}>
  153. ```bash {{ title: 'cURL' }}
  154. curl -X POST '${props.appDetail.api_base_url}/chat-messages' \
  155. --header 'Authorization: Bearer {api_key}' \
  156. --header 'Content-Type: application/json' \
  157. --data-raw '{
  158. "inputs": {},
  159. "query": "eh",
  160. "response_mode": "streaming",
  161. "conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276",
  162. "user": "abc-123"
  163. }'
  164. ```
  165. </CodeGroup>
  166. ### Blocking Mode
  167. <CodeGroup title="Response">
  168. ```json {{ title: 'Response' }}
  169. {
  170. "event": "message",
  171. "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
  172. "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
  173. "mode": "chat",
  174. "answer": "iPhone 13 Pro Max specs are listed heere:...",
  175. "metadata": {
  176. "usage": {
  177. "prompt_tokens": 1033,
  178. "prompt_unit_price": "0.001",
  179. "prompt_price_unit": "0.001",
  180. "prompt_price": "0.0010330",
  181. "completion_tokens": 128,
  182. "completion_unit_price": "0.002",
  183. "completion_price_unit": "0.001",
  184. "completion_price": "0.0002560",
  185. "total_tokens": 1161,
  186. "total_price": "0.0012890",
  187. "currency": "USD",
  188. "latency": 0.7682376249867957
  189. },
  190. "retriever_resources": [
  191. {
  192. "position": 1,
  193. "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
  194. "dataset_name": "iPhone",
  195. "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00",
  196. "document_name": "iPhone List",
  197. "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a",
  198. "score": 0.98457545,
  199. "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""
  200. }
  201. ]
  202. },
  203. "created_at": 1705407629
  204. }
  205. ```
  206. </CodeGroup>
  207. ### Streaming Mode ( Basic Assistant )
  208. <CodeGroup title="Response">
  209. ```streaming {{ title: 'Response' }}
  210. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " I", "created_at": 1679586595}
  211. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": "'m", "created_at": 1679586595}
  212. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " glad", "created_at": 1679586595}
  213. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " to", "created_at": 1679586595}
  214. data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " meet", "created_at": 1679586595}
  215. data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " you", "created_at": 1679586595}
  216. data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}}
  217. ```
  218. </CodeGroup>
  219. ### Response Example(Agent Assistant)
  220. <CodeGroup title="Response">
  221. ```streaming {{ title: 'Response' }}
  222. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " I", "created_at": 1679586595}
  223. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": "'m", "created_at": 1679586595}
  224. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " glad", "created_at": 1679586595}
  225. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " to", "created_at": 1679586595}
  226. data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " meet", "created_at": 1679586595}
  227. data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " you", "created_at": 1679586595}
  228. data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}}
  229. ```
  230. </CodeGroup>
  231. </Col>
  232. </Row>
  233. ---
  234. <Heading
  235. url='/files/upload'
  236. method='POST'
  237. title='File Upload'
  238. name='#file-upload'
  239. />
  240. <Row>
  241. <Col>
  242. Upload a file (currently only images are supported) for use when sending messages, enabling multimodal understanding of images and text.
  243. Supports png, jpg, jpeg, webp, gif formats.
  244. Uploaded files are for use by the current end-user only.
  245. ### Request Body
  246. This interface requires a `multipart/form-data` request.
  247. - `file` (File) Required
  248. The file to be uploaded.
  249. - `user` (string) Required
  250. User identifier, defined by the developer's rules, must be unique within the application.
  251. ### Response
  252. After a successful upload, the server will return the file's ID and related information.
  253. - `id` (uuid) ID
  254. - `name` (string) File name
  255. - `size` (int) File size (bytes)
  256. - `extension` (string) File extension
  257. - `mime_type` (string) File mime-type
  258. - `created_by` (uuid) End-user ID
  259. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  260. ### Errors
  261. - 400, `no_file_uploaded`, a file must be provided
  262. - 400, `too_many_files`, currently only one file is accepted
  263. - 400, `unsupported_preview`, the file does not support preview
  264. - 400, `unsupported_estimate`, the file does not support estimation
  265. - 413, `file_too_large`, the file is too large
  266. - 415, `unsupported_file_type`, unsupported extension, currently only document files are accepted
  267. - 503, `s3_connection_failed`, unable to connect to S3 service
  268. - 503, `s3_permission_denied`, no permission to upload files to S3
  269. - 503, `s3_file_too_large`, file exceeds S3 size limit
  270. - 500, internal server error
  271. </Col>
  272. <Col sticky>
  273. ### Request Example
  274. <CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif] \\\n--form 'user=abc-123'`}>
  275. ```bash {{ title: 'cURL' }}
  276. curl -X POST '${props.appDetail.api_base_url}/files/upload' \
  277. --header 'Authorization: Bearer {api_key}' \
  278. --form 'file=@"/path/to/file"'
  279. ```
  280. </CodeGroup>
  281. ### Response Example
  282. <CodeGroup title="Response">
  283. ```json {{ title: 'Response' }}
  284. {
  285. "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
  286. "name": "example.png",
  287. "size": 1024,
  288. "extension": "png",
  289. "mime_type": "image/png",
  290. "created_by": "6ad1ab0a-73ff-4ac1-b9e4-cdb312f71f13",
  291. "created_at": 1577836800,
  292. }
  293. ```
  294. </CodeGroup>
  295. </Col>
  296. </Row>
  297. ---
  298. <Heading
  299. url='/chat-messages/:task_id/stop'
  300. method='POST'
  301. title='Stop Generate'
  302. name='#stop-generatebacks'
  303. />
  304. <Row>
  305. <Col>
  306. Only supported in streaming mode.
  307. ### Path
  308. - `task_id` (string) Task ID, can be obtained from the streaming chunk return
  309. ### Request Body
  310. - `user` (string) Required
  311. User identifier, used to define the identity of the end-user, must be consistent with the user passed in the send message interface.
  312. Response
  313. - `result` (string) Always returns "success"
  314. </Col>
  315. <Col sticky>
  316. ### Request Example
  317. <CodeGroup title="Request" tag="POST" label="/chat-messages/:task_id/stop" targetCode={`curl -X POST 'https://cloud.dify.ai/v1/chat-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{ "user": "abc-123"}`}>
  318. ```bash {{ title: 'cURL' }}
  319. curl -X POST 'https://cloud.dify.ai/v1/chat-messages/:task_id/stop' \
  320. -H 'Authorization: Bearer {api_key}' \
  321. -H 'Content-Type: application/json' \
  322. --data-raw '{
  323. "user": "abc-123"
  324. }'
  325. ```
  326. </CodeGroup>
  327. ### Response Example
  328. <CodeGroup title="Response">
  329. ```json {{ title: 'Response' }}
  330. {
  331. "result": "success"
  332. }
  333. ```
  334. </CodeGroup>
  335. </Col>
  336. </Row>
  337. ---
  338. <Heading
  339. url='/messages/{message_id}/feedbacks'
  340. method='POST'
  341. title='Message Feedback'
  342. name='#feedbacks'
  343. />
  344. <Row>
  345. <Col>
  346. End-users can provide feedback messages, facilitating application developers to optimize expected outputs.
  347. ### Path
  348. <Properties>
  349. <Property name='message_id' type='string' key='message_id'>
  350. Message ID
  351. </Property>
  352. </Properties>
  353. ### Request Body
  354. <Properties>
  355. <Property name='rating' type='string' key='rating'>
  356. Upvote as `like`, downvote as `dislike`, revoke upvote as `null`
  357. </Property>
  358. <Property name='user' type='string' key='user'>
  359. User identifier, defined by the developer's rules, must be unique within the application.
  360. </Property>
  361. </Properties>
  362. ### Response
  363. - `result` (string) Always returns "success"
  364. </Col>
  365. <Col sticky>
  366. <CodeGroup title="Request" tag="POST" label="/messages/{message_id}/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks \\\n --header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123"\n}'`}>
  367. ```bash {{ title: 'cURL' }}
  368. curl -X POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks' \
  369. --header 'Authorization: Bearer {api_key}' \
  370. --header 'Content-Type: application/json' \
  371. --data-raw '{
  372. "rating": "like",
  373. "user": "abc-123"
  374. }'
  375. ```
  376. </CodeGroup>
  377. <CodeGroup title="Response">
  378. ```json {{ title: 'Response' }}
  379. {
  380. "result": "success"
  381. }
  382. ```
  383. </CodeGroup>
  384. </Col>
  385. </Row>
  386. ---
  387. <Heading
  388. url='/messages'
  389. method='GET'
  390. title='Get Conversation History Messages'
  391. name='#messages'
  392. />
  393. <Row>
  394. <Col>
  395. Returns historical chat records in a scrolling load format, with the first page returning the latest `{limit}` messages, i.e., in reverse order.
  396. ### Query
  397. <Properties>
  398. <Property name='conversation_id' type='string' key='conversation_id'>
  399. Conversation ID
  400. </Property>
  401. <Property name='user' type='string' key='user'>
  402. User identifier, used to define the identity of the end-user for retrieval and statistics.
  403. Should be uniquely defined by the developer within the application.
  404. </Property>
  405. <Property name='first_id' type='string' key='first_id'>
  406. The ID of the first chat record on the current page, default is null.
  407. </Property>
  408. <Property name='limit' type='int' key='limit'>
  409. How many chat history messages to return in one request, default is 20.
  410. </Property>
  411. </Properties>
  412. ### Response
  413. - `data` (array[object]) Message list
  414. - `id` (string) Message ID
  415. - `conversation_id` (string) Conversation ID
  416. - `inputs` (array[object]) User input parameters.
  417. - `query` (string) User input / question content.
  418. - `message_files` (array[object]) Message files
  419. - `id` (string) ID
  420. - `type` (string) File type, image for images
  421. - `url` (string) Preview image URL
  422. - `belongs_to` (string) belongs to,user orassistant
  423. - `agent_thoughts` (array[object]) Agent thought(Empty if it's a Basic Assistant)
  424. - `id` (string) Agent thought ID, every iteration has a unique agent thought ID
  425. - `message_id` (string) Unique message ID
  426. - `position` (int) Position of current agent thought, each message may have multiple thoughts in order.
  427. - `thought` (string) What LLM is thinking about
  428. - `observation` (string) Response from tool calls
  429. - `tool` (string) A list of tools represents which tools are called,split by ;
  430. - `tool_input` (string) Input of tools in JSON format. Like: `{"dalle3": {"prompt": "a cute cat"}}`.
  431. - `created_at` (int) Creation timestamp, e.g., 1705395332
  432. - `message_files` (array[string]) Refer to message_file event
  433. - `file_id` (string) File ID
  434. - `answer` (string) Response message content
  435. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  436. - `feedback` (object) Feedback information
  437. - `rating` (string) Upvote as `like` / Downvote as `dislike`
  438. - `retriever_resources` (array[RetrieverResource]) Citation and Attribution List
  439. - `has_more` (bool) Whether there is a next page
  440. - `limit` (int) Number of returned items, if input exceeds system limit, returns system limit amount
  441. </Col>
  442. <Col sticky>
  443. <CodeGroup title="Request" tag="GET" label="/messages" targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='\\\n --header 'Authorization: Bearer {api_key}'`}>
  444. ```bash {{ title: 'cURL' }}
  445. curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='
  446. --header 'Authorization: Bearer {api_key}'
  447. ```
  448. </CodeGroup>
  449. ### Response Example (Basic Assistant)
  450. <CodeGroup title="Response">
  451. ```json {{ title: 'Response' }}
  452. {
  453. "limit": 20,
  454. "has_more": false,
  455. "data": [
  456. {
  457. "id": "a076a87f-31e5-48dc-b452-0061adbbc922",
  458. "conversation_id": "cd78daf6-f9e4-4463-9ff2-54257230a0ce",
  459. "inputs": {
  460. "name": "dify"
  461. },
  462. "query": "iphone 13 pro",
  463. "answer": "The iPhone 13 Pro, released on September 24, 2021, features a 6.1-inch display with a resolution of 1170 x 2532. It is equipped with a Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard) processor, 6 GB of RAM, and offers storage options of 128 GB, 256 GB, 512 GB, and 1 TB. The camera is 12 MP, the battery capacity is 3095 mAh, and it runs on iOS 15.",
  464. "message_files": [],
  465. "feedback": null,
  466. "retriever_resources": [
  467. {
  468. "position": 1,
  469. "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
  470. "dataset_name": "iPhone",
  471. "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00",
  472. "document_name": "iPhone List",
  473. "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a",
  474. "score": 0.98457545,
  475. "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""
  476. }
  477. ],
  478. "agent_thoughts": [],
  479. "created_at": 1705569239,
  480. }
  481. ]
  482. }
  483. ```
  484. </CodeGroup>
  485. ### Response Example (Agent Assistant)
  486. <CodeGroup title="Response">
  487. ```json {{ title: 'Response' }}
  488. {
  489. "limit": 20,
  490. "has_more": false,
  491. "data": [
  492. {
  493. "id": "d35e006c-7c4d-458f-9142-be4930abdf94",
  494. "conversation_id": "957c068b-f258-4f89-ba10-6e8a0361c457",
  495. "inputs": {},
  496. "query": "draw a cat",
  497. "answer": "I have generated an image of a cat for you. Please check your messages to view the image.",
  498. "message_files": [
  499. {
  500. "id": "976990d2-5294-47e6-8f14-7356ba9d2d76",
  501. "type": "image",
  502. "url": "http://127.0.0.1:5001/files/tools/976990d2-5294-47e6-8f14-7356ba9d2d76.png?timestamp=1705988524&nonce=55df3f9f7311a9acd91bf074cd524092&sign=z43nMSO1L2HBvoqADLkRxr7Biz0fkjeDstnJiCK1zh8=",
  503. "belongs_to": "assistant"
  504. }
  505. ],
  506. "feedback": null,
  507. "retriever_resources": [],
  508. "created_at": 1705988187,
  509. "agent_thoughts": [
  510. {
  511. "id": "592c84cf-07ee-441c-9dcc-ffc66c033469",
  512. "chain_id": null,
  513. "message_id": "d35e006c-7c4d-458f-9142-be4930abdf94",
  514. "position": 1,
  515. "thought": "",
  516. "tool": "dalle2",
  517. "tool_input": "{\"dalle2\": {\"prompt\": \"cat\"}}",
  518. "created_at": 1705988186,
  519. "observation": "image has been created and sent to user already, you should tell user to check it now.",
  520. "message_files": [
  521. "976990d2-5294-47e6-8f14-7356ba9d2d76"
  522. ]
  523. },
  524. {
  525. "id": "73ead60d-2370-4780-b5ed-532d2762b0e5",
  526. "chain_id": null,
  527. "message_id": "d35e006c-7c4d-458f-9142-be4930abdf94",
  528. "position": 2,
  529. "thought": "I have generated an image of a cat for you. Please check your messages to view the image.",
  530. "tool": "",
  531. "tool_input": "",
  532. "created_at": 1705988199,
  533. "observation": "",
  534. "message_files": []
  535. }
  536. ]
  537. }
  538. ]
  539. }
  540. ```
  541. </CodeGroup>
  542. </Col>
  543. </Row>
  544. ---
  545. <Heading
  546. url='/conversations'
  547. method='GET'
  548. title='Get Conversations'
  549. name='#conversations'
  550. />
  551. <Row>
  552. <Col>
  553. Retrieve the conversation list for the current user, defaulting to the most recent 20 entries.
  554. ### Query
  555. <Properties>
  556. <Property name='user' type='string' key='user'>
  557. User identifier, used to define the identity of the end-user for retrieval and statistics.
  558. Should be uniquely defined by the developer within the application.
  559. </Property>
  560. <Property name='last_id' type='string' key='last_id'>
  561. The ID of the last record on the current page, default is null.
  562. </Property>
  563. <Property name='limit' type='int' key='limit'>
  564. How many records to return in one request, default is the most recent 20 entries.
  565. </Property>
  566. <Property name='pinned' type='bool' key='pinned'>
  567. Return only pinned conversations as `true`, only non-pinned as `false`
  568. </Property>
  569. </Properties>
  570. ### Response
  571. - `data` (array[object]) List of conversations
  572. - `id` (string) Conversation ID
  573. - `name` (string) Conversation name, by default, is a snippet of the first question asked by the user in the conversation.
  574. - `inputs` (array[object]) User input parameters.
  575. - `introduction` (string) Introduction
  576. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  577. - `has_more` (bool)
  578. - `limit` (int) Number of entries returned, if input exceeds system limit, system limit number is returned
  579. </Col>
  580. <Col sticky>
  581. <CodeGroup title="Request" tag="GET" label="/conversations" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20'`}>
  582. ```bash {{ title: 'cURL' }}
  583. curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \
  584. --header 'Authorization: Bearer {api_key}'
  585. ```
  586. </CodeGroup>
  587. <CodeGroup title="Response">
  588. ```json {{ title: 'Response' }}
  589. {
  590. "limit": 20,
  591. "has_more": false,
  592. "data": [
  593. {
  594. "id": "10799fb8-64f7-4296-bbf7-b42bfbe0ae54",
  595. "name": "New chat",
  596. "inputs": {
  597. "book": "book",
  598. "myName": "Lucy"
  599. },
  600. "status": "normal",
  601. "created_at": 1679667915
  602. },
  603. {
  604. "id": "hSIhXBhNe8X1d8Et"
  605. // ...
  606. }
  607. ]
  608. }
  609. ```
  610. </CodeGroup>
  611. </Col>
  612. </Row>
  613. ---
  614. <Heading
  615. url='/conversations/{conversation_id}'
  616. method='DELETE'
  617. title='Delete Conversation'
  618. name='#delete'
  619. />
  620. <Row>
  621. <Col>
  622. Delete a conversation.
  623. ### Path
  624. - `conversation_id` (string) Conversation ID
  625. ### Request Body
  626. <Properties>
  627. <Property name='user' type='string' key='user'>
  628. The user identifier, defined by the developer, must ensure uniqueness within the application.
  629. </Property>
  630. </Properties>
  631. ### Response
  632. - `result` (string) Always returns "success"
  633. </Col>
  634. <Col sticky>
  635. <CodeGroup title="Request" tag="DELETE" label="/conversations/{conversation_id}" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}>
  636. ```bash {{ title: 'cURL' }}
  637. curl -X DELETE '${props.appDetail.api_base_url}/conversations/{convsation_id}' \
  638. --header 'Content-Type: application/json' \
  639. --header 'Accept: application/json' \
  640. --header 'Authorization: Bearer {api_key}' \
  641. --data '{
  642. "user": "abc-123"
  643. }'
  644. ```
  645. </CodeGroup>
  646. <CodeGroup title="Response">
  647. ```json {{ title: 'Response' }}
  648. {
  649. "result": "success"
  650. }
  651. ```
  652. </CodeGroup>
  653. </Col>
  654. </Row>
  655. ---
  656. <Heading
  657. url='/conversations/{conversation_id}/name'
  658. method='POST'
  659. title='Conversation Rename'
  660. name='#rename'
  661. />
  662. <Row>
  663. <Col>
  664. ### Request Body
  665. <Properties>
  666. <Property name='name' type='string' key='name'>
  667. The name of the conversation. This parameter can be omitted if `auto_generate` is set to `true`.
  668. </Property>
  669. <Property name='auto_generate' type='bool' key='auto_generate'>
  670. Automatically generate the title, default is `false`
  671. </Property>
  672. <Property name='user' type='string' key='user'>
  673. The user identifier, defined by the developer, must ensure uniqueness within the application.
  674. </Property>
  675. </Properties>
  676. ### Response
  677. - `id` (string) Conversation ID
  678. - `name` (string) Conversation name
  679. - `inputs` array[object] User input parameters.
  680. - `introduction` (string) Introduction
  681. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  682. </Col>
  683. <Col sticky>
  684. <CodeGroup title="Request" tag="POST" label="/conversations/{conversation_id}/name" targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/name' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "user": "abc-123"\n}'`}>
  685. ```bash {{ title: 'cURL' }}
  686. curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \
  687. --header 'Content-Type: application/json' \
  688. --header 'Authorization: Bearer {api_key}' \
  689. --data-raw '{
  690. "name": "",
  691. "user": "abc-123"
  692. }'
  693. ```
  694. </CodeGroup>
  695. <CodeGroup title="Response">
  696. ```json {{ title: 'Response' }}
  697. {
  698. "id": "cd78daf6-f9e4-4463-9ff2-54257230a0ce",
  699. "name": "Chat vs AI",
  700. "inputs": {},
  701. "introduction": "",
  702. "created_at": 1705569238
  703. }
  704. ```
  705. </CodeGroup>
  706. </Col>
  707. </Row>
  708. ---
  709. <Heading
  710. url='/audio-to-text'
  711. method='POST'
  712. title='Speech to Text'
  713. name='#audio'
  714. />
  715. <Row>
  716. <Col>
  717. This endpoint requires a multipart/form-data request.
  718. ### Request Body
  719. <Properties>
  720. <Property name='file' type='file' key='file'>
  721. Audio file.
  722. Supported formats: `['mp3', 'mp4', 'mpeg', 'mpga', 'm4a', 'wav', 'webm']`
  723. File size limit: 15MB
  724. </Property>
  725. <Property name='user' type='string' key='user'>
  726. User identifier, defined by the developer's rules, must be unique within the application.
  727. </Property>
  728. </Properties>
  729. ### Response
  730. - `text` (string) Output text
  731. </Col>
  732. <Col sticky>
  733. <CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}>
  734. ```bash {{ title: 'cURL' }}
  735. curl -X POST '${props.appDetail.api_base_url}/conversations/name' \
  736. --header 'Authorization: Bearer {api_key}' \
  737. --form 'file=@localfile;type=audio/mp3'
  738. ```
  739. </CodeGroup>
  740. <CodeGroup title="Response">
  741. ```json {{ text: 'hello' }}
  742. {
  743. "text": ""
  744. }
  745. ```
  746. </CodeGroup>
  747. </Col>
  748. </Row>
  749. ---
  750. <Heading
  751. url='/text-to-audio'
  752. method='POST'
  753. title='text to audio'
  754. name='#audio'
  755. />
  756. <Row>
  757. <Col>
  758. Text to speech.
  759. ### Request Body
  760. <Properties>
  761. <Property name='text' type='str' key='text'>
  762. Speech generated content。
  763. </Property>
  764. <Property name='user' type='string' key='user'>
  765. The user identifier, defined by the developer, must ensure uniqueness within the app.
  766. </Property>
  767. <Property name='streaming' type='bool' key='streaming'>
  768. Whether to enable streaming output, true、false。
  769. </Property>
  770. </Properties>
  771. </Col>
  772. <Col sticky>
  773. <CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'text=Hello Dify;user=abc-123;streaming=false`}>
  774. ```bash {{ title: 'cURL' }}
  775. curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \
  776. --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
  777. --form 'file=Hello Dify;user=abc-123;streaming=false'
  778. ```
  779. </CodeGroup>
  780. <CodeGroup title="headers">
  781. ```json {{ title: 'headers' }}
  782. {
  783. "Content-Type": "audio/wav"
  784. }
  785. ```
  786. </CodeGroup>
  787. </Col>
  788. </Row>
  789. ---
  790. <Heading
  791. url='/parameters'
  792. method='GET'
  793. title='Get Application Information'
  794. name='#parameters'
  795. />
  796. <Row>
  797. <Col>
  798. Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values.
  799. ### Query
  800. <Properties>
  801. <Property name='user' type='string' key='user'>
  802. User identifier, defined by the developer's rules, must be unique within the application.
  803. </Property>
  804. </Properties>
  805. ### Response
  806. - `opening_statement` (string) Opening statement
  807. - `suggested_questions` (array[string]) List of suggested questions for the opening
  808. - `suggested_questions_after_answer` (object) Suggest questions after enabling the answer.
  809. - `enabled` (bool) Whether it is enabled
  810. - `speech_to_text` (object) Speech to text
  811. - `enabled` (bool) Whether it is enabled
  812. - `retriever_resource` (object) Citation and Attribution
  813. - `enabled` (bool) Whether it is enabled
  814. - `annotation_reply` (object) Annotation reply
  815. - `enabled` (bool) Whether it is enabled
  816. - `user_input_form` (array[object]) User input form configuration
  817. - `text-input` (object) Text input control
  818. - `label` (string) Variable display label name
  819. - `variable` (string) Variable ID
  820. - `required` (bool) Whether it is required
  821. - `default` (string) Default value
  822. - `paragraph` (object) Paragraph text input control
  823. - `label` (string) Variable display label name
  824. - `variable` (string) Variable ID
  825. - `required` (bool) Whether it is required
  826. - `default` (string) Default value
  827. - `select` (object) Dropdown control
  828. - `label` (string) Variable display label name
  829. - `variable` (string) Variable ID
  830. - `required` (bool) Whether it is required
  831. - `default` (string) Default value
  832. - `options` (array[string]) Option values
  833. - `file_upload` (object) File upload configuration
  834. - `image` (object) Image settings
  835. Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`
  836. - `enabled` (bool) Whether it is enabled
  837. - `number_limits` (int) Image number limit, default is 3
  838. - `transfer_methods` (array[string]) List of transfer methods, remote_url, local_file, must choose one
  839. - `system_parameters` (object) System parameters
  840. - `image_file_size_limit` (string) Image file upload size limit (MB)
  841. </Col>
  842. <Col sticky>
  843. <CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters?user=abc-123'`}>
  844. ```bash {{ title: 'cURL' }}
  845. curl -X GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \
  846. --header 'Authorization: Bearer {api_key}'
  847. ```
  848. </CodeGroup>
  849. <CodeGroup title="Response">
  850. ```json {{ title: 'Response' }}
  851. {
  852. "opening_statement": "Hello!",
  853. "suggested_questions_after_answer": {
  854. "enabled": true
  855. },
  856. "speech_to_text": {
  857. "enabled": true
  858. },
  859. "retriever_resource": {
  860. "enabled": true
  861. },
  862. "annotation_reply": {
  863. "enabled": true
  864. },
  865. "user_input_form": [
  866. {
  867. "paragraph": {
  868. "label": "Query",
  869. "variable": "query",
  870. "required": true,
  871. "default": ""
  872. }
  873. }
  874. ],
  875. "file_upload": {
  876. "image": {
  877. "enabled": false,
  878. "number_limits": 3,
  879. "detail": "high",
  880. "transfer_methods": [
  881. "remote_url",
  882. "local_file"
  883. ]
  884. }
  885. },
  886. "system_parameters": {
  887. "image_file_size_limit": "10"
  888. }
  889. }
  890. ```
  891. </CodeGroup>
  892. </Col>
  893. </Row>
  894. ---
  895. <Heading
  896. url='/meta'
  897. method='GET'
  898. title='Get Application Meta Information'
  899. name='#meta'
  900. />
  901. <Row>
  902. <Col>
  903. Used to get icons of tools in this application
  904. ### Query
  905. <Properties>
  906. <Property name='user' type='string' key='user'>
  907. User identifier, defined by the developer's rules, must be unique within the application.
  908. </Property>
  909. </Properties>
  910. ### Response
  911. - `tool_icons`(object[string]) tool icons
  912. - `tool_name` (string)
  913. - `icon` (object|string)
  914. - (object) icon object
  915. - `background` (string) background color in hex format
  916. - `content`(string) emoji
  917. - (string) url of icon
  918. </Col>
  919. <Col>
  920. <CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET 'https://cloud.dify.ai/v1/meta?user=abc-123' \\\n-H 'Authorization: Bearer {api_key}'`}>
  921. ```bash {{ title: 'cURL' }}
  922. curl -X GET 'https://cloud.dify.ai/v1/meta?user=abc-123' \
  923. -H 'Authorization: Bearer {api_key}'
  924. ```
  925. </CodeGroup>
  926. <CodeGroup title="Response">
  927. ```json {{ title: 'Response' }}
  928. {
  929. "tool_icons": {
  930. "dalle2": "https://cloud.dify.ai/console/api/workspaces/current/tool-provider/builtin/dalle/icon",
  931. "api_tool": {
  932. "background": "#252525",
  933. "content": "\ud83d\ude01"
  934. }
  935. }
  936. }
  937. ```
  938. </CodeGroup>
  939. </Col>
  940. </Row>