Reten Docs

Submit Result

Register the result of a task-type activity.

POST /api/integration/activity-results/tasks

Submits the result of a task-type activity. The result is associated with the corresponding activity and updates its status in Reten.

The same route accepts two body formats, and the answers key tells them apart:

  • With answers — the answers to the result form of the activity. Reten validates them against the version of the form that was answered and derives the result from them. See Submit with answers.
  • Without answers — the current format, with task_result and a result code from List Configurations. It keeps working as it does today.

A body that carries both answers and task_result responds 400.

Authentication: Required — permission activity-result:submit

Required headers

HeaderValue
x-api-keyYOUR_API_KEY
Content-Typeapplication/json

x-project-id is optional: this is a project-optional endpoint.

  • With a tenant key or a user token, sending the header narrows the request to that project, so the activity must belong to it. Without the header, the result takes the project of its activity. A header that is sent is validated — see Project errors.
  • A result without an activity (only possible in the current format, without activity_id) has no activity to take a project from: with a project key it takes the key's project; with a tenant key or a user token it needs the header, and without it the API responds 400.
  • A project key always works in its own project: an activity of another project responds 404.

Rules for both formats

  • One result per activity. The operation is an idempotent UPSERT: if the activity does not yet have a result, it is created; if it already has one, the submission replaces it (last-write-wins), also when the previous one was sent in the other format. You can re-send the result without getting a conflict.
  • State. The activity accepts a result in READY, DISPATCHED, RETRYING, COMPLETED and FAILED, and the result leaves it COMPLETED. That includes an activity Reten has not managed to dispatch (RETRYING) or could not deliver (FAILED): your system may have read it on its own. Only CANCELED rejects a result because of its state.
  • Day. The day of the activity's scheduledAt closes at the end of that day in the tenant's time zone, with 15 minutes of grace: an activity of yesterday is accepted until before 00:15 today. It is measured with the time Reten receives the submission.
  • Late submission. After that cutoff, the submission is still accepted within a margin — for example, an activity answered without signal and sent the next day. It is accepted if the day of occurredAt (occurred_at in the current format), in the tenant's time zone, is the day of the activity, and it arrives before 3 days have passed since that day, with the same 15 minutes of grace: a submission for an activity of a Monday, with occurredAt on that Monday, is accepted until before 00:15 on Friday. It replaces whatever result the activity has, including the NOT_EXECUTED one the end-of-day auto-close may have registered.
  • A submission that arrives on time does not compare occurredAt with the day of the activity.
  • The rejection by state is checked before the rejection by day. Each format reports them its own way: with answers, 409 with a code (see Rejections); in the current format, 422 without a code (see Validation rules).

Submit with answers

The body says which form and which version were answered: formId and formVersion, the id and the version of the form that was read. Reten validates the answers against that version, even if the form changed afterwards. The formId must be the one of the activity.

Request body

The body is in camelCase, like the form.

FieldTypeRequiredDescription
activityIdstring (UUID)YesActivity ID in Reten. A result without an activity (STANDALONE) can only be sent in the current format
formIdstring (UUID)YesThe form that was answered: the id of the form, which is the formId of the activity
formVersionnumberYesThe version that was answered: the version of the form, an integer from 1
occurredAtstring (ISO 8601)YesWhen the activity was handled, as an instant with time and offset (Z or ±HH:mm), such as 2026-11-05T16:40:00-03:00. A date alone, or a time without offset, responds 400
answersobjectYesThe answers, as a map from question key to value (see Answers)
operatorExternalIdstringNoExternal ID of the operator who handled the activity. If the operator does not exist, it is created as a placeholder
providerActivityIdstringNoActivity ID in your system. For correlation/tracking only — does not identify or resolve the activity in Reten
commerceExternalIdstringNoCommerce external ID. It is only stored: the commerce of the result is the one of the activity

Any other field outside answers responds 400.

Answers

A map from the key of each question to its value, with the value of the question types:

{
  "modality": "visit",
  "contact": "yes",
  "topics": ["price", "delivery"],
  "code": "call_rescheduled",
  "future_scheduled_at": "2026-11-12",
  "comment": "Pide que lo llamen la próxima semana."
}
  • A question without an answer does not send its key. null is not a valid value.
  • One key per question, with the key exactly as it is in the form.
  • An answer to a hidden question, or a hidden option that is chosen, is rejected: it is not ignored.
  • The answer to code is the code of the result; comment, future_scheduled_at and modality fill the comment, the scheduled date and the modality of the result when the form carries them (see reserved keys).

Example

curl -X POST BASE_URL/api/integration/activity-results/tasks \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "activityId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "formId": "3f6c2a9e-8b41-4d7a-9c15-2e7f0b6d4a81",
    "formVersion": 3,
    "occurredAt": "2026-11-05T16:40:00-03:00",
    "operatorExternalId": "OP-042",
    "answers": {
      "modality": "visit",
      "contact": "yes",
      "topics": ["price", "delivery"],
      "code": "call_rescheduled",
      "future_scheduled_at": "2026-11-12",
      "comment": "Pide que lo llamen la próxima semana."
    }
  }'
const response = await fetch(
  `${BASE_URL}/api/integration/activity-results/tasks`,
  {
    method: "POST",
    headers: {
      "x-api-key": "YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      activityId: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      formId: "3f6c2a9e-8b41-4d7a-9c15-2e7f0b6d4a81",
      formVersion: 3,
      occurredAt: "2026-11-05T16:40:00-03:00",
      operatorExternalId: "OP-042",
      answers: {
        modality: "visit",
        contact: "yes",
        topics: ["price", "delivery"],
        code: "call_rescheduled",
        future_scheduled_at: "2026-11-12",
        comment: "Pide que lo llamen la próxima semana.",
      },
    }),
  }
);

const data = await response.json();
import requests

response = requests.post(
    f"{BASE_URL}/api/integration/activity-results/tasks",
    headers={
        "x-api-key": "YOUR_API_KEY",
    },
    json={
        "activityId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "formId": "3f6c2a9e-8b41-4d7a-9c15-2e7f0b6d4a81",
        "formVersion": 3,
        "occurredAt": "2026-11-05T16:40:00-03:00",
        "operatorExternalId": "OP-042",
        "answers": {
            "modality": "visit",
            "contact": "yes",
            "topics": ["price", "delivery"],
            "code": "call_rescheduled",
            "future_scheduled_at": "2026-11-12",
            "comment": "Pide que lo llamen la próxima semana.",
        },
    },
)

data = response.json()

Response 201 Created

{
  "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "source": "RETEN_ACTIVITY",
  "origin": "EXTERNAL",
  "activityId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "providerActivityId": null,
  "commerceExternalId": null,
  "resultStatus": "COMPLETED",
  "occurredAt": "2026-11-05T19:40:00.000Z",
  "createdAt": "2026-11-05T19:41:07.512Z",
  "updatedAt": "2026-11-05T19:41:07.512Z",
  "result": {
    "code": "call_rescheduled",
    "label": "Pide que lo llamen otro día"
  },
  "isEffective": true,
  "modality": "visit",
  "comment": "Pide que lo llamen la próxima semana.",
  "futureScheduledAt": "2026-11-12",
  "operatorExternalId": "OP-042",
  "formId": "3f6c2a9e-8b41-4d7a-9c15-2e7f0b6d4a81",
  "formVersion": 3,
  "answers": [
    {
      "key": "modality",
      "keyLabel": "¿Cómo hiciste esta gestión?",
      "value": "visit",
      "valueLabel": "Visita"
    },
    {
      "key": "contact",
      "keyLabel": "¿Hubo contacto con el cliente?",
      "value": "yes",
      "valueLabel": "Sí"
    },
    {
      "key": "topics",
      "keyLabel": "¿Qué temas se trataron?",
      "value": ["price", "delivery"],
      "valueLabel": ["Precio", "Entrega"]
    },
    {
      "key": "code",
      "keyLabel": "¿Cómo terminó la gestión?",
      "value": "call_rescheduled",
      "valueLabel": "Pide que lo llamen otro día"
    },
    {
      "key": "future_scheduled_at",
      "keyLabel": "¿Para cuándo queda agendada?",
      "value": "2026-11-12"
    },
    {
      "key": "comment",
      "keyLabel": "Comentarios",
      "value": "Pide que lo llamen la próxima semana."
    }
  ]
}
FieldDescription
id, source, origin, activityId, providerActivityId, commerceExternalId, resultStatus, occurredAt, createdAt, updatedAt, comment, operatorExternalIdAs in the response of the current format
resultcode is the answer to the code question, and label, the label of that option in the version that was answered
isEffectiveWhether the code counts as an effective contact
modalityvisit or remote, the answer to modality, or null
futureScheduledAtThe scheduled date as YYYY-MM-DD, or null: the same value as the answer to future_scheduled_at, without time-zone conversion. In the current format this field is a date with time
formIdThe form the submission was validated against
formVersionThe version the submission was validated against: the formVersion of the body
answersEvery answer of the submission, in the order of the form, code and the reserved keys included. Each one carries key, keyLabel (the label of the question), value and valueLabel (the label of the chosen option). On a MULTIPLE_CHOICE, value and valueLabel are lists in the same order; text, number, date and time come without valueLabel

The labels are the ones of the version that was answered: if the form changes later, the result does not.

Rejections

A submission with answers receives the first of these rejections that applies:

StatuscodeWhen
401—Invalid, revoked or expired API key, or its owner is inactive (see Errors)
400, 403, 404—x-project-id is sent and is not a valid UUID, is not the project of a project key, or names a project that does not exist (see Project errors)
403—The key does not have the activity-result:submit permission
400—The body is malformed: for example, answers is not an object; activityId, formId, formVersion or occurredAt is missing or invalid; it carries answers and task_result at once; or it carries another field outside answers
404ACTIVITY_NOT_FOUNDThe activity does not exist in the tenant or, when the request has a project (a project key or x-project-id), in that project — No existe la actividad a1b2c3d4-e5f6-7890-abcd-ef1234567890.
409ACTIVITY_STATUS_NOT_ALLOWEDThe activity is CANCELED — La actividad está en estado CANCELED y no admite registrar resultado.
409ACTIVITY_DAY_CLOSEDThe day of the activity already closed and the submission does not fall within the margin (see Rules for both formats) — La actividad corresponde a un día ya cerrado y no admite registrar resultado.
409ACTIVITY_FORM_MISMATCHThe formId of the submission is not the one of the activity, or does not exist, or the activity carries formId as null — El formulario del envío no es el de la actividad.
404ACTIVITY_FORM_VERSION_NOT_FOUNDThe form does not have the version of formVersion — El formulario 3f6c2a9e-8b41-4d7a-9c15-2e7f0b6d4a81 no tiene la versión 9.
422INVALID_ANSWERSThe validation of answers against that version gives at least one error; all of them come in errors (see Invalid answers)

The 404 of the activity, the three 409 and the 404 of the version are answered before the answers are validated, and without errors: fixing the answers would not make the submission acceptable. Every rejection with a code has this body:

{
  "statusCode": 409,
  "error": "Conflict",
  "message": "La actividad corresponde a un día ya cerrado y no admite registrar resultado.",
  "code": "ACTIVITY_DAY_CLOSED"
}

Invalid answers (422)

{
  "statusCode": 422,
  "error": "Unprocessable Entity",
  "message": "El envío tiene 2 errores.",
  "code": "INVALID_ANSWERS",
  "errors": [
    {
      "question": "topics",
      "code": "UNKNOWN_OPTION",
      "message": "«shipping» no es una opción de «¿Qué temas se trataron?»."
    },
    {
      "question": "future_scheduled_at",
      "code": "REQUIRED",
      "message": "Responde «¿Para cuándo queda agendada?»."
    }
  ]
}
  • statusCode, error, message and code are the ones of every error of the API. errors is added only when there is a list: a client that ignores it still reads message and code.
  • Each error carries question, the key of the question; code, which is stable; and message, a text for a person.
  • The order of errors is not part of the contract: locate each error by its question.
codeWhen
UNKNOWN_QUESTIONA key of answers is not the key of any question of the form
NOT_VISIBLEIt answers a hidden question, or chooses a hidden option
INVALID_TYPEThe value does not have the shape of its type: null, an empty text, an empty multiple choice or one with repeats, a malformed date
UNKNOWN_OPTIONA chosen code is not an option of that question
OUT_OF_RANGEThe value breaks a rule validated only by Reten
REQUIREDThe question is visible and required (required, or its requiredWhen is true), and its key was not sent
  • At most one error per question: the first of the table that applies. The exception: a hidden option is checked after the shape of the value, so a malformed value that names a hidden option gives INVALID_TYPE. That is why REQUIRED only appears when the key was not sent: an answer that is present and defective carries its own error.
  • Reten recomputes visibility and required questions with the answers of the submission, without trusting what was drawn.
  • An answer with an error counts as unanswered for the conditions that follow. The exception: on a visible MULTIPLE_CHOICE, the options that exist and are visible still count, and only the nonexistent or hidden ones are reported.

Re-submission

  • A new submission for the same activity replaces the code, the answers and the fields derived from them. It is not merged with the previous one, and it responds 201, like the first.
  • It is validated against the version it names, like any submission, and formId and formVersion are stored again.
  • id and createdAt remain from the first submission. So do providerActivityId and commerceExternalId when the previous result had them: the ones of the new submission only fill those the previous result had as null. occurredAt becomes the one of the new submission, and updatedAt changes.
  • A re-submission in the other format replaces the result as that format writes it. After one in the current format, formId, formVersion, answers and modality of the result are null.
  • There is no Idempotency-Key header: retrying the same body on an activity leaves the same result, because the submission already replaces it completely.

Current format

A body without answers is the current format: a result code from List Configurations, inside task_result. Its logic, its rejections and its response are unchanged, except for what Rules for both formats says.

Request body

FieldTypeRequiredDescription
activity_idstring (UUID)NoActivity ID in Reten. If omitted, the result is registered as a standalone execution (STANDALONE), which needs a project (see Required headers)
provider_activity_idstringNoActivity ID in your system. For correlation/tracking only — does not identify or resolve the activity in Reten
commerce_external_idstringConditionalCommerce external ID. Required only for standalone executions (without activity_id); with a linked activity it is derived from it
occurred_atstring (ISO 8601)YesDate and time when the activity was handled. Without an offset, it is read in the tenant's time zone to decide whether a late submission falls within the margin
task_resultobjectYesTask result detail (see table below)

The activity is resolved only by activity_id. If sent, the result is linked to that activity; if omitted, it is registered as a standalone execution (STANDALONE). provider_activity_id is for correlation/tracking with your system only and does not resolve the activity.

commerce_external_id is optional when the activity is linked to an activity (activity_id): the commerce is derived from the activity. It is only required for standalone executions (STANDALONE) — when activity_id is not sent — and in that case, if the commerce does not exist, it is created as a placeholder.

task_result fields

FieldTypeRequiredDescription
resultstringYesResult type code (obtained from List Configurations)
commentstringNoOperator comment about the activity
operator_external_idstringNoExternal ID of the operator who handled the activity
future_scheduled_atstring (ISO 8601)ConditionalReschedule date. Required if the result type has requiresFutureScheduledAt: true
payloadobjectNoAdditional result data

Example

curl -X POST BASE_URL/api/integration/activity-results/tasks \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "activity_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "commerce_external_id": "COM-001",
    "occurred_at": "2026-04-11T10:30:00.000Z",
    "task_result": {
      "result": "SALE_COMPLETED",
      "comment": "Customer accepted renewal offer",
      "operator_external_id": "OP-042"
    }
  }'
const response = await fetch(
  `${BASE_URL}/api/integration/activity-results/tasks`,
  {
    method: "POST",
    headers: {
      "x-api-key": "YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      activity_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      commerce_external_id: "COM-001",
      occurred_at: "2026-04-11T10:30:00.000Z",
      task_result: {
        result: "SALE_COMPLETED",
        comment: "Customer accepted renewal offer",
        operator_external_id: "OP-042",
      },
    }),
  }
);

const data = await response.json();
import requests

response = requests.post(
    f"{BASE_URL}/api/integration/activity-results/tasks",
    headers={
        "x-api-key": "YOUR_API_KEY",
    },
    json={
        "activity_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "commerce_external_id": "COM-001",
        "occurred_at": "2026-04-11T10:30:00.000Z",
        "task_result": {
            "result": "SALE_COMPLETED",
            "comment": "Customer accepted renewal offer",
            "operator_external_id": "OP-042",
        },
    },
)

data = response.json()

Response 201 Created

{
  "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "source": "RETEN_ACTIVITY",
  "origin": "EXTERNAL",
  "activityId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "providerActivityId": null,
  "commerceExternalId": "COM-001",
  "resultStatus": "COMPLETED",
  "occurredAt": "2026-04-11T10:30:00.000Z",
  "createdAt": "2026-04-11T10:30:05.000Z",
  "updatedAt": "2026-04-11T10:30:05.000Z",
  "result": {
    "code": "SALE_COMPLETED",
    "label": "Venta completada"
  },
  "comment": "Customer accepted renewal offer",
  "operatorExternalId": "OP-042",
  "futureScheduledAt": null
}

Validation rules

  • commerce_external_id is only required for standalone executions (without activity_id); in that case, if the commerce does not exist it is created as a placeholder. With a linked activity the commerce is derived from it and this field is optional.
  • operator_external_id is optional; if sent and the operator does not exist, it is created as a placeholder.
  • The result code must be an active result type (see List Configurations); otherwise the request returns 422 — El tipo de resultado seleccionado no está activo.
  • If the result type has requiresFutureScheduledAt: true, the future_scheduled_at field is mandatory (otherwise 422 — Este tipo de resultado requiere una fecha comprometida.) and must fall today or later in the tenant's timezone (otherwise 422 — La fecha programada no puede ser en el pasado.)
  • If the activity already has a result, the submission overwrites it (idempotent UPSERT); no conflict is returned
  • The linked activity must be in a state that accepts a result (READY, DISPATCHED, RETRYING, FAILED or COMPLETED — in COMPLETED, the submission overwrites the existing result); a CANCELED activity returns 422 — La actividad no está en un estado válido para registrar resultado.
  • A result for an activity whose day already closed is accepted only within the margin of a late submission (see Rules for both formats); otherwise the request returns 422 — La actividad corresponde a un día ya cerrado y no admite registrar resultado. Standalone executions (STANDALONE, without activity_id) are exempt from this rule

Errors

In the current format, no rejection carries a code.

StatusDescription
400Validation error in the body — missing or invalid fields
400A result without activity_id has no project: a tenant key or a user token that does not send x-project-id — Falta el header obligatorio x-project-id: un resultado sin activity_id necesita proyecto.
401Invalid, revoked or expired API key, or its owner is inactive (see Errors)
403The key does not have the activity-result:submit permission
404The activity_id does not exist in the tenant or, when the request has a project (a project key or x-project-id), in that project — Actividad no encontrada.
422The activity is CANCELED, its day closed and the submission is outside the margin, the result type is not active, or future_scheduled_at is missing or in the past (see Validation rules)

From the current format to answers

Current formatWith answers
activity_idactivityId, required
commerce_external_idcommerceExternalId
provider_activity_idproviderActivityId
occurred_atoccurredAt, with time and offset
—formId and formVersion: the form and the version that were answered
task_result.operator_external_idoperatorExternalId
task_result.resultThe answer to the code question, in answers
task_result.commentThe answer to the comment key, in answers
task_result.future_scheduled_atThe answer to the future_scheduled_at key, in answers, only as a date YYYY-MM-DD. The current format also accepts a date with time; with answers that gives INVALID_TYPE
task_result.payloadNot sent: answers carries the structured detail
The task_result objectNot sent: a body with answers and task_result at once responds 400

The rejections change too:

Current formatWith answers
422 without code: the activity is CANCELED409 ACTIVITY_STATUS_NOT_ALLOWED
422 without code: the day of the activity closed, outside the margin409 ACTIVITY_DAY_CLOSED
422: the result code does not exist or is not activeThe code is an option of the code question: one that is not among its options gives UNKNOWN_OPTION, and a hidden one, NOT_VISIBLE
422: the code requires a scheduled date and it is missingREQUIRED on future_scheduled_at, which the form makes required depending on the answers
422: the scheduled date is in the pastOUT_OF_RANGE, according to the rule of the question. A form without a rule on the date does not reject a past date
404 of the activity, without code404 with code ACTIVITY_NOT_FOUND