Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. ---
  2. sidebar_position: 1
  3. slug: /api
  4. ---
  5. # API reference
  6. RAGFlow offers RESTful APIs for you to integrate its capabilities into third-party applications.
  7. ## Base URL
  8. ```
  9. https://demo.ragflow.io/v1/
  10. ```
  11. ## Authorization
  12. All of RAGFlow's RESTFul APIs use API key for authorization, so keep it safe and do not expose it to the front end.
  13. Put your API key in the request header.
  14. ```buildoutcfg
  15. Authorization: Bearer {API_KEY}
  16. ```
  17. To get your API key:
  18. 1. In RAGFlow, click **Chat** tab in the middle top of the page.
  19. 2. Hover over the corresponding dialogue **>** **Chat Bot API** to show the chatbot API configuration page.
  20. 3. Click **Api Key** **>** **Create new key** to create your API key.
  21. 4. Copy and keep your API key safe.
  22. ## Create conversation
  23. This method creates (news) a conversation for a specific user.
  24. ### Request
  25. #### Request URI
  26. | Method | Request URI |
  27. |----------|-------------------------------------------------------------|
  28. | GET | `/api/new_conversation` |
  29. :::note
  30. You are *required* to save the `data.id` value returned in the response data, which is the session ID for all upcoming conversations.
  31. :::
  32. #### Request parameter
  33. | Name | Type | Required | Description |
  34. |----------|--------|----------|-------------------------------------------------------------|
  35. | `user_id`| string | Yes | The unique identifier assigned to each user. `user_id` must be less than 32 characters and cannot be empty. The following character sets are supported: <br />- 26 lowercase English letters (a-z)<br />- 26 uppercase English letters (A-Z)<br />- 10 digits (0-9)<br />- "_", "-", "." |
  36. ### Response
  37. ```json
  38. {
  39. "data": {
  40. "create_date": "Fri, 12 Apr 2024 17:26:21 GMT",
  41. "create_time": 1712913981857,
  42. "dialog_id": "4f0a2e4cb9af11ee9ba20aef05f5e94f",
  43. "duration": 0.0,
  44. "id": "b9b2e098f8ae11ee9f45fa163e197198",
  45. "message": [
  46. {
  47. "content": "Hi, I'm your assistant, what can I do for you?",
  48. "role": "assistant"
  49. }
  50. ],
  51. "reference": [],
  52. "tokens": 0,
  53. "update_date": "Fri, 12 Apr 2024 17:26:21 GMT",
  54. "update_time": 1712913981857,
  55. "user_id": "<USER_ID_SET_BY_THE_CALLER>"
  56. },
  57. "retcode": 0,
  58. "retmsg": "success"
  59. }
  60. ```
  61. ## Get conversation history
  62. This method retrieves the history of a specified conversation session.
  63. ### Request
  64. #### Request URI
  65. | Method | Request URI |
  66. |----------|-------------------------------------------------------------|
  67. | GET | `/api/conversation/<id>` |
  68. #### Request parameter
  69. | Name | Type | Required | Description |
  70. |----------|--------|----------|-------------------------------------------------------------|
  71. | `id` | string | Yes | The unique identifier assigned to a conversation session. `id` must be less than 32 characters and cannot be empty. The following character sets are supported: <br />- 26 lowercase English letters (a-z)<br />- 26 uppercase English letters (A-Z)<br />- 10 digits (0-9)<br />- "_", "-", "." |
  72. ### Response
  73. #### Response parameter
  74. - `message`: All conversations in the specified conversation session.
  75. - `role`: `"user"` or `"assistant"`.
  76. - `content`: The text content of user or assistant. The citations are in a format like `##0$$`. The number in the middle, 0 in this case, indicates which part in data.reference.chunks it refers to.
  77. - `user_id`: This is set by the caller.
  78. - `reference`: Each reference corresponds to one of the assistant's answers in `data.message`.
  79. - `chunks`
  80. - `content_with_weight`: Content of the chunk.
  81. - `doc_name`: Name of the *hit* document.
  82. - `img_id`: The image ID of the chunk. It is an optional field only for PDF, PPTX, and images. Call ['GET' /document/get/\<id\>](#get-document-content) to retrieve the image.
  83. - `positions`: [page_number, [upleft corner(x, y)], [right bottom(x, y)]], the chunk position, only for PDF.
  84. - `similarity`: The hybrid similarity.
  85. - `term_similarity`: The keyword simimlarity.
  86. - `vector_similarity`: The embedding similarity.
  87. - `doc_aggs`:
  88. - `doc_id`: ID of the *hit* document. Call ['GET' /document/get/\<id\>](#get-document-content) to retrieve the document.
  89. - `doc_name`: Name of the *hit* document.
  90. - `count`: The number of *hit* chunks in this document.
  91. ```json
  92. {
  93. "data": {
  94. "create_date": "Mon, 01 Apr 2024 09:28:42 GMT",
  95. "create_time": 1711934922220,
  96. "dialog_id": "df4a4916d7bd11eeaa650242ac180006",
  97. "id": "2cae30fcefc711ee94140242ac180006",
  98. "message": [
  99. {
  100. "content": "Hi! I'm your assistant, what can I do for you?",
  101. "role": "assistant"
  102. },
  103. {
  104. "content": "What's the vit score for GPT-4?",
  105. "role": "user"
  106. },
  107. {
  108. "content": "The ViT Score for GPT-4 in the zero-shot scenario is 0.5058, and in the few-shot scenario, it is 0.6480. ##0$$",
  109. "role": "assistant"
  110. }
  111. ],
  112. "user_id": "<USER_ID_SET_BY_THE_CALLER>",
  113. "reference": [
  114. {
  115. "chunks": [
  116. {
  117. "chunk_id": "d0bc7892c3ec4aeac071544fd56730a8",
  118. "content_ltks": "tabl 1:openagi task-solv perform under differ set for three closed-sourc llm . boldfac denot the highest score under each learn schema . metric gpt-3.5-turbo claude-2 gpt-4 zero few zero few zero few clip score 0.0 0.0 0.0 0.2543 0.0 0.3055 bert score 0.1914 0.3820 0.2111 0.5038 0.2076 0.6307 vit score 0.2437 0.7497 0.4082 0.5416 0.5058 0.6480 overal 0.1450 0.3772 0.2064 0.4332 0.2378 0.5281",
  119. "content_with_weight": "<table><caption>Table 1: OpenAGI task-solving performances under different settings for three closed-source LLMs. Boldface denotes the highest score under each learning schema.</caption>\n<tr><th rowspan=2 >Metrics</th><th >GPT-3.5-turbo</th><th></th><th >Claude-2</th><th >GPT-4</th></tr>\n<tr><th >Zero</th><th >Few</th><th >Zero Few</th><th >Zero Few</th></tr>\n<tr><td >CLIP Score</td><td >0.0</td><td >0.0</td><td >0.0 0.2543</td><td >0.0 0.3055</td></tr>\n<tr><td >BERT Score</td><td >0.1914</td><td >0.3820</td><td >0.2111 0.5038</td><td >0.2076 0.6307</td></tr>\n<tr><td >ViT Score</td><td >0.2437</td><td >0.7497</td><td >0.4082 0.5416</td><td >0.5058 0.6480</td></tr>\n<tr><td >Overall</td><td >0.1450</td><td >0.3772</td><td >0.2064 0.4332</td><td >0.2378 0.5281</td></tr>\n</table>",
  120. "doc_id": "c790da40ea8911ee928e0242ac180005",
  121. "doc_name": "OpenAGI When LLM Meets Domain Experts.pdf",
  122. "img_id": "afab9fdad6e511eebdb20242ac180006-d0bc7892c3ec4aeac071544fd56730a8",
  123. "important_kwd": [],
  124. "kb_id": "afab9fdad6e511eebdb20242ac180006",
  125. "positions": [
  126. [
  127. 9.0,
  128. 159.9383341471354,
  129. 472.1773274739583,
  130. 223.58013916015625,
  131. 307.86692301432294
  132. ]
  133. ],
  134. "similarity": 0.7310340654129031,
  135. "term_similarity": 0.7671974387781668,
  136. "vector_similarity": 0.40556370512552886
  137. },
  138. {
  139. "chunk_id": "7e2345d440383b756670e1b0f43a7007",
  140. "content_ltks": "5.5 experiment analysi the main experiment result are tabul in tab . 1 and 2 , showcas the result for closed-sourc and open-sourc llm , respect . the overal perform is calcul a the averag of cllp 8 bert and vit score . ",
  141. "content_with_weight": "5.5 Experimental Analysis\nThe main experimental results are tabulated in Tab. 1 and 2, showcasing the results for closed-source and open-source LLMs, respectively. The overall performance is calculated as the average of CLlP\n8\nBERT and ViT scores.",
  142. "doc_id": "c790da40ea8911ee928e0242ac180005",
  143. "doc_name": "OpenAGI When LLM Meets Domain Experts.pdf",
  144. "img_id": "afab9fdad6e511eebdb20242ac180006-7e2345d440383b756670e1b0f43a7007",
  145. "important_kwd": [],
  146. "kb_id": "afab9fdad6e511eebdb20242ac180006",
  147. "positions": [
  148. [
  149. 8.0,
  150. 107.3,
  151. 508.90000000000003,
  152. 686.3,
  153. 697.0
  154. ],
  155. ],
  156. "similarity": 0.6691508616357027,
  157. "term_similarity": 0.6999011754270821,
  158. "vector_similarity": 0.39239803751328806
  159. },
  160. ],
  161. "doc_aggs": [
  162. {
  163. "count": 8,
  164. "doc_id": "c790da40ea8911ee928e0242ac180005",
  165. "doc_name": "OpenAGI When LLM Meets Domain Experts.pdf"
  166. }
  167. ],
  168. "total": 8
  169. },
  170. ],
  171. "update_date": "Tue, 02 Apr 2024 09:07:49 GMT",
  172. "update_time": 1712020069421
  173. },
  174. "retcode": 0,
  175. "retmsg": "success"
  176. }
  177. ```
  178. ## Get answer
  179. This method retrieves from RAGFlow the answer to the user's latest question.
  180. ### Request
  181. #### Request URI
  182. | Method | Request URI |
  183. |----------|-------------------------------------------------------------|
  184. | POST | `/api/completion` |
  185. #### Request parameter
  186. | Name | Type | Required | Description |
  187. |------------------|--------|----------|---------------|
  188. | `conversation_id`| string | Yes | The ID of the conversation session. Call ['GET' /new_conversation](#create-conversation) to retrieve the ID.|
  189. | `messages` | json | Yes | The latest question in a JSON form, such as `[{"role": "user", "content": "How are you doing!"}]`|
  190. | `quote` | bool | No | Default: true |
  191. | `stream` | bool | No | Default: true |
  192. | `doc_ids` | string | No | Document IDs delimited by comma, like `c790da40ea8911ee928e0242ac180005,23dsf34ree928e0242ac180005`. The retrieved contents will be confined to these documents. |
  193. ### Response
  194. - `answer`: The answer to the user's latest question.
  195. - `reference`:
  196. - `chunks`: The retrieved chunks that contribute to the answer.
  197. - `content_with_weight`: Content of the chunk.
  198. - `doc_name`: Name of the *hit* document.
  199. - `img_id`: The image ID of the chunk. It is an optional field only for PDF, PPTX, and images. Call ['GET' /document/get/\<id\>](#get-document-content) to retrieve the image.
  200. - `positions`: [page_number, [upleft corner(x, y)], [right bottom(x, y)]], the chunk position, only for PDF.
  201. - `similarity`: The hybrid similarity.
  202. - `term_similarity`: The keyword simimlarity.
  203. - `vector_similarity`: The embedding similarity.
  204. - `doc_aggs`:
  205. - `doc_id`: ID of the *hit* document. Call ['GET' /document/get/\<id\>](#get-document-content) to retrieve the document.
  206. - `doc_name`: Name of the *hit* document.
  207. - `count`: The number of *hit* chunks in this document.
  208. ```json
  209. {
  210. "data": {
  211. "answer": "The ViT Score for GPT-4 in the zero-shot scenario is 0.5058, and in the few-shot scenario, it is 0.6480. ##0$$",
  212. "reference": {
  213. "chunks": [
  214. {
  215. "chunk_id": "d0bc7892c3ec4aeac071544fd56730a8",
  216. "content_ltks": "tabl 1:openagi task-solv perform under differ set for three closed-sourc llm . boldfac denot the highest score under each learn schema . metric gpt-3.5-turbo claude-2 gpt-4 zero few zero few zero few clip score 0.0 0.0 0.0 0.2543 0.0 0.3055 bert score 0.1914 0.3820 0.2111 0.5038 0.2076 0.6307 vit score 0.2437 0.7497 0.4082 0.5416 0.5058 0.6480 overal 0.1450 0.3772 0.2064 0.4332 0.2378 0.5281",
  217. "content_with_weight": "<table><caption>Table 1: OpenAGI task-solving performances under different settings for three closed-source LLMs. Boldface denotes the highest score under each learning schema.</caption>\n<tr><th rowspan=2 >Metrics</th><th >GPT-3.5-turbo</th><th></th><th >Claude-2</th><th >GPT-4</th></tr>\n<tr><th >Zero</th><th >Few</th><th >Zero Few</th><th >Zero Few</th></tr>\n<tr><td >CLIP Score</td><td >0.0</td><td >0.0</td><td >0.0 0.2543</td><td >0.0 0.3055</td></tr>\n<tr><td >BERT Score</td><td >0.1914</td><td >0.3820</td><td >0.2111 0.5038</td><td >0.2076 0.6307</td></tr>\n<tr><td >ViT Score</td><td >0.2437</td><td >0.7497</td><td >0.4082 0.5416</td><td >0.5058 0.6480</td></tr>\n<tr><td >Overall</td><td >0.1450</td><td >0.3772</td><td >0.2064 0.4332</td><td >0.2378 0.5281</td></tr>\n</table>",
  218. "doc_id": "c790da40ea8911ee928e0242ac180005",
  219. "doc_name": "OpenAGI When LLM Meets Domain Experts.pdf",
  220. "img_id": "afab9fdad6e511eebdb20242ac180006-d0bc7892c3ec4aeac071544fd56730a8",
  221. "important_kwd": [],
  222. "kb_id": "afab9fdad6e511eebdb20242ac180006",
  223. "positions": [
  224. [
  225. 9.0,
  226. 159.9383341471354,
  227. 472.1773274739583,
  228. 223.58013916015625,
  229. 307.86692301432294
  230. ]
  231. ],
  232. "similarity": 0.7310340654129031,
  233. "term_similarity": 0.7671974387781668,
  234. "vector_similarity": 0.40556370512552886
  235. },
  236. {
  237. "chunk_id": "7e2345d440383b756670e1b0f43a7007",
  238. "content_ltks": "5.5 experiment analysi the main experiment result are tabul in tab . 1 and 2 , showcas the result for closed-sourc and open-sourc llm , respect . the overal perform is calcul a the averag of cllp 8 bert and vit score . here , onli the task descript of the benchmark task are fed into llm(addit inform , such a the input prompt and llm\u2019output , is provid in fig . a.4 and a.5 in supplementari). broadli speak , closed-sourc llm demonstr superior perform on openagi task , with gpt-4 lead the pack under both zero-and few-shot scenario . in the open-sourc categori , llama-2-13b take the lead , consist post top result across variou learn schema--the perform possibl influenc by it larger model size . notabl , open-sourc llm significantli benefit from the tune method , particularli fine-tun and\u2019rltf . these method mark notic enhanc for flan-t5-larg , vicuna-7b , and llama-2-13b when compar with zero-shot and few-shot learn schema . in fact , each of these open-sourc model hit it pinnacl under the rltf approach . conclus , with rltf tune , the perform of llama-2-13b approach that of gpt-3.5 , illustr it potenti .",
  239. "content_with_weight": "5.5 Experimental Analysis\nThe main experimental results are tabulated in Tab. 1 and 2, showcasing the results for closed-source and open-source LLMs, respectively. The overall performance is calculated as the average of CLlP\n8\nBERT and ViT scores. Here, only the task descriptions of the benchmark tasks are fed into LLMs (additional information, such as the input prompt and LLMs\u2019 outputs, is provided in Fig. A.4 and A.5 in supplementary). Broadly speaking, closed-source LLMs demonstrate superior performance on OpenAGI tasks, with GPT-4 leading the pack under both zero- and few-shot scenarios. In the open-source category, LLaMA-2-13B takes the lead, consistently posting top results across various learning schema--the performance possibly influenced by its larger model size. Notably, open-source LLMs significantly benefit from the tuning methods, particularly Fine-tuning and\u2019 RLTF. These methods mark noticeable enhancements for Flan-T5-Large, Vicuna-7B, and LLaMA-2-13B when compared with zero-shot and few-shot learning schema. In fact, each of these open-source models hits its pinnacle under the RLTF approach. Conclusively, with RLTF tuning, the performance of LLaMA-2-13B approaches that of GPT-3.5, illustrating its potential.",
  240. "doc_id": "c790da40ea8911ee928e0242ac180005",
  241. "doc_name": "OpenAGI When LLM Meets Domain Experts.pdf",
  242. "img_id": "afab9fdad6e511eebdb20242ac180006-7e2345d440383b756670e1b0f43a7007",
  243. "important_kwd": [],
  244. "kb_id": "afab9fdad6e511eebdb20242ac180006",
  245. "positions": [
  246. [
  247. 8.0,
  248. 107.3,
  249. 508.90000000000003,
  250. 686.3,
  251. 697.0
  252. ]
  253. ],
  254. "similarity": 0.6691508616357027,
  255. "term_similarity": 0.6999011754270821,
  256. "vector_similarity": 0.39239803751328806
  257. }
  258. ],
  259. "doc_aggs": {
  260. "OpenAGI When LLM Meets Domain Experts.pdf": 4
  261. },
  262. "total": 8
  263. }
  264. },
  265. "retcode": 0,
  266. "retmsg": "success"
  267. }
  268. ```
  269. ## Get document content
  270. This method retrieves the content of a document.
  271. ### Request
  272. #### Request URI
  273. | Method | Request URI |
  274. |----------|-------------------------------------------------------------|
  275. | GET | `/document/get/<id>` |
  276. ### Response
  277. A binary file.
  278. ## Upload file
  279. This method uploads a specific file to a specified knowledge base.
  280. ### Request
  281. #### Request URI
  282. | Method | Request URI |
  283. |----------|-------------------------------------------------------------|
  284. | POST | `/api/document/upload` |
  285. #### Response parameter
  286. | Name | Type | Required | Description |
  287. |-------------|--------|----------|---------------------------------------------------------|
  288. | `file` | file | Yes | The file to upload. |
  289. | `kb_name` | string | Yes | The name of the knowledge base to upload the file to. |
  290. | `parser_id` | string | No | The parsing method (chunk template) to use. <br />- "naive": General;<br />- "qa": Q&A;<br />- "manual": Manual;<br />- "table": Table;<br />- "paper": Paper;<br />- "laws": Laws;<br />- "presentation": Presentation;<br />- "picture": Picture;<br />- "one": One. |
  291. | `run` | string | No | 1: Automatically start file parsing. If `parser_id` is not set, RAGFlow uses the general template by default. |
  292. ### Response
  293. ```json
  294. {
  295. "data": {
  296. "chunk_num": 0,
  297. "create_date": "Thu, 25 Apr 2024 14:30:06 GMT",
  298. "create_time": 1714026606921,
  299. "created_by": "553ec818fd5711ee8ea63043d7ed348e",
  300. "id": "41e9324602cd11ef9f5f3043d7ed348e",
  301. "kb_id": "06802686c0a311ee85d6246e9694c130",
  302. "location": "readme.txt",
  303. "name": "readme.txt",
  304. "parser_config": {
  305. "field_map": {
  306. },
  307. "pages": [
  308. [
  309. 0,
  310. 1000000
  311. ]
  312. ]
  313. },
  314. "parser_id": "general",
  315. "process_begin_at": null,
  316. "process_duation": 0.0,
  317. "progress": 0.0,
  318. "progress_msg": "",
  319. "run": "0",
  320. "size": 929,
  321. "source_type": "local",
  322. "status": "1",
  323. "thumbnail": null,
  324. "token_num": 0,
  325. "type": "doc",
  326. "update_date": "Thu, 25 Apr 2024 14:30:06 GMT",
  327. "update_time": 1714026606921
  328. },
  329. "retcode": 0,
  330. "retmsg": "success"
  331. }
  332. ```
  333. ## Get document chunks
  334. This method retrieves the chunks of a specific document by `doc_name` or `doc_id`.
  335. ### Request
  336. #### Request URI
  337. | Method | Request URI |
  338. |----------|-------------------------------------------------------------|
  339. | GET | `/api/list_chunks` |
  340. #### Request parameter
  341. | Name | Type | Required | Description |
  342. |------------|--------|----------|---------------------------------------------------------------------------------------------|
  343. | `doc_name` | string | No | The name of the document in the knowledge base. It must not be empty if `doc_id` is not set.|
  344. | `doc_id` | string | No | The ID of the document in the knowledge base. It must not be empty if `doc_name` is not set.|
  345. ### Response
  346. ```json
  347. {
  348. "data": [
  349. {
  350. "content": "Figure 14: Per-request neural-net processingof RL-Cache.\n103\n(sn)\nCPU\n 102\nGPU\n8101\n100\n8\n16 64 256 1K\n4K",
  351. "doc_name": "RL-Cache.pdf",
  352. "img_id": "0335167613f011ef91240242ac120006-b46c3524952f82dbe061ce9b123f2211"
  353. },
  354. {
  355. "content": "4.3 ProcessingOverheadof RL-CacheACKNOWLEDGMENTSThis section evaluates how effectively our RL-Cache implemen-tation leverages modern multi-core CPUs and GPUs to keep the per-request neural-net processing overhead low. Figure 14 depictsThis researchwas supported inpart by the Regional Government of Madrid (grant P2018/TCS-4499, EdgeData-CM)andU.S. National Science Foundation (grants CNS-1763617 andCNS-1717179).REFERENCES",
  356. "doc_name": "RL-Cache.pdf",
  357. "img_id": "0335167613f011ef91240242ac120006-d4c12c43938eb55d2d8278eea0d7e6d7"
  358. }
  359. ],
  360. "retcode": 0,
  361. "retmsg": "success"
  362. }
  363. ```
  364. ## Get document list
  365. This method retrieves a list of documents from a specified knowledge base.
  366. ### Request
  367. #### Request URI
  368. | Method | Request URI |
  369. |----------|-------------------------------------------------------------|
  370. | POST | `/api/list_kb_docs` |
  371. #### Request parameter
  372. | Name | Type | Required | Description |
  373. |-------------|--------|----------|-----------------------------------------------------------------------|
  374. | `kb_name` | string | Yes | The name of the knowledge base, from which you get the document list. |
  375. | `page` | int | No | The number of pages, default:1. |
  376. | `page_size` | int | No | The number of docs for each page, default:15. |
  377. | `orderby` | string | No | `chunk_num`, `create_time`, or `size`, default:`create_time` |
  378. | `desc` | bool | No | Default:True. |
  379. | `keywords` | string | No | Keyword of the document name. |
  380. ### Response
  381. ```json
  382. {
  383. "data": {
  384. "docs": [
  385. {
  386. "doc_id": "bad89a84168c11ef9ce40242ac120006",
  387. "doc_name": "test.xlsx"
  388. },
  389. {
  390. "doc_id": "641a9b4013f111efb53f0242ac120006",
  391. "doc_name": "1111.pdf"
  392. }
  393. ],
  394. "total": 2
  395. },
  396. "retcode": 0,
  397. "retmsg": "success"
  398. }
  399. ```
  400. ## Delete documents
  401. This method deletes documents by document ID or name.
  402. ### Request
  403. #### Request URI
  404. | Method | Request URI |
  405. |----------|-------------------------------------------------------------|
  406. | DELETE | `/api/document` |
  407. #### Request parameter
  408. | Name | Type | Required | Description |
  409. |-------------|--------|----------|----------------------------|
  410. | `doc_names` | List | No | A list of document names. It must not be empty if `doc_ids` is not set. |
  411. | `doc_ids` | List | No | A list of document IDs. It must not be empty if `doc_names` is not set. |
  412. ### Response
  413. ```json
  414. {
  415. "data": true,
  416. "retcode": 0,
  417. "retmsg": "success"
  418. }
  419. ```