Skip to content

Data sources ​

Read data sources, push documents and trigger syncs. Data sources are created and configured in the console; see the Knowledge guide.

DataSource ​

FieldTypeDescription
iduuid
namestring
typefiles | website | http_api | text
modeindexed | live
embeddingModelIdstring | nullcatalog id of the embedding model
configobjecttype-specific settings
schedulehourly | daily | weekly | nullautomatic syncs
statusidle | syncing | ready | error
errorstring | nulllast sync error
lastSyncedAtstring | null
nextSyncAtstring | null
documentCountinteger
chunkCountinteger
createdAtstring
updatedAtstring

List data sources ​

http
GET /v1/datasources

Scope: datasources:read. Response: DataSource[] (plain array).

ts
const sources = await hevkar.dataSources.list();

Add documents ​

http
POST /v1/datasources/{id}/documents

Scope: datasources:write. Two body formats:

JSON (text and files sources): an array of documents, or { "documents": [...] }, with 1 to 500 entries:

FieldTypeDescription
externalRefstring (1–500)your stable id; pushing the same ref again replaces the document
titlestring (1–500)required
textstring (1–2 000 000)required
metadataobjectstored on the document; usable in retrieval filters

Multipart (files sources): up to 20 files in any field names. A file with the same name as an existing document replaces it.

Response 201: the created or replaced documents. A sync is queued to index them.

json
[
  {
    "id": "…",
    "dataSourceId": "…",
    "externalRef": "faq-12",
    "title": "Refunds",
    "mimeType": null,
    "fileId": null,
    "status": "pending",
    "error": null,
    "chunkCount": 0,
    "tokenCount": 0,
    "metadata": { "lang": "en" },
    "createdAt": "2026-11-21T10:15:00.000Z",
    "updatedAt": "2026-11-21T10:15:00.000Z"
  }
]

Document status: pending, processing, ready, error.

bash
curl "$HEVKAR_BASE_URL/v1/datasources/$SOURCE_ID/documents" \
  -H "Authorization: Bearer $HEVKAR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{"externalRef": "faq-12", "title": "Refunds", "text": "You can ask for a refund…"}]'
ts
await hevkar.dataSources.pushDocuments(sourceId, [
  { externalRef: 'faq-12', title: 'Refunds', text: 'You can ask for a refund…' },
]);
await hevkar.dataSources.pushFiles(sourceId, [{ data: pdfBuffer, name: 'handbook.pdf' }]);
StatusCodeWhen
400DOCUMENT_UPLOAD_NOT_SUPPORTEDwebsite and HTTP API sources (they are synced from the source)
400VALIDATION_FAILEDinvalid JSON body
413 / 415FILE_TOO_LARGE / FILE_TYPE_NOT_SUPPORTEDan uploaded file
402STORAGE_LIMIT_REACHEDthe organization's storage is full
404NOT_FOUNDunknown data source

Start a sync ​

http
POST /v1/datasources/{id}/sync

Scope: datasources:write. No body. Queues a sync of an indexed source; a sync that is still queued is reused. Response 202: a sync run.

json
{
  "id": "…",
  "status": "queued",
  "force": false,
  "stats": {},
  "error": null,
  "startedAt": "2026-11-21T10:15:00.000Z",
  "finishedAt": null
}
FieldDescription
statusqueued, running, succeeded, failed
forcetrue for re-index runs (everything re-embedded)
stats{documents, added, updated, unchanged, removed, failed, chunks, embeddingTokens} when finished

The result arrives as a datasource.synced or datasource.failed webhook.

Errors: 400 DATA_SOURCE_NOT_INDEXED (live sources), 404 NOT_FOUND.

Hevkar public API v1