Skip to content

Import Knowledge

POST /knowledge-bases/{kb_id}/import

Record the job and return it queued. The ingest loop does the work.

202 rather than 201: nothing has been imported yet, and answering 201 with a finished-looking body is how a caller concludes the import failed silently when the counts are still zero a second later. RULE IJ-1 is why the work is not done inline — a crashed inline import would leave a running row nothing may reclaim.

NameInTypeNotes
kb_idpathstring (uuid)required—
FieldTypeNotes
modeverbatim | analyzedoptionalDefault "verbatim".
source_formatcsv | markdown | items | document | urloptionalDefault "items".
object_keystring | nulloptionalmax length 1024
source_urlstring | nulloptionalmax length 2000
source_filenamestring | nulloptionalmax length 400
itemsstring[] | nulloptional—
contentstring | nulloptionalmin length 1 max length 1000000
StatusDescriptionBody
202Successful ResponseIngestJobView
422Validation ErrorHTTPValidationError

The body shows the fields the schema always carries. Which combination is legal is a service rule the schema cannot express, so read the description above before copying this.

Terminal window
curl -X POST https://your-deployment.example.com/knowledge-bases/{kb_id}/import \
-H "Authorization: Bearer $COBRE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mode": "verbatim",
"source_format": "csv"
}'
FieldTypeNotes
idstring (uuid)required—
kb_idstring (uuid)required—
statusqueued | running | succeeded | failed | cancelledrequired—
stageanalyzing | embedding | nulloptional—
modeverbatim | analyzedrequired—
source_formatcsv | markdown | items | document | urlrequired—
source_filenamestring | nulloptional—
source_urlstring | nulloptional—
total_itemsintegeroptionalDefault 0.
processed_itemsintegeroptionalDefault 0.
created_itemsintegeroptionalDefault 0.
skippedIngestSkip[]optional—
analyzer_run_idstring (uuid) | nulloptional—
tokens_inputintegeroptionalDefault 0.
tokens_outputintegeroptionalDefault 0.
coststringoptionalDefault "0".
error_messagestring | nulloptional—
started_atstring (date-time) | nulloptional—
finished_atstring (date-time) | nulloptional—
created_atstring (date-time)required—