Reten Docs
Activities

Target Users

List and manage target users for an activity.

GET /api/activities/:id/target-users

List the target users for an activity.

Auth: Required — VIEW_ACTIVITIES permission

Target User Statuses

StatusDescription
PENDINGNot yet resolved — waiting for resolution (ON_DISPATCH/MANUAL strategy) or retry
RESOLVEDA commerce user has been matched and assigned
LOCKEDResolved and locked — cannot be modified
FAILEDResolution attempted but no match found

Lock Reasons

Lock ReasonDescription
CRITERIA_MATCHMatched via resolution criteria (e.g., ROLE_MATCH)
FALLBACK_COMMERCE_REPFell back to commerce representative
FALLBACK_OWNERFell back to commerce owner
MANUAL_ASSIGNMENTManually assigned via the resolve endpoint

Path Parameters

ParameterTypeDescription
idUUIDActivity ID

Example

curl https://api.reten.ai/api/activities/ee0e8400-e29b-41d4-a716-446655440000/target-users \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>"
import axios from 'axios';

const response = await axios.get(
  'https://api.reten.ai/api/activities/ee0e8400-e29b-41d4-a716-446655440000/target-users',
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

const targetUsers = response.data;

Response 200 OK

[
  {
    "id": "110e8400-e29b-41d4-a716-446655440000",
    "commerceUserId": "aa0e8400-e29b-41d4-a716-446655440000",
    "resolutionStatus": "LOCKED",
    "resolutionStrategy": "ON_CREATION",
    "lockReason": "CRITERIA_MATCH",
    "resolvedAt": "2025-01-15T10:30:00.000Z",
    "lockedAt": "2025-01-15T10:31:00.000Z",
    "commerceUser": {
      "firstName": "Maria",
      "lastName": "Garcia"
    }
  }
]

PATCH /api/activities/:id/target-users/:targetUserId/resolve

Manually assign a commerce user as the target user. Only works on PENDING or FAILED target users that are not locked.

Auth: Required — CREATE_ACTIVITY permission

Path Parameters

ParameterTypeDescription
idUUIDActivity ID
targetUserIdUUIDTarget user record ID

Request Body

FieldTypeRequiredDescription
commerce_user_idUUIDYesCommerce user to assign

Example

curl -X PATCH https://api.reten.ai/api/activities/ee0e8400-e29b-41d4-a716-446655440000/target-users/110e8400-e29b-41d4-a716-446655440000/resolve \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "commerce_user_id": "aa0e8400-e29b-41d4-a716-446655440000"
  }'
import axios from 'axios';

const response = await axios.patch(
  'https://api.reten.ai/api/activities/ee0e8400-e29b-41d4-a716-446655440000/target-users/110e8400-e29b-41d4-a716-446655440000/resolve',
  {
    commerce_user_id: 'aa0e8400-e29b-41d4-a716-446655440000',
  },
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

Response 200 OK

Returns the updated target user record.

Error Responses

StatusDescription
400Activity is in a terminal status
400Target user is already locked
400Target user is not in PENDING or FAILED status