Developers
ENPT

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

ParameterTypeRequiredDescription
hostIdstring (UUID)YesYour account ID.
avatarIdsarray of UUIDNoOnly knowledge bases linked to these avatars.
showLinkStatusbooleanNoAdds 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

ParameterTypeRequiredDescription
hostIdstring (UUID)YesYour account ID.
datasetNamestringYesName of the knowledge base.
dataset_typestringNocommon_rag (default) or filtered_rag.
avatarIdsarray of UUIDNoAvatars 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.

ParameterTypeRequiredDescription
newData.idstring (UUID)YesKnowledge base to edit.
newData.dataset_namestringNoNew name.
newData.dataset_typestringNocommon_rag or filtered_rag.
newData.expiresstring (date-time)NoExpiry 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

ParameterTypeRequiredDescription
datasetIdstring (UUID)YesKnowledge base.
avatarIdstring (UUID)YesAvatar 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

ParameterTypeRequiredDescription
hostIdstring (UUID)YesYour account ID. host_id is also accepted.
dataset_idsarray of UUIDOne of the twoKnowledge bases to read.
avatar_idstring (UUID)One of the twoReads the knowledge bases linked to this avatar. Used when dataset_ids is empty.
questionstringNoTurns on similarity search.
match_countnumberNoMaximum results of a search, 1 to 200. Default 30.
noCachebooleanNoSkips 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

ParameterTypeRequiredDescription
host_idstring (UUID)YesYour account ID.
dataset_idstring (UUID)YesKnowledge base that receives the chunk.
contentstringYesThe content, in plain text or markdown.
titlestringNoShort 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.

ParameterTypeRequiredDescription
idstring (UUID)YesChunk to edit.
contentstringNoNew content.
titlestringNoNew title.
dataset_idstring (UUID)NoMoves the chunk to another knowledge base.
expired_atstringNoDate 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
StatusWhen
400A required field is missing, an ID is not a UUID, or the dataset type is invalid.
404The chunk does not exist (delete).
408The request took more than 60 seconds (120 for chunk edit).
500Internal error.

Previous

Avatars

Next

MCP servers