Reten Docs

Task Result Type Configs

Per-tenant configuration of active result types.

GET /api/task-result-type-configs

List all tenant result type configurations.

Auth: Required — activity:view permission

Example

curl https://api.reten.ai/api/task-result-type-configs \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>"
import axios from 'axios';

const response = await axios.get(
  'https://api.reten.ai/api/task-result-type-configs',
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

const configs = response.data;

Response 200 OK

[
  {
    "id": "880e8400-e29b-41d4-a716-446655440000",
    "code": "success",
    "label": "✅ Venta",
    "isEffective": true,
    "requiresFutureScheduledAt": false,
    "isActive": true,
    "createdAt": "2026-06-18T06:00:00.000Z",
    "updatedAt": "2026-06-18T06:00:00.000Z"
  },
  {
    "id": "990e8400-e29b-41d4-a716-446655440000",
    "code": "decision_maker_unavailable",
    "label": "👤 No se encuentra",
    "isEffective": false,
    "requiresFutureScheduledAt": false,
    "isActive": true,
    "createdAt": "2026-06-18T06:00:00.000Z",
    "updatedAt": "2026-06-18T06:00:00.000Z"
  }
]

GET /api/task-result-type-configs/defaults

Return the platform default result types as a flat { code, label, isEffective, requiresFutureScheduledAt } catalog, with the classification each default is created with. The admin app uses this to prefill the import dialog with the result types a tenant can adopt.

Auth: Required — activity:view permission

This endpoint is prefill, not an entity. The payload is the hardcoded defaults catalog — non-authoritative and NOT persisted — and always lists every default regardless of what the tenant already has. To adopt them, the admin picks the ones that are still missing and creates them via POST /api/task-result-type-configs/bulk. Nothing is created by calling this endpoint.

Example

curl https://api.reten.ai/api/task-result-type-configs/defaults \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>"
import axios from 'axios';

const response = await axios.get(
  'https://api.reten.ai/api/task-result-type-configs/defaults',
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

const defaults = response.data;

Response 200 OK

[
  {
    "code": "success",
    "label": "✅ Venta",
    "isEffective": true,
    "requiresFutureScheduledAt": false
  },
  {
    "code": "decision_maker_unavailable",
    "label": "👤 No se encuentra",
    "isEffective": false,
    "requiresFutureScheduledAt": false
  },
  {
    "code": "visit_rescheduled",
    "label": "📅 Cliente pide reagendar visita",
    "isEffective": true,
    "requiresFutureScheduledAt": true
  }
]

POST /api/task-result-type-configs

Create a tenant result type configuration.

Auth: Required — activity-config:manage permission

Request Body

FieldTypeRequiredDescription
codestringYesUnique code identifying this result type in the tenant catalog. Only lowercase letters, digits and underscores (^[a-z0-9_]+$), up to 100 characters
labelstringYesDisplay label for this tenant
is_effectivebooleanYesWhether a result with this code counts as effective: the customer expressed a preference (they bought, don't need it, can't, aren't interested, or agreed on another date). false when the customer didn't respond, for example the store was closed. It does not depend on requires_future_scheduled_at. The key is mandatory: omitting it or sending null responds 400
requires_future_scheduled_atbooleanNoIf true, every result with this code submitted without answers must include future_scheduled_at. In a result submitted with the answers to a form, the form decides whether the date is required. Defaults to false when omitted; null responds 400

Example

curl -X POST https://api.reten.ai/api/task-result-type-configs \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "no_answer_whatsapp",
    "label": "No contesta WhatsApp",
    "is_effective": false
  }'
import axios from 'axios';

const response = await axios.post(
  'https://api.reten.ai/api/task-result-type-configs',
  {
    code: 'no_answer_whatsapp',
    label: 'No contesta WhatsApp',
    is_effective: false,
  },
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

Response 201 Created

{
  "id": "aa0e8400-e29b-41d4-a716-446655440000",
  "code": "no_answer_whatsapp",
  "label": "No contesta WhatsApp",
  "isEffective": false,
  "requiresFutureScheduledAt": false,
  "isActive": true,
  "createdAt": "2026-06-18T06:00:00.000Z",
  "updatedAt": "2026-06-18T06:00:00.000Z"
}

Error Responses

StatusDescription
400code does not match ^[a-z0-9_]+$ or is longer than 100 characters
400Invalid body: code or label missing, empty or null, is_effective missing or null, requires_future_scheduled_at sent as null, a field with the wrong type, or an unknown field
409A config with that code already exists in the tenant, also if it is deactivated — code: TASK_RESULT_TYPE_CODE_TAKEN

POST /api/task-result-type-configs/bulk

Bulk create tenant result type configurations.

Auth: Required — activity-config:manage permission

Request Body

FieldTypeRequiredDescription
itemsarrayYesArray of configurations to create
items[].codestringYesUnique code identifying this result type in the tenant catalog. Only lowercase letters, digits and underscores (^[a-z0-9_]+$), up to 100 characters
items[].labelstringYesDisplay label for this tenant
items[].is_effectivebooleanYesSame as is_effective in POST /api/task-result-type-configs: mandatory, and null responds 400
items[].requires_future_scheduled_atbooleanNoSame as requires_future_scheduled_at in POST /api/task-result-type-configs: false when omitted, and null responds 400

If any item lacks the is_effective key or sends one of the two flags as null, the API responds 400 naming the item (for example items.1.is_effective) and creates none of them.

Example

curl -X POST https://api.reten.ai/api/task-result-type-configs/bulk \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "code": "whatsapp_unread",
        "label": "No lee el WhatsApp",
        "is_effective": false
      },
      {
        "code": "whatsapp_callback",
        "label": "Pide que le escriban otro día",
        "is_effective": true,
        "requires_future_scheduled_at": true
      }
    ]
  }'
import axios from 'axios';

const response = await axios.post(
  'https://api.reten.ai/api/task-result-type-configs/bulk',
  {
    items: [
      {
        code: 'whatsapp_unread',
        label: 'No lee el WhatsApp',
        is_effective: false,
      },
      {
        code: 'whatsapp_callback',
        label: 'Pide que le escriban otro día',
        is_effective: true,
        requires_future_scheduled_at: true,
      },
    ],
  },
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

Response 201 Created

[
  {
    "id": "bb0e8400-e29b-41d4-a716-446655440000",
    "code": "whatsapp_unread",
    "label": "No lee el WhatsApp",
    "isEffective": false,
    "requiresFutureScheduledAt": false,
    "isActive": true,
    "createdAt": "2026-06-18T06:00:00.000Z",
    "updatedAt": "2026-06-18T06:00:00.000Z"
  },
  {
    "id": "cc0e8400-e29b-41d4-a716-446655440000",
    "code": "whatsapp_callback",
    "label": "Pide que le escriban otro día",
    "isEffective": true,
    "requiresFutureScheduledAt": true,
    "isActive": true,
    "createdAt": "2026-06-18T06:00:00.000Z",
    "updatedAt": "2026-06-18T06:00:00.000Z"
  }
]

Error Responses

StatusDescription
400Two items share the same code
400An item's code does not match ^[a-z0-9_]+$ or is longer than 100 characters
400Invalid body: items missing or not an array, an item with code or label missing, empty or null, an item with is_effective missing or null, an item with requires_future_scheduled_at sent as null, a field with the wrong type, or an unknown field
409An item's code is already taken in the tenant, also by a deactivated config. No config is created — code: TASK_RESULT_TYPE_CODE_TAKEN

PATCH /api/task-result-type-configs/:id

Update a tenant result type configuration.

Auth: Required — activity-config:manage permission

Request Body

FieldTypeRequiredDescription
labelstringNoDisplay label. If sent, it cannot be empty or null (400).
is_activebooleanNoEnable or disable this config. If sent, it cannot be null (400).
is_effectivebooleanNoReclassify whether a result with this code counts as effective (the customer expressed a preference). It does not change results already registered, which keep their own mark. If sent, it cannot be null (400).
requires_future_scheduled_atbooleanNoIf true, every result with this code submitted after the change must include future_scheduled_at. If sent, it cannot be null (400).

Example

curl -X PATCH https://api.reten.ai/api/task-result-type-configs/<id> \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "is_active": false
  }'
import axios from 'axios';

const response = await axios.patch(
  'https://api.reten.ai/api/task-result-type-configs/<id>',
  {
    is_active: false,
  },
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

Response 200 OK

{
  "id": "880e8400-e29b-41d4-a716-446655440000",
  "code": "success",
  "label": "✅ Venta",
  "isEffective": true,
  "requiresFutureScheduledAt": false,
  "isActive": false,
  "createdAt": "2026-06-18T06:00:00.000Z",
  "updatedAt": "2026-07-02T15:30:00.000Z"
}

Error Responses

StatusDescription
400id is not a valid UUID
400Invalid body: a field sent as null or with the wrong type, an empty label, or an unknown field
404No config exists with that id in the tenant — code: TASK_RESULT_TYPE_NOT_FOUND

DELETE /api/task-result-type-configs/:id

Deactivate a tenant result type configuration.

Auth: Required — activity-config:manage permission

Example

curl -X DELETE https://api.reten.ai/api/task-result-type-configs/<id> \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>"
import axios from 'axios';

const response = await axios.delete(
  'https://api.reten.ai/api/task-result-type-configs/<id>',
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

Response 204 No Content

Error Responses

StatusDescription
400id is not a valid UUID
404No config exists with that id in the tenant — code: TASK_RESULT_TYPE_NOT_FOUND