All Products
Search
Document Center

:Batch upload knowledge base files

Last Updated:Mar 27, 2026

Use this OpenAPI operation to upload multiple files to a knowledge base.

Supported editions

Enterprise Dedicated Edition

Service endpoints

Get the service endpoint and replace {domain} in the API request syntax with your endpoint .

Authorization information

Product

Resource

Required permissions

Lingma

knowledge base file

read/write

Request syntax

POST https://{domain}/oapi/v1/lingma/organizations/{organizationId}/knowledgeBases/{kbId}/files/batchUpload

Request

Example

curl -X 'POST' \
  'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/lingma/organizations/99d1****71d4/knowledgeBases/1f23ea7459c45e1f04c3****/files/batchUpload' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --form 'files=@"/D:/lingma/file1.md"' \
  --form 'files=@"/D:/lingma/file2.md"'

Request headers

x-yunxiao-token string (Required)

The access token. See Access token for details.

Example: pt-0fh3****0fbG_35af****0484.

Request parameters

organizationId string (Required)

The organization ID. You can obtain the ID from the Basic Information page in the organization management console.

kbId string (Required)

The knowledge base ID. You can obtain this ID by calling the ListKnowledgeBases operation.

files array[File] (Required)

The files to upload to the knowledge base.

  • Supported formats: PDF, CSV, DOCX, TXT, and Markdown.

  • A single request can contain up to 10 files. Each file cannot exceed 10 MB.

  • File names must not exceed 200 characters.

Response

Example

[
    {
        "fileId": "aefb0ce3924fc778260cc274",
        "operateUserId": "bf2fce4f-7048-4017-a734-1c346e68****",
        "success": true
    },
    {
        "fileId": "51b47ec207ed09ee2ee288a5",
        "operateUserId": "bf2fce4f-7048-4017-a734-1c346e68****",
        "success": true
    }
]

fileId string

The file ID.

operateUserId string

The ID of the operator.

success boolean

Indicates whether the individual file was uploaded successfully.

  • true: The upload succeeded.

  • false: The upload failed.

failedMessage string

The error message. This parameter is returned only when success is false.

Error codes

For more information, see Error codes.