Knowledge
Keep each bot's knowledge up to date: documents under your own IDs, websites and files, or your own API for content that stays on your side.
A bot answers from three kinds of knowledge. Pick by how your content changes and where you want it to live.
| Kind | Best for | Update and delete |
|---|---|---|
| Documents | Many separate items you manage in your own system: stories, articles, a bio, product pages. | Push again under the same external_id to replace; delete by ID. Stored and indexed by Heyllo. |
| Sources | A website to crawl, PDFs and other files, one text block, a Q&A set. | The same URL or file name replaces; delete by URL, file name or source. |
| Actions | Content you do not want copied into Heyllo, a search across all of your users, or live data such as orders. | Nothing to sync: the bot calls your own API during the conversation. |
Documents
A document is one piece of content under an ID of yours (external_id, up to 191 letters, digits and . _ : @ + = -). Pushing the same ID again replaces that document and nothing else. Pushing it unchanged does nothing and costs no ingested words. Each document is indexed on its own, so the bot can cite it by its title and url.
curl -X PUT https://api.heyllo.co/v1/bots/bot_k3x9q2m7v1p8z4w6t5r0y2/knowledge/documents/story-1042 \
-H "Authorization: Bearer $HEYLLO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Sailing to Lamu by dhow",
"content": "We left Malindi at dawn...",
"url": "https://stories.example.com/s/1042",
"metadata": { "author_id": "u_381" }
}'Send up to 100 at a time with POST /bots/{id}/knowledge/documents and {"documents": [...]}. The response lists every document with its status and, when something needed indexing, a knowledge job. A document is processing until its job ends, then ready or failed (with an error). One failing document does not fail the others; only words of indexed documents count towards your usage.
curl -X DELETE https://api.heyllo.co/v1/bots/bot_k3x9q2m7v1p8z4w6t5r0y2/knowledge/documents/story-1042 \
-H "Authorization: Bearer $HEYLLO_API_KEY"
curl -X DELETE https://api.heyllo.co/v1/bots/bot_k3x9q2m7v1p8z4w6t5r0y2/knowledge/documents \
-H "Authorization: Bearer $HEYLLO_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "external_ids": ["story-7", "story-9"] }'status is failed.Websites, files, text and Q&A
Each add call replaces by a key, and has a matching DELETE:
| Add | Sending it again | Remove |
|---|---|---|
POST /knowledge/url | The same URL is crawled again and replaces the old copy. A different URL is added. | DELETE /knowledge/url?url=... |
POST /knowledge/files | A file with the same name replaces the old one. A new name is added. | DELETE /knowledge/files?name=... |
POST /knowledge/text | Replaces the bot's single text block. | DELETE /knowledge/text |
POST /knowledge/qa | Replaces the whole Q&A set. | DELETE /knowledge/qa |
/knowledge/text keeps only the last one; use documents instead.GET /knowledge/sources lists what was added this way (paginated), and DELETE /knowledge/sources/{source_id} removes a whole source.
Content that stays in your system
If you do not want to copy content into Heyllo, describe your existing search API as an action and link it to your bots. During a conversation the agent calls your API with the visitor's question and answers from the results, citing their links. Your content is never copied, so there is nothing to keep in sync or delete.
curl https://api.heyllo.co/v1/actions \
-H "Authorization: Bearer $HEYLLO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "search_stories",
"description": "Search the stories published on Example.",
"url": "https://api.example.com/stories?q={{query}}&author={{params.author_id}}",
"inputs": [{ "name": "query", "required": true }],
"headers": { "Authorization": "Bearer sk_live_..." },
"citations": { "items": "results" }
}'
curl -X PATCH https://api.heyllo.co/v1/bots/bot_k3x9q2m7v1p8z4w6t5r0y2 \
-H "Authorization: Bearer $HEYLLO_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "actions": [{ "id": "act_...", "params": { "author_id": "u_381" } }] }'Common setups
A bot per user that knows only that user's content
- Hosted: push each of the user's items to their bot as a document, one document per item, in batches of up to 100. There is no limit on the number of documents.
- Your API: link the user's bot to your search action with
paramssuch as{"author_id": "u_381"}, and filter on it in your API (or use{{workspace.external_id}}, which Heyllo fills in).
One bot that searches across all of your users
An action belongs to your organisation, not to a workspace, so any bot in any of your workspaces can use it. Create a bot for your site-wide search and link the same action without params; your API then searches everything. Nothing is copied into Heyllo.
Which key you need
No key needs every scope. The agent's calls to your API use your action's own headers, not a Heyllo key.
| To | Scope | Key binding |
|---|---|---|
| Push and delete documents and sources | knowledge:write | Any (organisation, workspace or bot) |
| Create, change, test or delete an action | actions:manage | Organisation |
Link actions to a bot, set its params | bots:write | Organisation |
| Create or rename workspaces | workspaces:write | Organisation |