Skip to Content
APIEndpointsResync knowledge document

Resync knowledge document

Re-runs the full ingest pipeline (extract if PDF, summarize, chunk, embed) for one document. Use it after a body edit through Update knowledge document set needs_reembed, or to retry a document stuck in status: "failed".

This call returns immediately once the resync is dispatched. Poll Get knowledge document until status flips to ready or failed.

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

POST /v1/brands/{brand_id}/knowledge-documents/{document_id}/resync

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required
Idempotency-Keystringrequired

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands
document_iduuidrequiredFrom List knowledge documents

Body

application/json. This endpoint takes no fields — send {} or an empty body.

Any field you pass returns 400 invalid_request naming it.

Request

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

Response

{ "data": { "document_id": "b4f7e2a1-9c3d-4e6f-8a1b-2c5d7e9f0a3b", "status": "processing" }, "request_id": "req_e4a9c1b8d0f37e5a2c69" }

Response fields

FieldTypeDescription
data.document_iduuidrequired. Echoes the document_id you resynced
data.statusstringrequired. Always processing — the resync has started, not finished
request_idstringrequired. Also returned as the x-request-id header. Quote it when contacting support

Errors

StatusCodeWhen
400invalid_requestUnknown field in the body
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
403plan_requiredBrand Knowledge is not included in this workspace’s plan
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

plan_required appears twice with different messages. The first means this workspace’s plan does not include API writes at all. The second means writes are enabled but Brand Knowledge specifically is not on the plan.

Notes

This always dispatches. Unlike Run alignment check, there is no daily dedup or already_running concept here — calling it twice in a row queues two ingest passes back to back.

A PDF document’s extracted text is discarded first, then re-extracted. raw_text and char_count reset to null and 0 immediately, before the new vision-extraction pass completes — so a caller reading the document mid-resync sees it briefly empty. A pasted document’s raw_text is left untouched; only its chunks and embeddings regenerate.

Poll for completion. Get knowledge document is the source of truth — watch status flip from processing to ready or failed.

This is the retry path for a failed document. Whatever caused the previous ingest to fail (a transient extraction or embedding error, for example) is retried from scratch on the next call.

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

Last updated on