Developers
ENPT

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

ConceptWhat it is
VariableOne 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.
FormA named group of variables with instructions for the avatar. In the API a form is called a catalog.
ScopeWhere a value belongs. A lead value follows the contact across conversations. A conversation value belongs to one conversation.
CaptureThe 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.

PurposeMethod and path
List formsPOST /api/externalAPIs/public/formFlow/getFormCatalogs
Get a form's schemaPOST /api/externalAPIs/public/formFlow/getCatalogSchema
Create a formPOST /api/externalAPIs/public/formFlow/createCatalog
Update a formPUT /api/externalAPIs/public/formFlow/updateCatalog/{catalogId}
Get captured valuesPOST /api/externalAPIs/public/formFlow/getValues

List forms

NameTypeRequiredDescription
avatarIdstringNoOnly 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.

NameTypeRequiredDescription
catalogIdstringYesForm 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

NameTypeRequiredDescription
namestringYesUnique within your account.
scopestringYeslead or conversation.
avatarIdstringNoAvatar the form belongs to.
generalInstructionsstringNoWhat the avatar should know when filling the form.
variableIdsstring[]NoExisting variables to include, in order.
captureTriggerstringNoevery_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.

NameTypeRequiredDescription
catalogIdstringYesForm ID.
namestringNoNew name.
generalInstructionsstringNoNew instructions.
scopestringNoNew scope.
avatarIdstringNoNew avatar.
variableIdsstring[]NoReplaces the form's variables.
isActivebooleanNoTurn the form on or off. Use camelCase: is_active is rejected.
captureTriggerstringNoevery_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

NameTypeRequiredDescription
leadIdsstring[]YesContacts 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": []
      }
    ]
  }
}
FieldDescription
valueCurrent value.
edit_sourceWho set it. ai_capture means the avatar captured it.
expires_atWhen the value expires, if the variable has an expiry.
previews_valuesEarlier values that differ from the current one, newest first.

Errors

CodeWhen
400Missing or invalid field, such as no catalogId, an invalid captureTrigger or is_active in snake_case.
403The form is the system's registration form, which cannot be changed.
409A form with the same name already exists.
500Other errors, with the reason in message.

Previous

Tickets

Next

Doc Analyzer