Activate a Knowledge base version
POST /v1/knowledge-bases/{knowledge_base_id}/versions/{version}/activate
| Property | Value |
|---|---|
| Operation | activate_knowledge_base_version |
| Group | Knowledge bases |
| Scope | knowledge:write |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Audited knowledge.version.activate (mutation) |
| Released in | 1.53.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Makes the version the active one and answers it (1.53.0): bindings that track active resolve it from the next dispatch, and Calls in progress keep the version they resolved. Activating an older version is the rollback. A retired version is refused with 409 knowledge_base_version_retired.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the knowledge:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X POST "$VOCAL_API/v1/knowledge-bases/kb_.../versions/1/activate" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"const response = await fetch(`${process.env.VOCAL_API}/v1/knowledge-bases/kb_.../versions/1/activate`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
},
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/knowledge-bases/kb_.../versions/1/activate",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
knowledge_base_id | path | KnowledgeBaseId | yes | The id of a Knowledge base: kb_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
version | path | integer | yes | A version number, from 1. |
idempotency-key | header | string | no | A client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | KnowledgeBaseVersion | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | idempotency_in_progress, idempotency_key_reused, knowledge_base_archived, knowledge_base_version_retired |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is KnowledgeBaseVersion.
| Field | Type | Required | Description |
|---|---|---|---|
active | boolean | yes | True for the active version, the one bindings that track active resolve at dispatch. |
chunk_count | integer | yes | |
config | KnowledgeBaseConfig | yes | |
config_sha256 | string | yes | The SHA-256 of the canonical configuration, in lowercase hex. |
document_count | integer | yes | |
evaluation_id | KnowledgeEvaluationId or null | yes | The Evaluation the gate read, or null when none ran. |
excluded_document_count | integer | yes | The pending Documents exclude_pending left out; 0 when it was not set. |
excluded_document_ids | array of KnowledgeDocumentId | yes | The first 100 of them (a target), in id order. |
gate | KnowledgeGateOutcome | yes | |
knowledge_base_id | KnowledgeBaseId | yes | |
notes | string or null | yes | |
object | "knowledge_base_version" | yes | |
published_at | Timestamp | yes | |
published_by | ActorRef or null | yes | Who published it; null when auto_publish published it after an Ingestion run. |
retired_at | Timestamp or null | yes | |
source_revision | integer | yes | The draft revision whose configuration the version froze. |
status | KnowledgeBaseVersionStatus | yes | |
version | integer | yes | The snapshot number, from 1. |