Update Knowledge Base Settings
Changes the knowledge base’s embedding model or retrieval settings. For setting models before and after content is indexed, see Change Models or Retrieval Settings.
What happens depends on whether models are active yet:
- Before the first document is indexed, the settings are stored as pending, and the call answers
200. They are validated and take effect when the first document is indexed. Omittingembeddingorretrievalleaves that group at its pending value. - Once models are active, the call returns
202and the change runs as a migration. Poll Get Settings Migration withmigration.iduntil it ends, then read the final settings. A change that needs no migration, such as resending the active embedding model, returns200.
An embedding model change re-embeds every document. Retrieval changes, the reasoning model included, take effect without a rebuild: documents already indexed keep what the previous model built until you re-index them with Re-index Documents.
Rules:
- Send at least one of
embeddingorretrieval. Once models are active, send only one of them per call. retrievalneeds an enabled rerank model: sendrerank.enabled: trueand arerank.modelwith it.retrievalneeds an embedding model, sent in the same call or stored earlier. Otherwise the call answers409.scoreThreshold.enabled: truerequires ascoreThreshold.value.
curl --request PATCH \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"embedding": {
"model": "text-embedding-3-small",
"pluginId": "langgenius/openai",
"provider": "openai"
},
"expectedRevision": 7,
"retrieval": {
"defaultMode": "fast",
"reasoningModel": {
"model": "gpt-4.1-mini",
"pluginId": "langgenius/openai",
"provider": "openai"
},
"rerank": {
"enabled": true,
"model": {
"model": "rerank-v3.5",
"pluginId": "langgenius/cohere",
"provider": "cohere"
}
},
"scoreThreshold": {
"enabled": true,
"stage": "mode-final",
"value": 0.4
},
"topK": 10
}
}
'{
"migration": null,
"settings": {
"active_profile_available": false,
"active_profile_revisions": {
"embedding": null,
"retrieval": null
},
"capabilities": {
"deep": false,
"index": false,
"ingest": true,
"query": false,
"research": false,
"source_sync": true
},
"configuration_state": "active",
"embedding": {
"dimension": null,
"model": "text-embedding-3-small",
"plugin_id": "langgenius/openai",
"provider": "openai",
"revision": null,
"vector_space_id": null
},
"issues": [],
"retrieval": {
"default_mode": "fast",
"reasoning_model": {
"dimension": null,
"model": "gpt-4.1-mini",
"plugin_id": "langgenius/openai",
"provider": "openai",
"revision": null,
"vector_space_id": null
},
"rerank": {
"enabled": true,
"model": {
"model": "rerank-v3.5",
"pluginId": "langgenius/cohere",
"provider": "cohere"
}
},
"revision": null,
"score_threshold": {
"enabled": true,
"stage": "mode-final",
"value": 0.4
},
"top_k": 10
},
"revision": 8
}
}Authorizations
Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).
Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).
Path Parameters
Knowledge base ID: the last segment of the Service API endpoint shown in the knowledge base's API Access dialog (…/knowledge-fs/spaces/<knowledge base ID>), and the segment after /datasets/new/ in the address bar.
Body
Get Knowledge Base Settings answers in snake_case and this body is camelCase, so its response cannot be sent back unchanged.
Optional fields marked nullable treat null as omitted.
- Embedding Settings
- Retrieval Settings
The embedding model used to index content. Once a model is active, changing it starts a migration that re-embeds every document.
Find the values with Get Available Models: text-embedding for embedding models, llm for the reasoning model, rerank for rerank models.
pluginId is the plugin's organization/plugin_name, provider its provider name, model the model name.
Get Available Models returns one provider string shaped organization/plugin_name/provider_name, so langgenius/openai/openai splits into pluginId langgenius/openai and provider openai. A bare openai stands for langgenius/openai/openai.
Show child attributes
Show child attributes
The current revision from Get Knowledge Base Settings. A stale value answers 409 and nothing changes.
x >= 1The retrieval settings a query uses: reasoning model, rerank model, score threshold, topK, and the depth to fall back on.
Show child attributes
Show child attributes
Response
No migration started: the settings were stored as pending, or models are active and the change needed no migration. settings has the same shape as Get Knowledge Base Settings, and its revision is the value to send on the next update. While the settings are pending, active_profile_available stays false and capabilities.query stays false.
Was this page helpful?
curl --request PATCH \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"embedding": {
"model": "text-embedding-3-small",
"pluginId": "langgenius/openai",
"provider": "openai"
},
"expectedRevision": 7,
"retrieval": {
"defaultMode": "fast",
"reasoningModel": {
"model": "gpt-4.1-mini",
"pluginId": "langgenius/openai",
"provider": "openai"
},
"rerank": {
"enabled": true,
"model": {
"model": "rerank-v3.5",
"pluginId": "langgenius/cohere",
"provider": "cohere"
}
},
"scoreThreshold": {
"enabled": true,
"stage": "mode-final",
"value": 0.4
},
"topK": 10
}
}
'{
"migration": null,
"settings": {
"active_profile_available": false,
"active_profile_revisions": {
"embedding": null,
"retrieval": null
},
"capabilities": {
"deep": false,
"index": false,
"ingest": true,
"query": false,
"research": false,
"source_sync": true
},
"configuration_state": "active",
"embedding": {
"dimension": null,
"model": "text-embedding-3-small",
"plugin_id": "langgenius/openai",
"provider": "openai",
"revision": null,
"vector_space_id": null
},
"issues": [],
"retrieval": {
"default_mode": "fast",
"reasoning_model": {
"dimension": null,
"model": "gpt-4.1-mini",
"plugin_id": "langgenius/openai",
"provider": "openai",
"revision": null,
"vector_space_id": null
},
"rerank": {
"enabled": true,
"model": {
"model": "rerank-v3.5",
"pluginId": "langgenius/cohere",
"provider": "cohere"
}
},
"revision": null,
"score_threshold": {
"enabled": true,
"stage": "mode-final",
"value": 0.4
},
"top_k": 10
},
"revision": 8
}
}