Reten Docs

Activity Forms

Result forms that task-type activities are answered with — per project or per tenant, with versions.

A result form defines the questions a task-type activity is answered with. Every task carries the id of one form, and its result can be submitted as the answers to it — see Submit Result.

  • A form belongs to a project or the tenant (projectId is null), and that never changes after it is created. Neither does its category (intentCategory).
  • The content of a form — its sections — lives in versions. A version never changes: saving new content creates the next version, which becomes the current one.
  • Each pair of project and category, and each pair of tenant and category, has at most one default form (isDefault). A task created without form_id takes the default of its category — see Scope and default forms.

The structure of sections — sections, questions, types, options, the visibleWhen and requiredWhen conditions, the code question and the reserved keys — is documented once, in List Forms › Form structure. This page adds what is specific to writing a form.

Every endpoint of this page is project-optional: x-project-id is optional, and it decides which forms a request reaches and where a form is created.

GET /api/activity-forms

List the forms within reach of the request, each one with the content of its current version, from the oldest to the newest.

Auth: Required — activity:view permission

The list carries the forms the request reaches: see Scope and default forms.

Query Parameters

ParameterTypeRequiredDescription
pagenumberNoPage number (default: 1)
per_pagenumberNoItems per page (default: 25, max: 100)

The list has no filters.

Example

curl "https://api.reten.ai/api/activity-forms?page=1&per_page=25" \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>"
import axios from 'axios';

const response = await axios.get('https://api.reten.ai/api/activity-forms', {
  params: { page: 1, per_page: 25 },
  headers: {
    Authorization: 'Bearer <token>',
    'x-tenant-id': '<tenant-id>',
  },
});

const { data, pagination } = response.data;

Response 200 OK

{
  "data": [
    {
      "id": "5d2f8c1e-7a43-4b96-8e0d-3c9a1f6b2d74",
      "name": "Encuesta de satisfacción",
      "intentCategory": "SURVEY",
      "projectId": "3f6c2b1a-8d4e-4f7a-9b2c-5e1d0a7f6c34",
      "isDefault": false,
      "version": 1,
      "createdAt": "2026-11-02T14:30:00.000Z",
      "updatedAt": "2026-11-02T14:30:00.000Z",
      "sections": [
        {
          "questions": [
            {
              "key": "code",
              "type": "SINGLE_CHOICE",
              "label": "¿Cómo terminó la gestión?",
              "required": true,
              "options": [
                { "code": "success", "label": "Encuesta respondida" },
                { "code": "call_rescheduled", "label": "Pide que lo llamen otro día" },
                { "code": "other", "label": "Otro" }
              ]
            },
            {
              "key": "future_scheduled_at",
              "type": "DATE",
              "label": "¿Para cuándo queda agendada?",
              "requiredWhen": {
                "question": "code",
                "operator": "IN",
                "value": ["call_rescheduled"]
              },
              "valueRules": { "minDaysFromToday": 1 }
            },
            {
              "key": "comment",
              "type": "LONG_TEXT",
              "label": "Comentarios"
            }
          ]
        }
      ]
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 25,
    "total": 11,
    "total_pages": 1,
    "has_next": false,
    "has_previous": false
  }
}

Form Fields

FieldTypeDescription
idstring (UUID)Form identifier
namestringName of the form, for whoever manages it. It is not part of what an integration reads
intentCategorystringCategory of the activities that answer it: ONBOARDING, MARKETING, COLLECTION, RETENTION, NOTIFICATION, SURVEY, VALIDATION, SALES, CREDIT, OPERATIONAL or DIGITAL_ADOPTION
projectIdstring (UUID) | nullProject the form belongs to; null when it belongs to the tenant
isDefaultbooleanWhether it is the default form of its pair: project and category, or tenant and category
versionnumberVersion of the sections in this response. It changes only when the content changes
createdAtstring (ISO 8601)Creation date of the form
updatedAtstring (ISO 8601)Changes with any change to the form: a new version, its name or its default mark
sectionsarrayContent of the version — see Form structure. Here a DATE question can also carry valueRules (see Value rules)

Error Responses

StatusDescription
400page or per_page is not valid
403Missing activity:view permission

GET /api/activity-forms/:id

Return one form with the content of its current version, or of the version named in ?version.

Auth: Required — activity:view permission

Query Parameters

ParameterTypeRequiredDescription
versionnumberNoVersion to read, an integer from 1 to 2147483647. Without it, the response carries the current version

Example

curl "https://api.reten.ai/api/activity-forms/5d2f8c1e-7a43-4b96-8e0d-3c9a1f6b2d74?version=1" \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>"
import axios from 'axios';

const formId = '5d2f8c1e-7a43-4b96-8e0d-3c9a1f6b2d74';

const response = await axios.get(
  `https://api.reten.ai/api/activity-forms/${formId}`,
  {
    params: { version: 1 },
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

const form = response.data;

Response 200 OK

{
  "id": "5d2f8c1e-7a43-4b96-8e0d-3c9a1f6b2d74",
  "name": "Encuesta de satisfacción",
  "intentCategory": "SURVEY",
  "projectId": "3f6c2b1a-8d4e-4f7a-9b2c-5e1d0a7f6c34",
  "isDefault": false,
  "version": 1,
  "createdAt": "2026-11-02T14:30:00.000Z",
  "updatedAt": "2026-11-02T14:30:00.000Z",
  "sections": [
    {
      "questions": [
        {
          "key": "code",
          "type": "SINGLE_CHOICE",
          "label": "¿Cómo terminó la gestión?",
          "required": true,
          "options": [
            { "code": "success", "label": "Encuesta respondida" },
            { "code": "call_rescheduled", "label": "Pide que lo llamen otro día" },
            { "code": "other", "label": "Otro" }
          ]
        },
        {
          "key": "future_scheduled_at",
          "type": "DATE",
          "label": "¿Para cuándo queda agendada?",
          "requiredWhen": {
            "question": "code",
            "operator": "IN",
            "value": ["call_rescheduled"]
          },
          "valueRules": { "minDaysFromToday": 1 }
        },
        {
          "key": "comment",
          "type": "LONG_TEXT",
          "label": "Comentarios"
        }
      ]
    }
  ]
}

Error Responses

StatusDescription
400id is not a valid UUID, or version is not an integer from 1 to 2147483647
403Missing activity:view permission
404The form does not exist, or belongs to another project than the one of the request — No existe el formulario 5d2f8c1e-7a43-4b96-8e0d-3c9a1f6b2d74. — code: ACTIVITY_FORM_NOT_FOUND
404The form does not have that version — El formulario 5d2f8c1e-7a43-4b96-8e0d-3c9a1f6b2d74 no tiene la versión 9. — code: ACTIVITY_FORM_VERSION_NOT_FOUND

POST /api/activity-forms

Create a form with its first version.

Auth: Required — activity-config:manage permission

The form is created in the scope of the request: with x-project-id, it belongs to that project; without it, to the tenant. The body does not carry a project.

Request Body

FieldTypeRequiredDescription
namestringYesName of the form, 1 to 255 characters
intentCategorystringYesCategory of the activities that will answer it. It cannot be changed afterwards
sectionsarrayYesContent of version 1: 1 to 50 sections. It must comply with the content rules
isDefaultbooleanNoMarks the form as the default of its pair (default: false). The form that had the mark in that pair loses it. null responds 400

Example

curl -X POST https://api.reten.ai/api/activity-forms \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "x-project-id: <project-id>" \
  -H "Content-Type: application/json" \
  -d @form.json
import axios from 'axios';

// `form` is the JSON body shown below
const response = await axios.post(
  'https://api.reten.ai/api/activity-forms',
  form,
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
      'x-project-id': '<project-id>',
    },
  }
);

const created = response.data;
{
  "name": "Encuesta de satisfacción",
  "intentCategory": "SURVEY",
  "isDefault": false,
  "sections": [
    {
      "questions": [
        {
          "key": "code",
          "type": "SINGLE_CHOICE",
          "label": "¿Cómo terminó la gestión?",
          "required": true,
          "options": [
            { "code": "success", "label": "Encuesta respondida" },
            { "code": "call_rescheduled", "label": "Pide que lo llamen otro día" },
            { "code": "other", "label": "Otro" }
          ]
        },
        {
          "key": "future_scheduled_at",
          "type": "DATE",
          "label": "¿Para cuándo queda agendada?",
          "requiredWhen": {
            "question": "code",
            "operator": "IN",
            "value": ["call_rescheduled"]
          },
          "valueRules": { "minDaysFromToday": 1 }
        },
        {
          "key": "comment",
          "type": "LONG_TEXT",
          "label": "Comentarios"
        }
      ]
    }
  ]
}

Response 201 Created

The created form, with version 1 and the shape of GET /api/activity-forms/:id.

Error Responses

StatusDescription
400Validation error in the body: a missing or invalid field, a limit exceeded (see Body limits), or a field that is not part of the body, such as projectId
403Missing activity-config:manage permission
422sections breaks at least one content rule; all of them come in errors (see Content rules) — code: INVALID_ACTIVITY_FORM

POST /api/activity-forms/:id/versions

Save new content for a form, as its next version.

Auth: Required — activity-config:manage permission

  • The new version becomes the current one. Earlier versions are not touched, and can still be read with ?version.
  • Saving always creates the next version, even when sections is identical to the current one.
  • The activities that carry the form keep the same formId. A result answered with an earlier version is still validated against the version it names.
  • The content is validated against the category of the form, with the content rules in force at that moment. A version that is already saved is not validated again.

Request Body

FieldTypeRequiredDescription
sectionsarrayYesThe complete content of the new version: 1 to 50 sections. It replaces the previous content; it is not merged with it

Example

curl -X POST https://api.reten.ai/api/activity-forms/5d2f8c1e-7a43-4b96-8e0d-3c9a1f6b2d74/versions \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "x-project-id: <project-id>" \
  -H "Content-Type: application/json" \
  -d @sections.json
import axios from 'axios';

const formId = '5d2f8c1e-7a43-4b96-8e0d-3c9a1f6b2d74';

// `sections` is the complete content of the new version
const response = await axios.post(
  `https://api.reten.ai/api/activity-forms/${formId}/versions`,
  { sections },
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
      'x-project-id': '<project-id>',
    },
  }
);

const saved = response.data; // saved.version is the new version

Response 201 Created

The form with the new version and its sections, with the shape of GET /api/activity-forms/:id.

Error Responses

StatusDescription
400id is not a valid UUID, or validation error in the body (see Body limits)
403Missing activity-config:manage permission
403The form is written from another scope than its own — El formulario 5d2f8c1e-7a43-4b96-8e0d-3c9a1f6b2d74 sólo se puede modificar desde su alcance: con su proyecto activo, o sin proyecto si es del tenant. — code: ACTIVITY_FORM_SCOPE_MISMATCH
404The form does not exist, or belongs to another project than the one of the request — code: ACTIVITY_FORM_NOT_FOUND
422sections breaks at least one content rule, and nothing is saved — code: INVALID_ACTIVITY_FORM

PATCH /api/activity-forms/:id

Edit the name and the default mark of a form. It does not create a version.

Auth: Required — activity-config:manage permission

Request Body

All fields are optional: a field that is absent is left untouched. null responds 400.

FieldTypeDescription
namestringNew name, 1 to 255 characters
isDefaultbooleantrue marks the form as the default of its pair, and the form that had the mark loses it. false removes the mark: a project is left without a default for that category, and its tasks take the default of the tenant. The default of the tenant cannot be unmarked — mark another form of its category instead

intentCategory and projectId are not part of the body: sending them responds 400.

Example

curl -X PATCH https://api.reten.ai/api/activity-forms/5d2f8c1e-7a43-4b96-8e0d-3c9a1f6b2d74 \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "x-project-id: <project-id>" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Encuesta de satisfacción 2027", "isDefault": true }'
import axios from 'axios';

const formId = '5d2f8c1e-7a43-4b96-8e0d-3c9a1f6b2d74';

const response = await axios.patch(
  `https://api.reten.ai/api/activity-forms/${formId}`,
  { name: 'Encuesta de satisfacción 2027', isDefault: true },
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
      'x-project-id': '<project-id>',
    },
  }
);

const updated = response.data;

Response 200 OK

The form with the content of its current version, with the shape of GET /api/activity-forms/:id.

Error Responses

StatusDescription
400id is not a valid UUID, or validation error in the body
403Missing activity-config:manage permission
403The form is written from another scope than its own — code: ACTIVITY_FORM_SCOPE_MISMATCH
404The form does not exist, or belongs to another project than the one of the request — code: ACTIVITY_FORM_NOT_FOUND
409isDefault: false on the default form of the tenant — El formulario por defecto del tenant no se puede desmarcar: marca otro de su categoría para reemplazarlo. — code: ACTIVITY_FORM_DEFAULT_REQUIRED

Scope and default forms

Reading. With a project, a request reaches the forms of that project and the ones of the tenant; a form of another project behaves as if it did not exist (404). Without a project, it reaches every form of the tenant, including the ones of each project.

Writing. A form is created in the scope of the request, and it is only modified from that same scope: a form of a project, with that project; a form of the tenant, without a project. Saving a version or editing a form from another scope responds 403 ACTIVITY_FORM_SCOPE_MISMATCH — the request can read the form, but not write it.

Default forms. Every tenant starts with eleven forms of the tenant, one per category, each marked as default. Each one carries the questions defined for its category: always code, comment, future_scheduled_at and modality, plus the questions specific to that category, if it has any.

When a task is created without form_id (Create Activity), it takes the default form of its category in its project and, if the project has none, the default of the tenant. Marking a form of a project as default therefore changes the form of the tasks created in that project from then on; the tasks that already exist keep theirs.

Content rules

sections is validated in two steps. First its shape, against the body limits: a failure responds 400. Then its content, against the rules below: a failure responds 422 with code INVALID_ACTIVITY_FORM, and nothing is saved.

{
  "statusCode": 422,
  "error": "Unprocessable Entity",
  "message": "El formulario tiene 2 errores.",
  "code": "INVALID_ACTIVITY_FORM",
  "errors": [
    {
      "question": "code",
      "code": "CODE_OTHER_OPTION_REQUIRED",
      "message": "La pregunta «code» tiene que ofrecer la opción «other», sin `visibleWhen`."
    },
    {
      "question": "future_scheduled_at",
      "code": "FUTURE_SCHEDULED_AT_NOT_COVERED",
      "message": "«call_rescheduled» exige fecha: con ese código elegido, la pregunta «future_scheduled_at» tiene que quedar visible y requerida."
    }
  ]
}

errors carries every broken rule at once, at most one per rule and question. Each error has question, the key of the affected question; code, which is stable; and message, a text for a person.

codeRulequestion
DUPLICATE_QUESTION_KEYThe key of a question is unique in the form, across sectionsThe repeated key
DUPLICATE_OPTION_CODEThe code of an option is unique within its questionThe question that repeats it
INVALID_CONDITION_REFERENCEA condition refers to a question that comes earlier in the formThe question that carries the condition, also when it is on one of its options
INVALID_CONDITION_VALUEA condition uses an operator that fits the type of the question it refers to, and only codes that question offersThe question that carries the condition
RESERVED_KEY_INVALID_TYPEcomment is SHORT_TEXT or LONG_TEXT; future_scheduled_at is DATE; modality is SINGLE_CHOICE and only offers visit and remote, or one of themThe reserved key
CODE_QUESTION_MISSINGThe form has a question with the key codecode
CODE_QUESTION_INVALIDThe code question is SINGLE_CHOICE, carries required: true and has no visibleWhencode
CODE_OTHER_OPTION_REQUIREDThe code question offers the option other, without visibleWhencode
CODE_NOT_ALLOWED_IN_CATEGORYEvery option of the code question is a result code admitted by the category of the formcode
FUTURE_SCHEDULED_AT_NOT_COVEREDFor every option of code whose result code requires a date, choosing it leaves future_scheduled_at visible and requiredfuture_scheduled_at
SALES_SUCCESS_OPTION_REQUIREDIn a SALES form, the code question offers the option success, without visibleWhencode
SALES_SUCCESS_NOT_SUFFICIENTIn a SALES form, a result that only answers code with success is valid: no other question is required with only that answerThe question that is left required
  • The rules that look at the options of code are not reported while the question is missing or is not SINGLE_CHOICE, and SALES_SUCCESS_NOT_SUFFICIENT is reported only when the content has no other error.
  • A date is covered by the shape of its conditions, not by trying combinations of answers. future_scheduled_at counts as visible when it has no visibleWhen, and as required when it carries required: true; a visibleWhen or a requiredWhen counts only if it is a condition on code with EQUALS or IN that names the code, alone or as a direct child of an OR group.
  • Which codes a category admits, and which ones require a date. The default form of each category, which you can read with GET /api/activity-forms, carries in its code question the result codes that category admits, and in the requiredWhen of future_scheduled_at the ones that require a date. It is the starting point for writing a form.

Value rules

A DATE question can carry valueRules, with one rule:

FieldTypeDescription
minDaysFromTodaynumberThe answered date must be at least the day the activity was handled plus this number of days: 0 accepts that same day, 1 starts tomorrow. An integer from 0 to 365, required when valueRules is sent

The rule is applied when a result is submitted, and a date that breaks it is rejected with OUT_OF_RANGE. Integrations do not receive valueRules when they read the form.

Body limits

WhereLimit
sections1 to 50 sections
Sectionlabel is optional, 1 to 255 characters; questions, 1 to 100
Question key, option codeUp to 64 characters: it starts with a lowercase letter and only admits lowercase letters, digits and underscores
label of a question or an option1 to 255 characters
subtitle, warning1 to 500 characters
optionsRequired on SINGLE_CHOICE and MULTIPLE_CHOICE questions, 1 to 200 options; not admitted on the other types
required and requiredWhenThey do not go together on the same question
valueRulesOnly on DATE questions
ConditionsUp to 5 levels of nesting; a group has 1 to 20 children; IN and NOT_IN take a list of 1 to 200 codes, EQUALS and INCLUDES one code, and ANSWERED no value; no other property is admitted
Optional propertiesOmit the ones that do not apply: null responds 400