Skip to Content
The Ngamia platform API is in preview. Endpoints may change before general availability.
API referenceKnowledge

Knowledge

Add documents and files your agents can search and cite.

Add or update a document (developer)

POST /v1/knowledge/documents

Upserts one document by (source_id, external_id): sending the same IDs again replaces it, and unchanged text is not re-embedded. Agents with knowledge: true search these documents and cite them. The workspace’s knowledge store is created on first use.

Request body (application/json)

FieldTypeRequiredNotes
external_idstringyesYour ID for the document.
source_idstringyesGroups documents, e.g. website or faq.
kindfaq | doc | web | business | content | locationyes
titlestringyes
textstringyes
urlstring (uri)
langstringLanguage code (e.g. sw, en) or “mixed”; detected when omitted.
tagsarray of string
metaobject
curl -X POST https://api.ngamia.com/v1/knowledge/documents \ -H "Authorization: Bearer $NGAMIA_TOKEN" \ -H 'content-type: application/json' \ -d '{"external_id": "…", "source_id": "…", "kind": "faq", "title": "…", "text": "…"}'

Responses

StatusMeaning
200Stored
201Stored
400The request is invalid (invalid_request).

Delete a document (developer)

DELETE /v1/knowledge/documents/{id}

Parameters

ParameterInTypeNotes
idpathstringThe document ID returned when it was stored. required
curl -X DELETE https://api.ngamia.com/v1/knowledge/documents/<id> \ -H "Authorization: Bearer $NGAMIA_TOKEN"

Responses

StatusMeaning
204Deleted
404Not found in this workspace (not_found).

Upload a file (developer)

POST /v1/knowledge/files

PDF, DOCX, TXT, Markdown or HTML, up to 30 MiB. Files are virus-scanned and parsed in isolation, then indexed in the background: the response has a job to poll at /v1/knowledge/jobs/{id}.

Request body (multipart/form-data)

FieldTypeRequiredNotes
filestring (binary)yes
source_idstring
external_idstring
titlestring
curl -X POST https://api.ngamia.com/v1/knowledge/files \ -H "Authorization: Bearer $NGAMIA_TOKEN" \ -F file=@price-list.pdf -F source_id=documents

Responses

StatusMeaning
202Accepted for indexing
400The request is invalid (invalid_request).
413File too large

List indexing jobs

GET /v1/knowledge/jobs

Parameters

ParameterInTypeNotes
limitqueryintegermin 1, max 200
offsetqueryintegermin 0
curl -X GET https://api.ngamia.com/v1/knowledge/jobs \ -H "Authorization: Bearer $NGAMIA_TOKEN"

Responses

StatusMeaning
200Jobs

Get an indexing job

GET /v1/knowledge/jobs/{id}

Parameters

ParameterInTypeNotes
idpathstringrequired
curl -X GET https://api.ngamia.com/v1/knowledge/jobs/<id> \ -H "Authorization: Bearer $NGAMIA_TOKEN"

Responses

StatusMeaning
200The job and its status
404Not found in this workspace (not_found).

Search the workspace’s knowledge

POST /v1/knowledge/search

The same hybrid (semantic and keyword) search agents use. Use it to check what an agent will find.

Request body (application/json)

FieldTypeRequiredNotes
querystringyesmin length 1
limitintegermin 1, default 8
filtersobject
curl -X POST https://api.ngamia.com/v1/knowledge/search \ -H "Authorization: Bearer $NGAMIA_TOKEN" \ -H 'content-type: application/json' \ -d '{"query": "…"}'

Response 200 fields

FieldTypeRequiredNotes
hitsarray of object
score_semanticsstring

Responses

StatusMeaning
200Hits, best first