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 (
projectIdisnull), 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 withoutform_idtakes 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
| Parameter | Type | Required | Description |
|---|---|---|---|
page | number | No | Page number (default: 1) |
per_page | number | No | Items 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
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Form identifier |
name | string | Name of the form, for whoever manages it. It is not part of what an integration reads |
intentCategory | string | Category of the activities that answer it: ONBOARDING, MARKETING, COLLECTION, RETENTION, NOTIFICATION, SURVEY, VALIDATION, SALES, CREDIT, OPERATIONAL or DIGITAL_ADOPTION |
projectId | string (UUID) | null | Project the form belongs to; null when it belongs to the tenant |
isDefault | boolean | Whether it is the default form of its pair: project and category, or tenant and category |
version | number | Version of the sections in this response. It changes only when the content changes |
createdAt | string (ISO 8601) | Creation date of the form |
updatedAt | string (ISO 8601) | Changes with any change to the form: a new version, its name or its default mark |
sections | array | Content of the version — see Form structure. Here a DATE question can also carry valueRules (see Value rules) |
Error Responses
| Status | Description |
|---|---|
400 | page or per_page is not valid |
403 | Missing 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
| Parameter | Type | Required | Description |
|---|---|---|---|
version | number | No | Version 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
| Status | Description |
|---|---|
400 | id is not a valid UUID, or version is not an integer from 1 to 2147483647 |
403 | Missing activity:view permission |
404 | The 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 |
404 | The 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
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name of the form, 1 to 255 characters |
intentCategory | string | Yes | Category of the activities that will answer it. It cannot be changed afterwards |
sections | array | Yes | Content of version 1: 1 to 50 sections. It must comply with the content rules |
isDefault | boolean | No | Marks 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.jsonimport 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
| Status | Description |
|---|---|
400 | Validation 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 |
403 | Missing activity-config:manage permission |
422 | sections 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
sectionsis 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
| Field | Type | Required | Description |
|---|---|---|---|
sections | array | Yes | The 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.jsonimport 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 versionResponse 201 Created
The form with the new version and its sections, with the shape of GET /api/activity-forms/:id.
Error Responses
| Status | Description |
|---|---|
400 | id is not a valid UUID, or validation error in the body (see Body limits) |
403 | Missing activity-config:manage permission |
403 | The 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 |
404 | The form does not exist, or belongs to another project than the one of the request — code: ACTIVITY_FORM_NOT_FOUND |
422 | sections 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.
| Field | Type | Description |
|---|---|---|
name | string | New name, 1 to 255 characters |
isDefault | boolean | true 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
| Status | Description |
|---|---|
400 | id is not a valid UUID, or validation error in the body |
403 | Missing activity-config:manage permission |
403 | The form is written from another scope than its own — code: ACTIVITY_FORM_SCOPE_MISMATCH |
404 | The form does not exist, or belongs to another project than the one of the request — code: ACTIVITY_FORM_NOT_FOUND |
409 | isDefault: 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.
code | Rule | question |
|---|---|---|
DUPLICATE_QUESTION_KEY | The key of a question is unique in the form, across sections | The repeated key |
DUPLICATE_OPTION_CODE | The code of an option is unique within its question | The question that repeats it |
INVALID_CONDITION_REFERENCE | A condition refers to a question that comes earlier in the form | The question that carries the condition, also when it is on one of its options |
INVALID_CONDITION_VALUE | A condition uses an operator that fits the type of the question it refers to, and only codes that question offers | The question that carries the condition |
RESERVED_KEY_INVALID_TYPE | comment is SHORT_TEXT or LONG_TEXT; future_scheduled_at is DATE; modality is SINGLE_CHOICE and only offers visit and remote, or one of them | The reserved key |
CODE_QUESTION_MISSING | The form has a question with the key code | code |
CODE_QUESTION_INVALID | The code question is SINGLE_CHOICE, carries required: true and has no visibleWhen | code |
CODE_OTHER_OPTION_REQUIRED | The code question offers the option other, without visibleWhen | code |
CODE_NOT_ALLOWED_IN_CATEGORY | Every option of the code question is a result code admitted by the category of the form | code |
FUTURE_SCHEDULED_AT_NOT_COVERED | For every option of code whose result code requires a date, choosing it leaves future_scheduled_at visible and required | future_scheduled_at |
SALES_SUCCESS_OPTION_REQUIRED | In a SALES form, the code question offers the option success, without visibleWhen | code |
SALES_SUCCESS_NOT_SUFFICIENT | In a SALES form, a result that only answers code with success is valid: no other question is required with only that answer | The question that is left required |
- The rules that look at the options of
codeare not reported while the question is missing or is notSINGLE_CHOICE, andSALES_SUCCESS_NOT_SUFFICIENTis 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_atcounts as visible when it has novisibleWhen, and as required when it carriesrequired: true; avisibleWhenor arequiredWhencounts only if it is a condition oncodewithEQUALSorINthat names the code, alone or as a direct child of anORgroup. - 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 itscodequestion the result codes that category admits, and in therequiredWhenoffuture_scheduled_atthe 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:
| Field | Type | Description |
|---|---|---|
minDaysFromToday | number | The 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
| Where | Limit |
|---|---|
sections | 1 to 50 sections |
| Section | label is optional, 1 to 255 characters; questions, 1 to 100 |
Question key, option code | Up to 64 characters: it starts with a lowercase letter and only admits lowercase letters, digits and underscores |
label of a question or an option | 1 to 255 characters |
subtitle, warning | 1 to 500 characters |
options | Required on SINGLE_CHOICE and MULTIPLE_CHOICE questions, 1 to 200 options; not admitted on the other types |
required and requiredWhen | They do not go together on the same question |
valueRules | Only on DATE questions |
| Conditions | Up 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 properties | Omit the ones that do not apply: null responds 400 |