VocalDocscontracts 1.65.0

Publish the working set as a new version

POST /v1/knowledge-bases/{knowledge_base_id}/versions

PropertyValue
Operationpublish_knowledge_base_version
GroupKnowledge bases
Scopeknowledge:write
Route classcontrol
IdempotencyIdempotency-Key accepted: a retry with the same key replays the first answer
AuditAudited knowledge.version.publish (mutation)
Released in1.53.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Freezes the configuration of the draft that If-Match names and a manifest of the latest indexed revision of every Document as the next version (1.53.0; knowledge-bases.md section 9). It refuses with one 422 validation_failed listing every issue (KnowledgePublishIssueCode): a pending Document unless exclude_pending is set, no indexed Document, an embedding space the Organization may not use, or a failed retrieval-quality gate. With activate the version becomes the active one. It emits the Webhook event knowledge_base.version.published. From the second part of the slice the version takes the gate of the Evaluation evaluation_id names, or of the newest current Evaluation of the working set: needed whenever the corpus holds a query (knowledge_evaluation_required), a failed gate refused with one retrieval_gate_failed per failing check, and not_run only with an empty corpus.

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" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H 'If-Match: "1"' \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'

Parameters

NameInTypeRequiredDescription
knowledge_base_idpathKnowledgeBaseIdyesThe id of a Knowledge base: kb_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log.
if-matchheaderstringyesThe revision the change was made against, quoted as the ETag returns it, or * to overwrite.
idempotency-keyheaderstringnoA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Request body

Content type application/json, required: KnowledgeBaseVersionPublishRequest.

FieldTypeRequiredDescription
activatebooleannoMake the new version the active one; false when omitted.
evaluation_idKnowledgeEvaluationIdnoThe completed Evaluation of the working set whose gate the version takes (1.53.0, second part); the newest current one when omitted. Needed whenever the corpus holds a query.
exclude_pendingbooleannoPublish without the Documents still pending, which the version lists, instead of refusing; false when omitted.
notesstringnoWhy this version exists.

Responses

StatusContent typeShapeError codes
201application/jsonKnowledgeBaseVersion
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden, org_suspended
404application/jsonErrorEnvelopenot_found
409application/jsonErrorEnvelopeknowledge_base_archived, idempotency_in_progress, idempotency_key_reused
412application/jsonErrorEnveloperevision_mismatch
422application/jsonErrorEnvelopevalidation_failed
428application/jsonErrorEnvelopeprecondition_required
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 201 answer

The shape is KnowledgeBaseVersion.

FieldTypeRequiredDescription
activebooleanyesTrue for the active version, the one bindings that track active resolve at dispatch.
chunk_countintegeryes
configKnowledgeBaseConfigyes
config_sha256stringyesThe SHA-256 of the canonical configuration, in lowercase hex.
document_countintegeryes
evaluation_idKnowledgeEvaluationId or nullyesThe Evaluation the gate read, or null when none ran.
excluded_document_countintegeryesThe pending Documents exclude_pending left out; 0 when it was not set.
excluded_document_idsarray of KnowledgeDocumentIdyesThe first 100 of them (a target), in id order.
gateKnowledgeGateOutcomeyes
knowledge_base_idKnowledgeBaseIdyes
notesstring or nullyes
object"knowledge_base_version"yes
published_atTimestampyes
published_byActorRef or nullyesWho published it; null when auto_publish published it after an Ingestion run.
retired_atTimestamp or nullyes
source_revisionintegeryesThe draft revision whose configuration the version froze.
statusKnowledgeBaseVersionStatusyes
versionintegeryesThe snapshot number, from 1.