Skip to Content
APIEndpointsDelete knowledge document

Delete knowledge document

Permanently deletes a knowledge document. Its chunks and embeddings cascade-delete automatically, and if the document was PDF-sourced, the original file is removed from storage too.

There is no bulk variant for knowledge documents — send one request per document.

Requires the write:knowledge_base scope, and the workspace must be enabled for API writes.

DELETE /v1/brands/{brand_id}/knowledge-documents/{document_id}

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required
Idempotency-Keystringrequired

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands
document_iduuidrequiredFrom List knowledge documents

Body

This endpoint takes no body.

Request

curl --request DELETE \ --url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/knowledge-documents/b4f7e2a1-9c3d-4e6f-8a1b-2c5d7e9f0a3b' \ --header 'Authorization: Bearer <api-key>' \ --header 'Idempotency-Key: 5b0e77d2-13a9-4f6a-8ce1-9a3f5e21c0aa'

Response

{ "data": { "deleted_document_id": "b4f7e2a1-9c3d-4e6f-8a1b-2c5d7e9f0a3b" }, "request_id": "req_f18b2a9c0e4d37f6a1b5" }

Response fields

FieldTypeDescription
data.deleted_document_iduuidrequired. The document that was removed
request_idstringrequired. Also returned as the x-request-id header. Quote it when contacting support

Errors

StatusCodeWhen
401invalid_tokenThe key is missing, malformed, or does not exist
401token_expiredThe key passed its expiry date
401token_revokedThe key was revoked
403insufficient_scopeThe key does not carry write:knowledge_base
403plan_requiredThis workspace is not enabled for API writes
404not_foundThe brand does not exist, this key is not allowed to reach it, or document_id does not belong to this brand
429rate_limitedOver 60 requests per minute

Notes

This is not reversible. Chunks and embeddings cascade-delete with the row, and there is no trash or undo through the API.

Deletion is not gated on current Brand Knowledge plan access. Unlike every other write on this surface, this call skips the entitlement check — you can always remove a document, even from a workspace whose plan no longer includes Brand Knowledge.

No bulk variant exists. Send one request per document.

Idempotency-Key is required. Reuse it when retrying an attempt and the original response is replayed rather than a second delete being attempted. See Idempotency.

Last updated on