VocalDocscontracts 1.65.0

Purge a Document from every version

POST /v1/knowledge-bases/{knowledge_base_id}/documents/{document_id}/purge

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

Removes the Chunks and vectors of every revision of the Document from every version at once, and its stored file, at the revision If-Match names (1.53.0; knowledge-bases.md section 9), for content that must not be served or kept; the affected versions keep working without it. Answers the Document removed with purged_at; a purged Document answers unchanged. The one operation that overrides the immutability of versions, accepted on an archived Knowledge base too.

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_.../documents/kdoc_.../purge" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H 'If-Match: "1"' \
  -H "Idempotency-Key: $(uuidgen)"

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.
document_idpathKnowledgeDocumentIdyesThe id of a Document of a Knowledge base: kdoc_ 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.

Responses

StatusContent typeShapeError codes
200application/jsonKnowledgeDocument
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden, org_suspended
404application/jsonErrorEnvelopenot_found
409application/jsonErrorEnvelopeidempotency_in_progress, idempotency_key_reused
412application/jsonErrorEnveloperevision_mismatch
428application/jsonErrorEnvelopeprecondition_required
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 200 answer

The shape is KnowledgeDocument.

FieldTypeRequiredDescription
byte_sizeinteger or nullyes
chunk_countintegeryes
chunker_versionstring or nullyes
classificationKnowledgeClassification or nullyes
created_atTimestampyes
embedding_spaceEmbeddingSpace or nullyes
entity_countsarray of KnowledgeEntityCountyes
error_codeIngestionErrorCode or nullyesSet when failed.
external_refstring or nullyesThe file name, URL or vendor reference the Source knows the Document by. The content class names: null unless the read names include=names, and null in the answer of a write (1.53.0, second part).
idKnowledgeDocumentIdyes
indexed_atTimestamp or nullyes
knowledge_base_idKnowledgeBaseIdyes
last_ingestion_run_idIngestionRunId or nullyes
media_typeKnowledgeMediaType or nullyes
object"knowledge_document"yes
page_countinteger or nullyes
parser_versionstring or nullyes
purged_atTimestamp or nullyes
quarantine_expires_atTimestamp or nullyesWhen the parsed text held for review is deleted, 14 days after the quarantine (a target); null otherwise.
quarantined_atTimestamp or nullyes
review_statusKnowledgeReviewStatusyes
revisionintegeryesCounts writes to the Document; returned as the ETag and required in If-Match. Not the number of content revisions.
source_idKnowledgeSourceIdyes
statusKnowledgeDocumentStatusyes
tagsarray of DocumentTagyes
titlestring or nullyesThe title the upload or the parse stage gave, or null when it has none. The content class names: null unless the read names include=names, and null in the answer of a write (1.53.0, second part).
updated_atTimestampyes