Skip to content

Ingesting documents

PUT /api/v1/data/datasources/ProductManuals/documents
Content-Type: application/json
[
{
"id_": "manual-cam45-alignment-reset",
"text": "To realign camera CAM-45, stop the line, open the maintenance bracket, adjust the lateral offset until the center marker matches, then retighten the bracket bolts.",
"metadata": {
"device_model": "CAM-45",
"document_type": "manual",
"section": "alignment_reset",
"title": "CAM-45 Alignment Reset",
"url": "https://docs.example.com/cam45/alignment",
"page_number": 42
}
}
]
FieldDescription
id_Your stable ID for the document
textThe content of the document. For images, see Load images.
metadataOptional attributes for filtering and for showing sources

The request is processed synchronously. When it returns, the documents are searchable.

When an agent cites a document, the source name and link are taken from these metadata keys:

KeyUsed for
titleName of the source
urlLink to the original document
file_name and page_labelName of the source, shown as {file_name} Page: {page_label}, if title is missing

Without title, file_name and page_label, the url is shown as name. Without any of these keys, an internal ID is shown. Always set title and, if the original is reachable for users, url.

Images, for example diagrams or photos from a manual, are loaded with the same request. Send the image base64-encoded in image_resource instead of text:

[
{
"id_": "manual-cam45-wiring-diagram",
"image_resource": {
"data": "iVBORw0KGgoAAAANSUhEUgAA…",
"mimetype": "image/png"
},
"metadata": {
"device_model": "CAM-45",
"title": "CAM-45 Wiring Diagram",
"page_context": "Section 4.2 Electrical connection: connect the camera to the 24 V supply …"
}
}
]
FieldDescription
image_resource.dataThe image, base64-encoded
image_resource.mimetypeThe image format, for example image/png or image/jpeg
metadata.page_contextOptional text that surrounds the image in the original document

During loading, a language model describes the image in text. This description is what the search finds. The model uses the metadata and page_context as context, so the more context you provide, the better the description. If you send your own text together with the image, the service uses your text and does not generate a description.

To show the original image, for example in your own chat interface, load it from the node:

GET /api/v1/data/datasources/{name}/nodes/{node_id}/image

The response contains the image with its content type. The request needs the same token and headers as all other requests.

The service compares the id_ and a hash of the content with what is already stored:

SituationResult
New id_Loaded
Same id_, changed contentUpdated
Same id_, same contentSkipped: already_ingested_or_in_progress
Different id_, same content as an existing documentSkipped: duplicate_hash

So you can safely send the same documents again. Unchanged documents are skipped and do not cost processing time.

{
"status": "partial_success",
"accepted": ["manual-cam45-alignment-reset"],
"skipped": [
{
"doc_id": "manual-cam45-copy",
"doc_hash": "a3f5e9d2b1c4…",
"reason": "duplicate_hash",
"conflicting_doc_id": "manual-cam45-calibration"
}
],
"update_counts": { "ProductManuals": { "documents": 1, "nodes": 3 } }
}
HTTP statusstatusMeaning
201createdAll documents loaded
207partial_successSome documents loaded, see skipped
200already_ingested_or_in_progressNothing loaded, all documents were already there
409all_skippedNothing loaded because of conflicts
OperationRequest
List documentsGET /api/v1/data/datasources/{name}/documents
Read one documentGET /api/v1/data/datasources/{name}/documents/{doc_id}
Delete a documentDELETE /api/v1/data/datasources/{name}/documents/{doc_id}

Deleting a document also removes all its nodes from the search index.

The document list returns a map of content hash to document ID:

{
"doc_hashes": { "a3f5e9d2b1c4…": "manual-cam45-alignment-reset" },
"next_cursor": 100,
"has_more": true
}

The list is paged. Use the query parameters limit (default 100, maximum 10,000) and cursor. Pass next_cursor from the previous response as cursor until has_more is false.

Use this list to find documents that no longer exist in your source system, and delete them.

Nodes are the searchable pieces of your documents. Inspect them to check how documents were split.

OperationRequest
List nodesGET /api/v1/data/datasources/{name}/nodes (paged, limit up to 1,000)
Read one nodeGET /api/v1/data/datasources/{name}/nodes/{node_id}
Find nodes by metadataPOST /api/v1/data/datasources/{name}/filters?metadata_filters=… with an RQL filter. Optional: top_k (default 10) and sort, for example -created.