Skip to content
DhvaneeDocs
Dashboard
On this page

Knowledge API

Upload, list and delete knowledge documents, and choose which documents each agent can use.

Knowledge documents are the facts an agent can look up during a call: prices, opening hours, policies. This API manages the documents of the key's workspace and the set attached to each agent. Writing and organising documents by hand stays in the dashboard; see Voice agents.

The machine-readable contract is openapi.public.yaml. Download it for clients and codegen. This site has no live Try-it console.
Documents are shared across the workspace. An upload adds a document to the library; it reaches an agent only after you attach it with PUT /v1/agents/AGENT_ID/knowledge.

Scopes

  • knowledge:read for GET
  • knowledge:write for upload, delete and PUT (attach)

The document object

FieldTypeNotes
idstring (UUID)Set by Dhvanee.
titlestringThe title you sent, trimmed and cut to 256 characters. Without one, the file name.
languagestringBase language code, for example en or hi. See the language rules below.
slugstringA URL-safe form of the title, made unique within the workspace and language.
source_pathstring or nullThe uploaded file's name.
created_at, updated_atstring or nullISO 8601.
{"id": "ec9a4da7-25dd-485a-aab8-04ec010c2312", "title": "Opening hours", "language": "en", "slug": "opening-hours", "source_path": "hours.txt", "created_at": "2026-11-28T09:53:59.633861+00:00", "updated_at": "2026-11-28T09:53:59.633861+00:00"}
source_path, created_at and updated_at are filled in by the list and upload endpoints. In the response of GET and PUT /v1/agents/AGENT_ID/knowledge they are null; use the list for those values.

List documents

Most recently updated first. The response holds up to limit documents and there is no paging, so a workspace with more than 50 documents cannot be listed in full through this endpoint.

curl -sS -X GET "https://api.stage.dhvanee.com/v1/knowledge/documents?limit=20" \
  -H "Authorization: Bearer dhvanee_live_YOUR_KEY"
{"items": [{"id": "0500d7f2-...", "title": "Timings and prices", "language": "en", "slug": "timings-and-prices", "source_path": null, "created_at": "2026-11-27T12:11:22.169554+00:00", "updated_at": "2026-11-27T12:11:22.169554+00:00"}]}
  • limit is a whole number. It defaults to 50, and a value outside 1 to 50 is clamped into that range, not rejected (0 returns 1 document, 999 returns up to 50).
  • A limit that is not a whole number answers 422.

Upload a document

Send the file as multipart/form-data. Returns 201 with the document.

curl -sS -X POST "https://api.stage.dhvanee.com/v1/knowledge/documents" \
  -H "Authorization: Bearer dhvanee_live_YOUR_KEY" \
  -F "file=@hours.txt" \
  -F "title=Opening hours" \
  -F "language=en"
FieldRequiredRules
fileyesA .txt, .md or .pdf file of at most 5 MB. The type is read from the file name, in any letter case (A.TXT works). A PDF must contain text that can be read; scanned pages without text are refused.
titlenoBlank or missing: the file name is used.
languagenoDefault en. A locale such as hi-IN is saved as its base code (hi). A value the platform does not recognise is saved as en without an error, so check language in the response.
  • The text of the file is stored, up to 100,000 characters. Longer files are cut, not refused.
  • Knowledge storage on your plan counts the stored text in bytes, not the size of the file. Read knowledge_storage_mb from the Account API to see what is used.
  • The response comes back before the document is indexed. Indexing (cutting it into searchable parts) runs right after, and until it finishes the document is found by keyword only. The API does not report the indexing state.
  • Uploading the same file twice makes two documents; the second gets a different slug.

Delete a document

curl -sS -X DELETE "https://api.stage.dhvanee.com/v1/knowledge/documents/DOCUMENT_ID" \
  -H "Authorization: Bearer dhvanee_live_YOUR_KEY"

Returns 204. The document is also removed from every agent it was attached to. Deleting it again answers 404.

The documents of an agent

Each agent has its own attached set. Read it, or replace it as a whole.

curl -sS -X GET "https://api.stage.dhvanee.com/v1/agents/AGENT_ID/knowledge" \
  -H "Authorization: Bearer dhvanee_live_YOUR_KEY"
{"items": [{"id": "ec9a4da7-...", "title": "Opening hours", "language": "en", "slug": "opening-hours", "source_path": null, "created_at": null, "updated_at": null}]}
curl -sS -X PUT "https://api.stage.dhvanee.com/v1/agents/AGENT_ID/knowledge" \
  -H "Authorization: Bearer dhvanee_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"document_ids":["ec9a4da7-25dd-485a-aab8-04ec010c2312","0500d7f2-6adf-4f3a-bde5-119e7acac011"]}'
  • PUT replaces the whole set. To add one document, send the ids already attached plus the new one. To remove all, send {"document_ids": []}.
  • `document_ids` is required. A body without it, such as {}, is refused with 422, so a forgotten field never detaches your documents. Send [] to detach them all on purpose.
  • The response and GET return the set in the order you sent. Repeated ids are counted once.
  • Every id must be a document of this workspace. If one is not, the whole request answers 404 and the agent's current set is left unchanged.
  • Attaching documents can add names found in them to the agent's boosted speech keywords, the same as in the dashboard.
  • The attached ids are part of the settings recorded when you publish an agent (knowledge_document_ids, see the Agents API).

Errors

StatusWhen
400The upload is not usable: File is empty, File is larger than 5 MB, Unsupported file type. Use .md, .txt, or .pdf, Could not extract text from this PDF (a PDF with no readable text), Could not read this PDF. It may be damaged or password-protected.
401No key, or an unknown or revoked key (Valid API key is required).
402Upload only: the plan's knowledge storage would be exceeded. The body is {"detail": {"code": "kb_storage_limit_reached"}}. Delete documents or upgrade the plan.
403The key lacks the scope (API key needs knowledge:write scope).
404Document not found, Agent not found, or One or more knowledge documents were not found in this workspace.
422A body that is not valid: no file, an id that is not a UUID, or a limit that is not a whole number.
429Too many requests. See Rate limits.

Agents themselves are managed through the Agents API. Limits and keys: Authentication, Rate limits.

Knowledge API · Dhvanee Docs