Automations
Manage the decision flows that tell the avatar what to do in each situation.
An automation (decision flow) is a list of situations the avatar watches for during a conversation. Each situation is a block with:
- When: a description of the situation, such as "the customer wants to book a visit".
- What to answer: instructions for the reply in that situation.
- Actions (optional): agents that run when the block is chosen, such as calling your API, opening a ticket or saving data.
At every message, the avatar checks which blocks match and follows them. In the platform, these flows are under Automations.
With these calls you can read, create and change automations from your system, and get the catalogs you need to build them: ready-made templates, AI models and available agents.
List automations
ReferenceTechnical details
POST /api/externalAPIs/public/tolkyReasoning/decisions/list
| Parameter | Type | Required | Description |
|---|---|---|---|
hostId | string (UUID) | Yes | Your account ID. |
avatarId | string (UUID) | No | Returns the automations of this avatar plus the account-wide ones. Without it, only account-wide automations. |
avatarIds | array of UUID | No | Same as avatarId, for several avatars. |
includeUnpublished | boolean | No | Also returns unpublished drafts. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/decisions/list" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "hostId": "<your-host-id>", "avatarId": "0d4e8f2a-..." }'Returns an array, newest first. Each item has id, hostId, avatarId (null for account-wide), decisionName, decisionType, active, instructions, model, modelProvider, templateRef, createdAt, updatedAt and the blocks in chainJson. Results are cached for up to 5 minutes.
Create or update an automation
Send id to update an automation; without it, a new one is created. Each save also records a version of the blocks.
ReferenceTechnical details
POST /api/externalAPIs/public/tolkyReasoning/decisions/save
Authentication: host token, or domain token with hostId of an account in your domain.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | To update | Automation to update. It must belong to your account. |
hostId | string (UUID) | With a domain token | Account of the automation. With a host token, the token's account is used. |
avatarId | string (UUID) | No | Avatar of the automation. Without it, the automation applies to all avatars of the account. |
decisionName | string | No | Name. |
chainJson | array | No | The blocks. See below. |
instructions | string | No | General instructions for choosing blocks. An empty string clears them. |
model | string | No | AI model that chooses the blocks, as returned by List models. An unknown name returns 400. |
modelProvider | string | No | Provider of the model, when the same name exists in more than one provider. |
active | boolean | No | Turns the automation on or off. |
decisionValidator | boolean | No | Turns on a second check of each decision. |
templateRef | string | No | Template the automation is based on (see default templates). |
changeDescription | string | No | Note saved with the version. |
Block fields in chainJson:
| Field | Description |
|---|---|
type | Block identifier, unique in the automation. |
description | When the block applies. |
content | Instructions for the answer when the block applies. |
canRepeat | false for actions that must run only once, such as a purchase. |
agents | Actions: each item has agentName, schemaName (both from List agents) and payload. schemaName is required. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/decisions/save" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"decisionName": "Store service",
"avatarId": "0d4e8f2a-...",
"active": true,
"chainJson": [
{
"type": "bookVisit",
"description": "The customer wants to book a visit to the store.",
"content": "Ask for the preferred day and time, then confirm the booking.",
"canRepeat": true,
"agents": []
}
]
}'Returns an array with the saved automation (fields in snake_case).
decisionType accepts only orchestrator. Some advanced fields can only be changed in the platform; sending them returns 400.
Delete an automation
ReferenceTechnical details
DELETE /api/externalAPIs/public/tolkyReasoning/decisions/delete/{automationId}
Authentication: host token (required; other tokens get 400). The automation is marked as deleted.
curl -X DELETE "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/decisions/delete/5b9e2d7c-..." \
-H "Authorization: Bearer $TOLKY_TOKEN"{ "code": 200, "message": "Deleted", "data": {} }404 when the automation does not exist in your account.
Catalogs
Use these calls to build automations: start from a template, pick a model and choose the agents for each block.
Default templatesTechnical details
POST /api/externalAPIs/public/tolkyReasoning/decisions/listDefaultChains
| Parameter | Type | Required | Description |
|---|---|---|---|
hostId | string (UUID) | Yes | Your account ID. Only templates available to your account are returned. |
Returns the templates with their blocks (chainJson), model and description.
List modelsTechnical details
POST /api/externalAPIs/public/tolkyReasoning/decisions/listModels
No body. Returns the AI models you can use in automations, avatars and follow-up, grouped by provider.
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/decisions/listModels" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'{
"code": 200,
"message": "OK",
"data": [
{ "id": 1, "provider": "openai", "models": [{ "id": 12, "name": "gpt-4.1-mini" }] }
]
}List agentsTechnical details
POST /api/externalAPIs/public/tolkyReasoning/decisions/listAgents
| Parameter | Type | Required | Description |
|---|---|---|---|
hostId | string (UUID) | Yes | Your account ID. |
Returns agents and schemas. Each agent has id, agentName, schemaName, schemaId, frontName (display name), description, advanced, lucideIcon and frontSchema (the fields its payload accepts). Results are cached for up to 20 minutes.
Generate an agent payloadTechnical details
POST /api/externalAPIs/public/tolkyReasoning/decisions/generateAgent
Fills the payload of an agent for you from a plain-language description. For example, paste a curl command of your API and get the REST agent ready to use in a block.
| Parameter | Type | Required | Description |
|---|---|---|---|
agent | object | Yes | The agent as returned by List agents, including frontSchema. |
instructions | string | No | What the agent should do, or a curl command to convert. |
Returns the agent with its fields filled. Fields the AI could not determine stay null: review them before saving.
Errors
ErrorsTechnical details
| Status | When |
|---|---|
400 | Invalid field, unknown model, agent without schemaName, or restricted field. |
401 | Invalid token (save, delete). |
403 | hostId is not an account your token can reach (save). |
404 | The automation or avatar does not exist in your account. |
408 | The request took more than 60 seconds. |
500 | Internal error. |
You can also create and edit automations by describing them in plain language with the Flow Assistant.