Sync a Source now
POST /v1/knowledge-bases/{knowledge_base_id}/sources/{source_id}/sync
| Property | Value |
|---|---|
| Operation | sync_knowledge_source |
| Group | Knowledge bases |
| Scope | knowledge:write |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Audited knowledge.source.sync (mutation) |
| Released in | 1.53.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Starts an Ingestion run with cause manual and answers 202 with it and its Location (1.53.0). While a run of the Source is queued or running, it answers that run and marks the Source for one more sync after it, so bursts collapse. A sync of an upload Source is source_sync_not_applicable. The end of the run emits knowledge_source.sync.completed.
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_.../sources/ksrc_.../sync" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"const response = await fetch(`${process.env.VOCAL_API}/v1/knowledge-bases/kb_.../sources/ksrc_.../sync`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
},
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/knowledge-bases/kb_.../sources/ksrc_.../sync",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
knowledge_base_id | path | KnowledgeBaseId | yes | The id of a Knowledge base: kb_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
source_id | path | KnowledgeSourceId | yes | The id of a Source of a Knowledge base: ksrc_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
idempotency-key | header | string | no | A client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
202 | application/json | IngestionRun | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | knowledge_base_archived, idempotency_in_progress, idempotency_key_reused |
422 | application/json | ErrorEnvelope | validation_failed |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 202 answer
The shape is IngestionRun.
| Field | Type | Required | Description |
|---|---|---|---|
cause | IngestionCause | yes | |
counts | IngestionCounts | yes | |
created_at | Timestamp | yes | |
error_codes | array of IngestionErrorCode | yes | The distinct codes of the run and of its failed Documents, in first-seen order. |
finished_at | Timestamp or null | yes | |
id | IngestionRunId | yes | |
knowledge_base_id | KnowledgeBaseId | yes | |
object | "knowledge_ingestion_run" | yes | |
source_id | KnowledgeSourceId | yes | |
source_name | string or null | no | The display name of the run's Source (1.54.0), null when it has none; a deleted Source keeps its name here. Absent from an api before 1.54.0. |
started_at | Timestamp or null | yes | |
status | IngestionRunStatus | yes |