Forms (FormFlow)
Read the forms your avatar fills during conversations, create or change them, and fetch the values it captured for each contact.
FormFlow lets the avatar collect structured data while it talks: name, e-mail, the product of interest, a budget. You define what to collect, and the avatar fills it in from the conversation, without a fixed questionnaire.
Concepts
| Concept | What it is |
|---|---|
| Variable | One piece of data to capture, such as customer_email. It has a key, a label, a data type (text, number, date, e-mail, phone and others) and a scope. |
| Form | A named group of variables with instructions for the avatar. In the API a form is called a catalog. |
| Scope | Where a value belongs. A lead value follows the contact across conversations. A conversation value belongs to one conversation. |
| Capture | The avatar reading the conversation and saving values to the form. By default it runs at every message. It can also be deferred and run when the conversation goes quiet. |
You manage forms and variables in Forms. Use the API to read them from your own system, to create or adjust forms in bulk, and to fetch the captured values of your contacts.
ReferenceTechnical details
All endpoints use a host token (Authorization: Bearer $TOLKY_TOKEN). The account is taken from the token.
| Purpose | Method and path |
|---|---|
| List forms | POST /api/externalAPIs/public/formFlow/getFormCatalogs |
| Get a form's schema | POST /api/externalAPIs/public/formFlow/getCatalogSchema |
| Create a form | POST /api/externalAPIs/public/formFlow/createCatalog |
| Update a form | PUT /api/externalAPIs/public/formFlow/updateCatalog/{catalogId} |
| Get captured values | POST /api/externalAPIs/public/formFlow/getValues |
List forms
| Name | Type | Required | Description |
|---|---|---|---|
avatarId | string | No | Only forms linked to this avatar. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/formFlow/getFormCatalogs" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'data is an array of active forms. Each item has id, name, is_active, capture_trigger, stop_capture_when_complete, generalInstructions and forms[]. Inside forms[] you find total_fields, total_responses, scope and variables[] (each with id, key_name and data_type).
Get a form's schema
Returns the form as a JSON Schema, ready to use for structured extraction.
| Name | Type | Required | Description |
|---|---|---|---|
catalogId | string | Yes | Form ID. |
{
"code": 200,
"message": "OK",
"data": {
"catalogId": "3f0c2a8e-...",
"name": "Contact form",
"scope": "lead",
"generalInstructions": "Collect the customer's contact details.",
"totalFields": 1,
"schema": { "name": "form_3f0c2a8e-...", "parameters": { "type": "object", "properties": { "customer_email": { "type": "string" } } } },
"fields": [
{ "variableId": "3f0c2a8e-...", "keyName": "customer_email", "propertyKey": "customer_email", "label": "Customer e-mail", "dataType": "email", "required": true, "captureStrategy": "overwrite", "orderIndex": 0 }
]
}
}captureStrategy is overwrite (a new value replaces the old one) or append.
Create a form
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique within your account. |
scope | string | Yes | lead or conversation. |
avatarId | string | No | Avatar the form belongs to. |
generalInstructions | string | No | What the avatar should know when filling the form. |
variableIds | string[] | No | Existing variables to include, in order. |
captureTrigger | string | No | every_message (default) or deferred. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/formFlow/createCatalog" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Contact form",
"scope": "lead",
"generalInstructions": "Collect the customer contact details.",
"variableIds": ["3f0c2a8e-..."]
}'The response is the created form.
Update a form
Put the form ID in the path and in the body as catalogId. Send only what changes.
| Name | Type | Required | Description |
|---|---|---|---|
catalogId | string | Yes | Form ID. |
name | string | No | New name. |
generalInstructions | string | No | New instructions. |
scope | string | No | New scope. |
avatarId | string | No | New avatar. |
variableIds | string[] | No | Replaces the form's variables. |
isActive | boolean | No | Turn the form on or off. Use camelCase: is_active is rejected. |
captureTrigger | string | No | every_message or deferred. |
curl -X PUT "https://api.tolky.to/api/externalAPIs/public/formFlow/updateCatalog/3f0c2a8e-..." \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "catalogId": "3f0c2a8e-...", "isActive": false }'Get captured values
| Name | Type | Required | Description |
|---|---|---|---|
leadIds | string[] | Yes | Contacts whose values you want. |
{
"code": 200,
"message": "OK",
"data": {
"values": [
{
"variable_id": "3f0c2a8e-...",
"key_name": "customer_email",
"value": "maria@example.com",
"form_id": "3f0c2a8e-...",
"lead_id": "3f0c2a8e-...",
"expires_at": null,
"edit_source": "ai_capture",
"previews_values": []
}
]
}
}| Field | Description |
|---|---|
value | Current value. |
edit_source | Who set it. ai_capture means the avatar captured it. |
expires_at | When the value expires, if the variable has an expiry. |
previews_values | Earlier values that differ from the current one, newest first. |
Errors
| Code | When |
|---|---|
400 | Missing or invalid field, such as no catalogId, an invalid captureTrigger or is_active in snake_case. |
403 | The form is the system's registration form, which cannot be changed. |
409 | A form with the same name already exists. |
500 | Other errors, with the reason in message. |