Reten Docs

Get Task Activity

Get a TASK activity with full relations.

GET /api/activities/tasks/:id

Returns a single TASK activity with route, operator, commerce, and status event details.

Auth: Required — activity:view permission

Path Parameters

ParameterTypeDescription
idUUIDActivity ID

Example

curl https://api.reten.ai/api/activities/tasks/ee0e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "x-project-id: <project-id>"
const taskId = "ee0e8400-e29b-41d4-a716-446655440000";
const response = await fetch(`https://api.reten.ai/api/activities/tasks/${taskId}`, {
  headers: {
    "Authorization": "Bearer <token>",
    "x-tenant-id": "<tenant-id>",
    "x-project-id": "<project-id>",
  },
});
const task = await response.json();
import requests

task_id = "ee0e8400-e29b-41d4-a716-446655440000"
response = requests.get(
    f"https://api.reten.ai/api/activities/tasks/{task_id}",
    headers={
        "Authorization": "Bearer <token>",
        "x-tenant-id": "<tenant-id>",
        "x-project-id": "<project-id>",
    },
)
task = response.json()

Response 200 OK

{
  "id": "ee0e8400-e29b-41d4-a716-446655440000",
  "projectId": "3f6c2b1a-8d4e-4f7a-9b2c-5e1d0a7f6c34",
  "type": "TASK",
  "reasonConfigId": "990e8400-e29b-41d4-a716-446655440000",
  "userStatusConfigId": "aa0e8400-e29b-41d4-a716-446655440000",
  "score": null,
  "templateId": null,
  "channel": "SALESMAN",
  "intentCategory": "RETENTION",
  "originReasons": [
    {
      "code": "seller_scheduled",
      "description": "El cliente pidió reagendar la visita"
    },
    {
      "code": "repurchase",
      "description": "Recompra: compra cada 15 días"
    }
  ],
  "originActivityResultId": "ab0e8400-e29b-41d4-a716-446655440000",
  "scheduledAt": "2025-01-16T09:00:00.000Z",
  "suggestedExecutionTime": null,
  "status": "DISPATCHED",
  "idempotencyKey": "task-2025-01-15-001",
  "dispatchConfigId": "bb0e8400-e29b-41d4-a716-446655440000",
  "providerActivityId": "ext-123",
  "dispatchAttemptCount": 1,
  "errorCode": null,
  "errorMessage": null,
  "rawPayload": null,
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-16T09:00:05.000Z",
  "reasonConfig": {
    "id": "990e8400-e29b-41d4-a716-446655440000",
    "code": "retain",
    "label": "❤️ Retención",
    "intentCategory": null,
    "isActive": true,
    "createdAt": "2024-12-01T12:00:00.000Z",
    "updatedAt": "2024-12-01T12:00:00.000Z"
  },
  "userStatusConfig": {
    "id": "aa0e8400-e29b-41d4-a716-446655440000",
    "code": "at_risk",
    "label": "En Riesgo",
    "isActive": true,
    "createdAt": "2024-12-01T12:00:00.000Z",
    "updatedAt": "2024-12-01T12:00:00.000Z"
  },
  "commerceAssignment": {
    "activityId": "ee0e8400-e29b-41d4-a716-446655440000",
    "commerceId": "880e8400-e29b-41d4-a716-446655440000",
    "assignmentReason": null,
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-15T10:30:00.000Z",
    "commerce": {
      "id": "880e8400-e29b-41d4-a716-446655440000",
      "externalId": "STORE-001",
      "globalExternalId": null,
      "name": "Main Street Store",
      "taxId": null,
      "isPlaceholder": false,
      "isActive": true,
      "metadata": null,
      "createdAt": "2024-12-01T12:00:00.000Z",
      "updatedAt": "2024-12-01T12:00:00.000Z"
    }
  },
  "taskDetails": {
    "activityId": "ee0e8400-e29b-41d4-a716-446655440000",
    "assignedRouteId": "dd0e8400-e29b-41d4-a716-446655440000",
    "assignedOperatorId": "cc0e8400-e29b-41d4-a716-446655440000",
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-15T10:30:00.000Z",
    "assignedRoute": {
      "id": "dd0e8400-e29b-41d4-a716-446655440000",
      "code": "ZONE-NORTH",
      "name": "North Zone",
      "isPlaceholder": false,
      "isActive": true,
      "createdAt": "2024-12-01T12:00:00.000Z",
      "updatedAt": "2024-12-01T12:00:00.000Z"
    },
    "assignedOperator": {
      "id": "cc0e8400-e29b-41d4-a716-446655440000",
      "type": "SALESMAN",
      "externalId": "OP-001",
      "name": "John Doe",
      "email": "john.doe@example.com",
      "phone": null,
      "isPlaceholder": false,
      "isActive": true,
      "userId": null,
      "metadata": null,
      "createdAt": "2024-12-01T12:00:00.000Z",
      "updatedAt": "2024-12-01T12:00:00.000Z"
    }
  },
  "statusEvents": [
    {
      "id": "ff0e8400-e29b-41d4-a716-446655440002",
      "activityId": "ee0e8400-e29b-41d4-a716-446655440000",
      "fromStatus": "READY",
      "toStatus": "DISPATCHED",
      "eventType": "DISPATCH_SUCCESS",
      "errorCode": null,
      "errorMessage": null,
      "rawPayload": null,
      "occurredAt": "2025-01-16T09:00:05.000Z",
      "createdAt": "2025-01-16T09:00:05.000Z"
    },
    {
      "id": "ff0e8400-e29b-41d4-a716-446655440001",
      "activityId": "ee0e8400-e29b-41d4-a716-446655440000",
      "fromStatus": null,
      "toStatus": "READY",
      "eventType": "CREATED",
      "errorCode": null,
      "errorMessage": null,
      "rawPayload": null,
      "occurredAt": "2025-01-15T10:30:00.000Z",
      "createdAt": "2025-01-15T10:30:00.000Z"
    }
  ],
  "reason": {
    "code": "retain",
    "label": "❤️ Retención"
  },
  "userStatus": {
    "code": "at_risk",
    "label": "En Riesgo"
  },
  "activityResult": null,
  "originActivityResult": {
    "id": "ab0e8400-e29b-41d4-a716-446655440000",
    "activityId": "ac0e8400-e29b-41d4-a716-446655440000",
    "occurredAt": "2025-01-14T16:20:00.000Z",
    "result": {
      "code": "visit_rescheduled",
      "label": "📅 Agenda visita"
    }
  },
  "lifecycleStatus": "DISPATCHED",
  "lifecycleStatusLabel": "Despachada",
  "lifecycleStatusDetail": null
}

intentCategory is the activity's intent category, fixed when it was created: the one sent in intent_category or, if the key was omitted, the reason's category at that moment. It does not change if the reason is reclassified later. reasonConfig.intentCategory is the reason's current default category, and is null when the reason is context-dependent. The two can differ, as in this example: a context-dependent reason and an activity created with RETENTION.

originReasons is the list sent in origin_reasons when the activity was created, in the same order: the commercial context of the activity, with no main item. It is [] when the activity was created without it.

originActivityResultId and originActivityResult are the activity result sent in origin_activity_result_id when the activity was created. originActivityResult summarizes it as it is now: its id, the activityId it belongs to (null for a STANDALONE result), occurredAt, and result, with its code and its current label in the tenant's catalog — or, when that result was submitted with the answers to a result form, the label of the option that was chosen. Both are null when the activity was created without it.

activityResult.taskDetails.isEffective says whether the activity's result counted as effective, that is, whether the customer expressed a preference. It is copied from its result type when the result is registered or its result code changes, and it does not change if the result type is reclassified later. activityResult.taskDetails.resultConfig.isEffective is the result type's current mark, so the two can differ. A NOT_EXECUTED result from the automatic close has no result type: it has isEffective: false and resultConfig: null.

When the result was submitted with the answers to a result form, activityResult.taskDetails also carries answers, modality, formId and formVersion; the four are null on any other result. Such a result takes isEffective from the platform's catalog of result codes and has resultConfig: null. futureScheduledAt is a date with time in both cases.

Error Responses

StatusDescription
400The activity is not a TASK — La actividad no es de tipo TASK.
403The user's role is operator and the activity is not assigned to them — No tiene acceso a esta actividad.
404No activity with that id in the active project — Actividad no encontrada