VocalDocscontracts 1.65.0

Add a Source to a Knowledge base

POST /v1/knowledge-bases/{knowledge_base_id}/sources

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

Creates a Source at revision 1 (1.53.0). A url Source starts its first sync, an Ingestion run with cause manual; an upload Source waits for uploads. A connection Source is refused with capability_not_available until P2. Every issue is a detail of 422 validation_failed (KnowledgeSourceIssueCode, and egress_denied with its reason for a URL the egress guard refuses).

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" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "kind": "upload" }'

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.
idempotency-keyheaderstringnoA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Request body

Content type application/json, required: KnowledgeSourceCreateRequest.

FieldTypeRequiredDescription
connectionKnowledgeConnectionSettingsInputno
kindKnowledgeSourceKindyes
namestringno
refreshKnowledgeRefreshInputno
urlKnowledgeUrlSettingsInputno

Responses

StatusContent typeShapeError codes
201application/jsonKnowledgeSource
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden, org_suspended
404application/jsonErrorEnvelopenot_found
409application/jsonErrorEnvelopeknowledge_base_archived, idempotency_in_progress, idempotency_key_reused
422application/jsonErrorEnvelopevalidation_failed, capability_not_available
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 201 answer

The shape is KnowledgeSource.

FieldTypeRequiredDescription
connectionKnowledgeConnectionSettings or nullyesThe settings of a connection Source; null for another kind.
created_atTimestampyes
idKnowledgeSourceIdyes
kindKnowledgeSourceKindyes
knowledge_base_idKnowledgeBaseIdyes
last_run_idIngestionRunId or nullyes
last_synced_atTimestamp or nullyesWhen the last run that read the Source finished, or null before one.
namestring or nullyes
object"knowledge_source"yes
refreshKnowledgeRefresh or nullyesNull for an upload Source.
revisionintegeryesCounts writes; returned as the ETag and required in If-Match.
statusKnowledgeSourceStatusyes
updated_atTimestampyes
urlKnowledgeUrlSettings or nullyesThe settings of a url Source; null for another kind.