Knowledge base
Manage the knowledge bases and content snippets the avatar uses to answer.
The avatar answers from your content. That content is organized in two levels:
- A knowledge base (dataset) is a collection, such as "Products", "Store policies" or "FAQ". You link it to one or more avatars.
- A chunk is one snippet of content inside a knowledge base, such as one product, one rule or one question and answer.
When a customer asks something, the avatar searches the chunks of its knowledge bases and uses the most relevant ones in the answer. Keep chunks short and focused on one subject: they are found more easily.
With these calls you keep the knowledge base in sync with your catalog, prices or policies, without editing anything by hand.
Knowledge bases
ListTechnical details
POST /api/externalAPIs/public/tolkyReasoning/datasets/list
| Parameter | Type | Required | Description |
|---|---|---|---|
hostId | string (UUID) | Yes | Your account ID. |
avatarIds | array of UUID | No | Only knowledge bases linked to these avatars. |
showLinkStatus | boolean | No | Adds visible and deleted to each avatar link. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/datasets/list" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "hostId": "<your-host-id>" }'{
"code": 200,
"message": "OK",
"data": [
{
"id": "6c1f3b9d-...",
"dataset_name": "Products",
"dataset_type": "common_rag",
"host_id": "<your-host-id>",
"created_at": "2026-10-02T12:00:00.000Z",
"updated_at": "2026-11-10T09:30:00.000Z",
"datasets_avatars": [{ "avatar_id": "0d4e8f2a-..." }]
}
]
}CreateTechnical details
POST /api/externalAPIs/public/tolkyReasoning/datasets/create
| Parameter | Type | Required | Description |
|---|---|---|---|
hostId | string (UUID) | Yes | Your account ID. |
datasetName | string | Yes | Name of the knowledge base. |
dataset_type | string | No | common_rag (default) or filtered_rag. |
avatarIds | array of UUID | No | Avatars to link right away. They must belong to your account. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/datasets/create" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "hostId": "<your-host-id>", "datasetName": "Store policies", "avatarIds": ["0d4e8f2a-..."] }'Returns the new knowledge base (id, dataset_name, dataset_type, host_id, created_at, updated_at and its other fields).
EditTechnical details
POST /api/externalAPIs/public/tolkyReasoning/datasets/edit
The fields to change go inside newData. Only knowledge bases of the account in the token are changed.
| Parameter | Type | Required | Description |
|---|---|---|---|
newData.id | string (UUID) | Yes | Knowledge base to edit. |
newData.dataset_name | string | No | New name. |
newData.dataset_type | string | No | common_rag or filtered_rag. |
newData.expires | string (date-time) | No | Expiry date. Expired knowledge bases are no longer listed for the avatar. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/datasets/edit" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "newData": { "id": "6c1f3b9d-...", "dataset_name": "Products 2027" } }'Returns the updated knowledge base.
Link to an avatarTechnical details
POST /api/externalAPIs/public/tolkyReasoning/datasets/linkAvatar
| Parameter | Type | Required | Description |
|---|---|---|---|
datasetId | string (UUID) | Yes | Knowledge base. |
avatarId | string (UUID) | Yes | Avatar that starts using it. Both must belong to the same account. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/datasets/linkAvatar" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "datasetId": "6c1f3b9d-...", "avatarId": "2e7c5a1f-..." }'Returns the link (dataset_id, avatar_id, visible and its other fields). If the link already exists, returns it without creating a new one.
DeleteTechnical details
DELETE /api/externalAPIs/public/tolkyReasoning/datasets/delete/{datasetId}
Authentication: host token (required; other tokens get 400). The knowledge base is removed permanently.
curl -X DELETE "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/datasets/delete/6c1f3b9d-..." \
-H "Authorization: Bearer $TOLKY_TOKEN"{ "code": 200, "message": "Deleted", "data": {} }Chunks
Listing chunks has two modes. Without a question, it returns every active chunk of the knowledge bases you choose. With a question, it runs the same kind of search the avatar does and returns the most similar chunks first: use it to check what the avatar would find for a given question.
List and searchTechnical details
POST /api/externalAPIs/public/tolkyReasoning/chunks/list
| Parameter | Type | Required | Description |
|---|---|---|---|
hostId | string (UUID) | Yes | Your account ID. host_id is also accepted. |
dataset_ids | array of UUID | One of the two | Knowledge bases to read. |
avatar_id | string (UUID) | One of the two | Reads the knowledge bases linked to this avatar. Used when dataset_ids is empty. |
question | string | No | Turns on similarity search. |
match_count | number | No | Maximum results of a search, 1 to 200. Default 30. |
noCache | boolean | No | Skips the 60-second cache of the listing. Searches are never cached. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/chunks/list" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "hostId": "<your-host-id>", "avatar_id": "0d4e8f2a-...", "question": "Do you deliver on Saturdays?" }'Listing response (without question):
{
"code": 200,
"message": "OK",
"data": [
{
"dataset_id": "6c1f3b9d-...",
"dataset_name": "Store policies",
"expires": null,
"chunk_id": "4f2a9c1e-...",
"title": "Delivery days",
"content": "We deliver Monday to Saturday. Saturday deliveries run from 9am to 1pm.",
"expired_at": null,
"last_update": "2026-11-10T09:30:00.000Z",
"token_count": 18,
"search_question": null,
"user_id": null,
"user_name": "Usuário desconhecido"
}
]
}Expired chunks and chunks of deleted knowledge bases are left out. Search results include chunk_id and content; their other fields come from the search and can differ from the listing.
CreateTechnical details
POST /api/externalAPIs/public/tolkyReasoning/chunks/create
| Parameter | Type | Required | Description |
|---|---|---|---|
host_id | string (UUID) | Yes | Your account ID. |
dataset_id | string (UUID) | Yes | Knowledge base that receives the chunk. |
content | string | Yes | The content, in plain text or markdown. |
title | string | No | Short title. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/chunks/create" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"host_id": "<your-host-id>",
"dataset_id": "6c1f3b9d-...",
"title": "Delivery days",
"content": "We deliver Monday to Saturday. Saturday deliveries run from 9am to 1pm."
}'{
"code": 201,
"message": "Created",
"data": {
"chunk_id": "4f2a9c1e-...",
"title": "Delivery days",
"content": "We deliver Monday to Saturday. Saturday deliveries run from 9am to 1pm.",
"dataset_id": "6c1f3b9d-...",
"host_id": "<your-host-id>"
}
}EditTechnical details
POST /api/externalAPIs/public/tolkyReasoning/chunks/edit
Only the fields you send change. Changing content or title updates the search index of the chunk. This route allows up to 120 seconds.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | Yes | Chunk to edit. |
content | string | No | New content. |
title | string | No | New title. |
dataset_id | string (UUID) | No | Moves the chunk to another knowledge base. |
expired_at | string | No | Date after which the chunk is no longer used (ISO 8601). Send the text "null" to remove the expiry. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/chunks/edit" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "id": "4f2a9c1e-...", "content": "We deliver Monday to Saturday, 9am to 6pm.", "expired_at": "2026-12-31T23:59:59Z" }'Returns chunk_id, title, content, dataset_id, host_id, expired_at and embeddings_updated (true when the content changed).
DeleteTechnical details
DELETE /api/externalAPIs/public/tolkyReasoning/chunks/delete/{chunkId}
Authentication: host token (required; other tokens get 400). The chunk is marked as deleted and is no longer used.
curl -X DELETE "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/chunks/delete/4f2a9c1e-..." \
-H "Authorization: Bearer $TOLKY_TOKEN"{ "code": 200, "message": "Deleted", "data": { "id": "4f2a9c1e-...", "deleted": true, "updated_at": "2026-11-16T14:00:00.000Z" } }A chunk already deleted returns data.message = Chunk <id> already deleted.
Errors
ErrorsTechnical details
| Status | When |
|---|---|
400 | A required field is missing, an ID is not a UUID, or the dataset type is invalid. |
404 | The chunk does not exist (delete). |
408 | The request took more than 60 seconds (120 for chunk edit). |
500 | Internal error. |