Reten Docs

Activity Reason Configs

Per-tenant configuration of active activity reasons.

GET /api/activity-reason-configs

List all tenant activity reason configurations. Each one carries its default intentCategory, or null when the reason is context-dependent.

Auth: Required — activity:view permission

Example

curl https://api.reten.ai/api/activity-reason-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/activity-reason-configs',
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

const configs = response.data;

Response 200 OK

[
  {
    "id": "880e8400-e29b-41d4-a716-446655440000",
    "code": "recurrent",
    "label": "🔁 Reposición de stock",
    "intentCategory": "SALES",
    "isActive": true,
    "createdAt": "2026-06-18T06:00:00.000Z",
    "updatedAt": "2026-06-18T06:00:00.000Z"
  },
  {
    "id": "990e8400-e29b-41d4-a716-446655440000",
    "code": "retain",
    "label": "❤️ Retención",
    "intentCategory": null,
    "isActive": true,
    "createdAt": "2026-06-18T06:00:00.000Z",
    "updatedAt": "2026-06-18T06:00:00.000Z"
  }
]

GET /api/activity-reason-configs/defaults

Return the platform default activity reasons as a flat { code, label, intentCategory } catalog. The admin app uses this to prefill the import dialog with the reasons 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/activity-reason-configs/bulk. Nothing is created by calling this endpoint.

Example

curl https://api.reten.ai/api/activity-reason-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/activity-reason-configs/defaults',
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

const defaults = response.data;

Response 200 OK

[
  {
    "code": "recurrent",
    "label": "🔁 Reposición de stock",
    "intentCategory": "SALES"
  },
  {
    "code": "retain",
    "label": "❤️ Retención",
    "intentCategory": null
  }
]

POST /api/activity-reason-configs

Create a tenant activity reason configuration.

Auth: Required — activity-config:manage permission

Request Body

FieldTypeRequiredDescription
codestringYesUnique code identifying this reason in the tenant catalog. Only lowercase letters, digits and underscores (^[a-z0-9_]+$), up to 100 characters
labelstringYesDisplay label for this tenant
intent_categorystring | nullYesDefault intent category of the reason: ONBOARDING, MARKETING, COLLECTION, RETENTION, NOTIFICATION, SURVEY, VALIDATION, SALES, CREDIT, OPERATIONAL or DIGITAL_ADOPTION, or null for context-dependent. The key is mandatory: omitting it responds 400, it is not taken as null

intent_category: null makes the reason context-dependent: it has no default category, and every task with this reason must report its own. Context-dependent is requested with an explicit null; a body without the key is rejected.

Example

curl -X POST https://api.reten.ai/api/activity-reason-configs \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "retention",
    "label": "Retencion",
    "intent_category": "RETENTION"
  }'
import axios from 'axios';

const response = await axios.post(
  'https://api.reten.ai/api/activity-reason-configs',
  {
    code: 'retention',
    label: 'Retencion',
    intent_category: 'RETENTION',
  },
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

Response 201 Created

{
  "id": "aa0e8400-e29b-41d4-a716-446655440000",
  "code": "retention",
  "label": "Retencion",
  "intentCategory": "RETENTION",
  "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 or unknown field in the body, including a missing intent_category key
409A reason with that code already exists, also if it is deactivated — code: ACTIVITY_REASON_CODE_TAKEN

POST /api/activity-reason-configs/bulk

Bulk create tenant activity reason configurations.

Auth: Required — activity-config:manage permission

Request Body

FieldTypeRequiredDescription
itemsarrayYesArray of configurations to create
items[].codestringYesUnique code identifying this reason in the tenant catalog. Only lowercase letters, digits and underscores (^[a-z0-9_]+$), up to 100 characters
items[].labelstringYesDisplay label for this tenant
items[].intent_categorystring | nullYesSame as intent_category in POST /api/activity-reason-configs: mandatory, one of the categories or null

If any item has an unknown category or lacks the intent_category key, the API responds 400 naming the item (for example items.1.intent_category) and creates none of them.

Example

curl -X POST https://api.reten.ai/api/activity-reason-configs/bulk \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "code": "retention",
        "label": "Retencion",
        "intent_category": "RETENTION"
      },
      {
        "code": "upsell",
        "label": "Upsell",
        "intent_category": "SALES"
      }
    ]
  }'
import axios from 'axios';

const response = await axios.post(
  'https://api.reten.ai/api/activity-reason-configs/bulk',
  {
    items: [
      {
        code: 'retention',
        label: 'Retencion',
        intent_category: 'RETENTION',
      },
      {
        code: 'upsell',
        label: 'Upsell',
        intent_category: 'SALES',
      },
    ],
  },
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

Response 201 Created

[
  {
    "id": "bb0e8400-e29b-41d4-a716-446655440000",
    "code": "retention",
    "label": "Retencion",
    "intentCategory": "RETENTION",
    "isActive": true,
    "createdAt": "2026-06-18T06:00:00.000Z",
    "updatedAt": "2026-06-18T06:00:00.000Z"
  },
  {
    "id": "cc0e8400-e29b-41d4-a716-446655440000",
    "code": "upsell",
    "label": "Upsell",
    "intentCategory": "SALES",
    "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 or unknown field in the body, including an item without the intent_category key
409An item's code is already taken, also by a deactivated reason; the whole batch is rejected — code: ACTIVITY_REASON_CODE_TAKEN

PATCH /api/activity-reason-configs/:id

Update a tenant activity reason 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)
intent_categorystring | nullNoReclassifies the reason into one of the categories listed in POST. Sending null makes it context-dependent. If the key is not sent, the category does not change

A key that is not sent keeps its value, and the response is always the complete config.

Example

curl -X PATCH https://api.reten.ai/api/activity-reason-configs/<id> \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Updated Label"
  }'
import axios from 'axios';

const response = await axios.patch(
  'https://api.reten.ai/api/activity-reason-configs/<id>',
  {
    label: 'Updated Label',
  },
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

Response 200 OK

Error Responses

StatusDescription
400id is not a valid UUID
400label or is_active is null, label is empty, or a field is invalid or unknown
404No reason with that id exists in the tenant — code: ACTIVITY_REASON_NOT_FOUND

DELETE /api/activity-reason-configs/:id

Deactivate a tenant activity reason configuration.

Auth: Required — activity-config:manage permission

Example

curl -X DELETE https://api.reten.ai/api/activity-reason-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/activity-reason-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 reason with that id exists in the tenant — code: ACTIVITY_REASON_NOT_FOUND