Knowledge base
Upload documents for agents to answer questions from, such as price lists, FAQs, and policies.
Agents can answer callers' questions from documents you upload. Upload a file, wait for it to be indexed, and attach it to an agent.
Before you begin
- An API key with the
agents:writescope to upload and delete files, andagents:readto list them.
Upload a file
curl -X POST https://api.resonera.ai/v1/knowledge-base/items \
-H "X-API-Key: $RESONERA_API_KEY" \
-F "file=@Price list.pdf" \
-F "folder=docs/prices"{
"item": { "id": "6282b371-da50-4129-9115-6403b8918e1a", "name": "Price list.pdf", "type": "file", "path": "docs/prices/Price list.pdf", "size_bytes": 184233 },
"job_id": "a68caab0-a29e-47a1-a563-370928f8d03d"
}The folder parameter is optional. Folders are created as needed and appear on the
dashboard's Knowledge Base page. Uploading a file with the same name to the same folder
replaces it and keeps its id, so agents that use the file receive the new version.
Wait for indexing
Indexing splits the document into searchable passages and extracts facts such as prices, timings, and policies. It usually completes within seconds.
curl https://api.resonera.ai/v1/knowledge-base/jobs/$JOB_ID \
-H "X-API-Key: $RESONERA_API_KEY"{ "status": "completed", "chunks_indexed": 42, "error": null }status is queued, processing, completed, or failed. A file without readable text
completes with chunks_indexed: 0.
Attach the file to an agent
Add the file's id to the agent's kb_item_ids:
curl -X PATCH https://api.resonera.ai/v1/agents/$AGENT_ID \
-H "X-API-Key: $RESONERA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"kb_item_ids": ["6282b371-da50-4129-9115-6403b8918e1a"]}'kb_item_ids replaces the existing list. Include every file the agent should use. An agent
with files attached can always search them, regardless of its tools list. A campaign can
override the agent's files with its own kb_item_ids.
Supported files
| Type | Formats |
|---|---|
| Documents | PDF, DOCX, TXT, MD, RST |
| Spreadsheets | XLSX, XLS, CSV |
| Images | PNG, JPG, WebP |
The maximum file size is 50 MB. Scanned PDF pages and images are read with optical character recognition (OCR) in English and major Indian languages, up to 40 scanned pages per file. Review the extracted text on the dashboard's Knowledge Base page, because OCR can introduce errors.
Check indexing status
Indexing jobs are retained for a limited time. To check a file's status later, list its folder. Each file includes its stored indexing result:
curl "https://api.resonera.ai/v1/knowledge-base/items?folder=docs/prices" \
-H "X-API-Key: $RESONERA_API_KEY"{
"items": [
{ "id": "6282b371-da50-4129-9115-6403b8918e1a", "name": "Price list.pdf", "type": "file",
"index_status": "indexed", "index_chunks": 42, "index_facts": 118, "index_error": null }
]
}index_status | Description |
|---|---|
queued, indexing | Indexing is in progress. |
indexed | The file is searchable. |
no_text | No readable text was found, including with OCR. |
failed | Indexing failed. index_error contains the reason. |
List, download, and delete files
| Task | Request |
|---|---|
| List a folder | GET /knowledge-base/items?folder=docs/prices. Omit folder for the top level. |
| Download a file | GET /knowledge-base/items/{kb_item_id}/download-url returns a link valid for five minutes. |
| Delete a file or folder | DELETE /knowledge-base/items/{kb_item_id}. Deleting a folder deletes everything in it. The stored files and their search index are deleted too, and agents stop using them. |
In an organization, members share one knowledge base. You can list, download, and delete files
that other members or their agents added, such as the documents in the requirements folder.
Best practices
- Store facts the agent must state accurately, such as prices, timings, and policies, in the knowledge base instead of the prompt.
- Use clear headings with one topic per section. In plain-text files, a line in capital letters is treated as a heading.
- For price lists, use a spreadsheet with a header row and one item per row.