Skip to main content

Update Knowledge Base

Update the name, description, rerank minimum score, and other basic information of a Knowledge Base.

Prerequisites

Get an API key and a workspace ID, and configure authentication first. See API overview and Authentication.

Endpoint

POST /api/v1/indices/rag/index/update Update the name, description, rerank minimum score, and other basic information of a Knowledge Base. Fields such as DenseSimilarityTopK, SparseSimilarityTopK, and PipelineCommercialType are specific to POP and are not supported by the REST endpoint — do not pass them.
The parameter is id — not index_id or indexId. Watch for the naming difference compared to other endpoints.

Request body

FieldRequiredTypeDescription
idYesstringKnowledge Base ID. The parameter name is id — not index_id or indexId.
nameNostringKnowledge Base name. 1-20 characters; supports Unicode letter category characters (including English letters, Chinese characters, digits, etc.), and may contain half-width colons (:), underscores (_), half-width periods (.), or hyphens (-).
descriptionNostringKnowledge Base description.
rerankMinScoreNonumberMinimum rerank score threshold. Valid range: [0, 1]. Chunks with scores below this value are filtered out.

Wiki configuration parameters

Use this endpoint to enable or disable Wiki, or modify Wiki configuration. Enabling Wiki requires a Flagship knowledge base (enterprise) with knowledge scene basic_document_qa. For the feature and billing, see Wiki and Ontology Knowledge Graph.
FieldRequiredTypeDescription
wikiEnabledNobooleanWiki switch. Omitted or null leaves the switch unchanged; true enables, false disables. Both enabling and disabling are asynchronous
wikiAutoUpdateConditionalbooleanWiki auto-update switch. Omitted or null leaves it unchanged; only auto-update mode is supported, so it must be true; required when wikiEnabled is true
wikiConfig.extraction.synthesisModelIdConditionalstringWiki extraction model. Required when enabling; one of qwen3.8-flash, qwen3.8-max, qwen3.7-plus. When modifying an already-enabled knowledge base, omitted means unchanged; if provided it must not be blank
wikiConfig.extraction.extractionGranularityConditionalstringExtraction granularity. Required when enabling, no default; one of focused, standard, exhaustive. When modifying an already-enabled knowledge base, omitted means unchanged
wikiConfig.extraction.contentInstructionsNostringWiki content generation requirements. An empty string clears the item; omitted means unchanged; up to 4000 characters
wikiConfig.extraction.extractionInstructionsNostringWiki extraction focus. An empty string clears the item; omitted means unchanged; up to 4000 characters
When enabling Wiki, wikiConfig is required and must include the extraction group. When modifying an already-enabled knowledge base, only the provided keys change, omitted keys keep their values, Wiki is not re-enabled, and changes take effect immediately. Easy-to-get-wrong combinations (all verified): re-enable after disable requires the full wikiConfig.extraction again (the configuration is not preserved across disable), otherwise WikiConfigInvalid; passing wikiConfig without wikiEnabled on a not-enabled knowledge base succeeds but does not enable Wiki (silent no-op); passing an empty wikiConfig: {} returns BadRequest.EmptyInput — omitting all keys or passing all null means unchanged.

Request example

curl -X POST "$BASE_URL/api/v1/indices/rag/index/update" \
  -H "Authorization: Bearer $BAILIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "your-kb-id",
    "name": "your-kb-name",
    "description": "your-kb-description",
    "rerankMinScore": 0.01
  }'
BASE_URL is https://{workspace_id}.cn-beijing.maas.aliyuncs.com ({workspace_id} is the workspace ID), and BAILIAN_API_KEY is your Alibaba Cloud Model Studio API key. Modify Wiki configuration:
curl -X POST "$BASE_URL/api/v1/indices/rag/index/update" \
  -H "Authorization: Bearer $BAILIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "your-kb-id",
    "wikiConfig": {
      "extraction": {
        "synthesisModelId": "qwen3.8-max",
        "extractionGranularity": "standard",
        "contentInstructions": "Use concise English and prioritize core components and processing flows."
      }
    }
  }'
Disable Wiki:
curl -X POST "$BASE_URL/api/v1/indices/rag/index/update" \
  -H "Authorization: Bearer $BAILIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "your-kb-id",
    "wikiEnabled": false
  }'

Response example

Returns 200 on success.
{
  "code": "Success",
  "status_code": 200,
  "data": {
    "updated_at": 1782191157000,
    "created_at": 1782180218000,
    "id": "your-kb-id"
  },
  "success": true,
  "message": "success",
  "request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "SUCCESS"
}

Response fields

FieldTypeDescription
codestringResponse code. Success when successful.
status_codeintegerHTTP status code.
request_idstringUnique request identifier. Provide this ID when troubleshooting.
successbooleanWhether the request succeeded.
messagestringResponse message. success when successful.
statusstringRequest status: SUCCESS or FAILED.
dataobjectResponse data. Sub-fields: id (string, Knowledge Base ID), updated_at (integer, update time as a Unix timestamp in milliseconds), created_at (integer, creation time as a Unix timestamp in milliseconds).

Error codes

Wiki-related error codes are below; for general errors see Knowledge API error codes.
HTTP statusError code (code)Description
400Index.WikiEditionNotSupportedThe knowledge base is not Flagship when enabling; or downgrading to Standard while requesting enable
400Index.WikiSceneNotSupportedThe knowledge scene is not basic_document_qa when enabling
400Index.WikiConfigInvalidInvalid Wiki configuration key; locate by the field name in message
409Index.WikiOperationConflictRequesting disable while enabling is in progress, requesting enable while disabling is in progress, or downgrading while Wiki is being enabled
400Index.InvalidParameterwikiAutoUpdate missing or not true when enabling
400Index.BadRequest.EmptyInputwikiConfig passed as an empty object {}
Disabling Wiki deletes all generated Wiki Pages and the ontology knowledge graph in the knowledge base (including manual edits and revision history) and cannot be undone. Re-enabling requires the full configuration again, regenerates all documents with token fees, and Pages get new Page IDs starting from V1. The already-created Wiki retrieval service and its agent_id are preserved, and the original agent_id becomes usable again once re-enabling completes. See Disable Wiki.