Skip to main content

Submit Import Job

Append documents to an existing Knowledge Base.

POST
/api/v1/indices/rag/index/job/create
cURL
curl -X POST "https://{workspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/indices/rag/index/job/create" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "indexId": "your_kb_id",
    "categoryIds": ["cate_abc123"]
  }'
{
  "code": "Success",
  "status_code": 200,
  "data": {
    "updated_at": 1782191904527,
    "created_at": 1782191904527,
    "ingestionId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "pipelineId": "your_kb_id",
    "status": "PENDING"
  },
  "success": true,
  "message": "success",
  "request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "SUCCESS"
}
Appending a category imports only files currently in that category. It does not delete Knowledge Base documents removed from the category. Re-uploading a file with the same name may create a new file ID and does not automatically replace the old document.To delete a file, first delete the dataset file with deleteFile, then delete the corresponding Knowledge Base document. If you delete only the Knowledge Base document and keep the dataset file, the next category import will import it again.Passing dataSync:true when creating a Knowledge Base does not enable the console's automatic knowledge-index synchronization. Call this endpoint to append files added to a category.

Authorizations

string
header
required

DashScope API Key, obtained from the API Key page in the console.

Body

application/json
string
required

Knowledge Base ID.

string[]

List of category IDs. Required when sourceType is DATA_CENTER_CATEGORY.

enum<string>

Source type (optional). DATA_CENTER_CATEGORY imports by category (requires categoryIds); DATA_CENTER_FILE imports by file (requires docIds). If omitted, every file in the data center is imported — use with caution.

DATA_CENTER_CATEGORY,DATA_CENTER_FILE
string[]

List of file IDs. Required when sourceType is DATA_CENTER_FILE. The parameter name is docIds — not documentIds or fileIds. Using a wrong name causes the server to silently ignore the parameter and return Index.InvalidParameter (Required parameter(dataSource.fileIds) missing).

enum<string>

Chunking mode for setting a segmentation strategy for this import independently from the Knowledge Base's global config. h1–h5 chunk by heading level (h1 = level 1, up to h5 = level 5); length by fixed length; page by page; regex by custom regex.

h1,h2,h3,h4,h5,length,page,regex
integer

Chunk size (characters), range 1–6000. Required when chunkMode is length; when chunkMode is h1–h5, if specified it is taken into account (defaults to 500 if omitted).

1 <= x <= 6000
integer

Chunk overlap size (characters), range 0–1024. Only effective when chunkMode is length; ignored for heading-based chunking (h1–h5).

0 <= x <= 1024
string

Chunk separator. Only effective when chunkMode is regex; required when chunkMode is regex, otherwise returns Index.InvalidParameter (Separator can't be null).

boolean
defaultfalse

Whether to enable header extraction. Default false.

Response

200-application/json
string

Response code. Success on success.

integer

HTTP status code.

string

Unique request identifier. Include this ID when reporting an issue.

object
boolean

Whether the request succeeded.

string

Informational message; success on success.

string

Request status: SUCCESS or FAILED.