Appearance
Data sources
Read data sources, push documents and trigger syncs. Data sources are created and configured in the console; see the Knowledge guide.
DataSource
| Field | Type | Description |
|---|---|---|
id | uuid | |
name | string | |
type | files | website | http_api | text | |
mode | indexed | live | |
embeddingModelId | string | null | catalog id of the embedding model |
config | object | type-specific settings |
schedule | hourly | daily | weekly | null | automatic syncs |
status | idle | syncing | ready | error | |
error | string | null | last sync error |
lastSyncedAt | string | null | |
nextSyncAt | string | null | |
documentCount | integer | |
chunkCount | integer | |
createdAt | string | |
updatedAt | string |
List data sources
http
GET /v1/datasourcesScope: datasources:read. Response: DataSource[] (plain array).
ts
const sources = await hevkar.dataSources.list();Add documents
http
POST /v1/datasources/{id}/documentsScope: datasources:write. Two body formats:
JSON (text and files sources): an array of documents, or { "documents": [...] }, with 1 to 500 entries:
| Field | Type | Description |
|---|---|---|
externalRef | string (1–500) | your stable id; pushing the same ref again replaces the document |
title | string (1–500) | required |
text | string (1–2 000 000) | required |
metadata | object | stored 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' }]);| Status | Code | When |
|---|---|---|
| 400 | DOCUMENT_UPLOAD_NOT_SUPPORTED | website and HTTP API sources (they are synced from the source) |
| 400 | VALIDATION_FAILED | invalid JSON body |
| 413 / 415 | FILE_TOO_LARGE / FILE_TYPE_NOT_SUPPORTED | an uploaded file |
| 402 | STORAGE_LIMIT_REACHED | the organization's storage is full |
| 404 | NOT_FOUND | unknown data source |
Start a sync
http
POST /v1/datasources/{id}/syncScope: 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
}| Field | Description |
|---|---|
status | queued, running, succeeded, failed |
force | true 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.