Skip to Content
APIEndpointsGet knowledge document

Get knowledge document

One knowledge document’s full content — raw_text and body_html — plus every field List knowledge documents omits: error_message, chunk_count, token_count, needs_reembed, file metadata, material_type, and writing-style attachment. Round-trip target for Update knowledge document.

Requires the read:knowledge_base scope.

GET /brands/{brand_id}/knowledge-documents/{document_id}

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands
document_iduuidrequiredFrom List knowledge documents

Request

curl --request GET \ --url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/knowledge-documents/b4f7e2a1-9c3d-4e6f-8a1b-2c5d7e9f0a3b' \ --header 'Authorization: Bearer <api-key>'

Response

{ "data": { "document": { "id": "b4f7e2a1-9c3d-4e6f-8a1b-2c5d7e9f0a3b", "brand_id": "242546de-4cee-4a7d-952e-f6aa60c63ef8", "title": "Product Positioning FAQ", "user_description": "Internal FAQ used to ground content about our differentiation.", "source_type": "paste", "raw_text": "## What makes us different?\n\nAsky tracks...", "body_html": "<h2>What makes us different?</h2><p>Asky tracks...</p>", "status": "ready", "error_message": null, "char_count": 4820, "chunk_count": 6, "token_count": 1180, "needs_reembed": false, "file_name": null, "page_count": null, "file_size_bytes": null, "mime_type": null, "material_type": null, "writing_style_id": null, "style_prompt_dismissed": false, "created_by": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "created_at": "2026-08-18T11:02:04.000Z", "updated_at": "2026-08-20T09:14:22.000Z" } }, "request_id": "req_c7e1a0b8d3f24e6a9c5b" }

Response fields

FieldTypeDescription
data.document.iduuidrequired
data.document.brand_iduuidrequired
data.document.titlestringrequired
data.document.user_descriptionstring | nullrequired
data.document.source_typestringrequired. One of paste, pdf, mcpmcp is a legacy value, see List knowledge documents
data.document.raw_textstring | nullrequired. null while a PDF is still processing
data.document.body_htmlstring | nullrequired. See Notes — effectively never null once status is ready
data.document.statusstringrequired. One of processing, ready, failed
data.document.error_messagestring | nullrequired. Populated only when status is failed
data.document.char_countintegerrequired
data.document.chunk_countintegerrequired. Chunks the document was split into for retrieval
data.document.token_countintegerrequired
data.document.needs_reembedbooleanrequired. true when the stored embeddings are stale relative to the current content
data.document.file_namestring | nullPDF-sourced documents only
data.document.page_countinteger | nullPDF-sourced documents only
data.document.file_size_bytesinteger | nullPDF-sourced documents only
data.document.mime_typestring | nullPDF-sourced documents only. application/pdf when set
data.document.material_typestring | nullOptional user-assigned classification of the source material
data.document.writing_style_iduuid | nullSet when this document belongs to a writing style rather than general brand knowledge
data.document.style_prompt_dismissedbooleanrequired
data.document.created_byuuidrequired
data.document.created_at / data.document.updated_attimestamptzrequired
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 read:knowledge_base
404not_foundThe brand does not exist, document_id does not belong to this brand, or this key is not allowed to reach it
429rate_limitedOver 300 requests per minute

Notes

raw_text and body_html are null while a PDF is still processing. They populate once status flips to ready, after the vision extraction pass finishes.

body_html is synthesized, not always stored. Legacy and pasted rows with no persisted HTML get one generated from raw_text on read, matching what the app does — so the field reads as populated for a ready document even before anyone has edited it. The first edit through Update knowledge document persists a real, independently-stored value.

error_message only appears once a document has failed. It is null for every other status.

File metadata is PDF-only. file_name, page_count, file_size_bytes and mime_type are null for paste and mcp documents. Use Get knowledge document file to download the original PDF for a pdf-sourced one.

Last updated on