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, withtask_resultand 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
| Header | Value |
|---|---|
x-api-key | YOUR_API_KEY |
Content-Type | application/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 responds400. - 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,COMPLETEDandFAILED, and the result leaves itCOMPLETED. 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. OnlyCANCELEDrejects a result because of its state. - Day. The day of the activity's
scheduledAtcloses 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_atin 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, withoccurredAton that Monday, is accepted until before 00:15 on Friday. It replaces whatever result the activity has, including theNOT_EXECUTEDone the end-of-day auto-close may have registered. - A submission that arrives on time does not compare
occurredAtwith 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,409with acode(see Rejections); in the current format,422without acode(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.
| Field | Type | Required | Description |
|---|---|---|---|
activityId | string (UUID) | Yes | Activity ID in Reten. A result without an activity (STANDALONE) can only be sent in the current format |
formId | string (UUID) | Yes | The form that was answered: the id of the form, which is the formId of the activity |
formVersion | number | Yes | The version that was answered: the version of the form, an integer from 1 |
occurredAt | string (ISO 8601) | Yes | When 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 |
answers | object | Yes | The answers, as a map from question key to value (see Answers) |
operatorExternalId | string | No | External ID of the operator who handled the activity. If the operator does not exist, it is created as a placeholder |
providerActivityId | string | No | Activity ID in your system. For correlation/tracking only — does not identify or resolve the activity in Reten |
commerceExternalId | string | No | Commerce 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.
nullis not a valid value. - One key per question, with the
keyexactly 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
codeis the code of the result;comment,future_scheduled_atandmodalityfill 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."
}
]
}| Field | Description |
|---|---|
id, source, origin, activityId, providerActivityId, commerceExternalId, resultStatus, occurredAt, createdAt, updatedAt, comment, operatorExternalId | As in the response of the current format |
result | code is the answer to the code question, and label, the label of that option in the version that was answered |
isEffective | Whether the code counts as an effective contact |
modality | visit or remote, the answer to modality, or null |
futureScheduledAt | The 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 |
formId | The form the submission was validated against |
formVersion | The version the submission was validated against: the formVersion of the body |
answers | Every 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:
| Status | code | When |
|---|---|---|
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 |
404 | ACTIVITY_NOT_FOUND | The 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. |
409 | ACTIVITY_STATUS_NOT_ALLOWED | The activity is CANCELED — La actividad está en estado CANCELED y no admite registrar resultado. |
409 | ACTIVITY_DAY_CLOSED | The 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. |
409 | ACTIVITY_FORM_MISMATCH | The 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. |
404 | ACTIVITY_FORM_VERSION_NOT_FOUND | The form does not have the version of formVersion — El formulario 3f6c2a9e-8b41-4d7a-9c15-2e7f0b6d4a81 no tiene la versión 9. |
422 | INVALID_ANSWERS | The 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,messageandcodeare the ones of every error of the API.errorsis added only when there is a list: a client that ignores it still readsmessageandcode.- Each error carries
question, thekeyof the question;code, which is stable; andmessage, a text for a person. - The order of
errorsis not part of the contract: locate each error by itsquestion.
code | When |
|---|---|
UNKNOWN_QUESTION | A key of answers is not the key of any question of the form |
NOT_VISIBLE | It answers a hidden question, or chooses a hidden option |
INVALID_TYPE | The 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_OPTION | A chosen code is not an option of that question |
OUT_OF_RANGE | The value breaks a rule validated only by Reten |
REQUIRED | The 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 whyREQUIREDonly 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
formIdandformVersionare stored again. idandcreatedAtremain from the first submission. So doproviderActivityIdandcommerceExternalIdwhen the previous result had them: the ones of the new submission only fill those the previous result had asnull.occurredAtbecomes the one of the new submission, andupdatedAtchanges.- A re-submission in the other format replaces the result as that format writes it. After one in the current format,
formId,formVersion,answersandmodalityof the result arenull. - There is no
Idempotency-Keyheader: 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
| Field | Type | Required | Description |
|---|---|---|---|
activity_id | string (UUID) | No | Activity ID in Reten. If omitted, the result is registered as a standalone execution (STANDALONE), which needs a project (see Required headers) |
provider_activity_id | string | No | Activity ID in your system. For correlation/tracking only — does not identify or resolve the activity in Reten |
commerce_external_id | string | Conditional | Commerce external ID. Required only for standalone executions (without activity_id); with a linked activity it is derived from it |
occurred_at | string (ISO 8601) | Yes | Date 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_result | object | Yes | Task 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
| Field | Type | Required | Description |
|---|---|---|---|
result | string | Yes | Result type code (obtained from List Configurations) |
comment | string | No | Operator comment about the activity |
operator_external_id | string | No | External ID of the operator who handled the activity |
future_scheduled_at | string (ISO 8601) | Conditional | Reschedule date. Required if the result type has requiresFutureScheduledAt: true |
payload | object | No | Additional 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_idis only required for standalone executions (withoutactivity_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_idis optional; if sent and the operator does not exist, it is created as a placeholder.- The
resultcode must be an active result type (see List Configurations); otherwise the request returns422—El tipo de resultado seleccionado no está activo. - If the result type has
requiresFutureScheduledAt: true, thefuture_scheduled_atfield is mandatory (otherwise422—Este tipo de resultado requiere una fecha comprometida.) and must fall today or later in the tenant's timezone (otherwise422—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,FAILEDorCOMPLETED— inCOMPLETED, the submission overwrites the existing result); aCANCELEDactivity returns422—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, withoutactivity_id) are exempt from this rule
Errors
In the current format, no rejection carries a code.
| Status | Description |
|---|---|
400 | Validation error in the body — missing or invalid fields |
400 | A 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. |
401 | Invalid, revoked or expired API key, or its owner is inactive (see Errors) |
403 | The key does not have the activity-result:submit permission |
404 | The 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. |
422 | The 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 format | With answers |
|---|---|
activity_id | activityId, required |
commerce_external_id | commerceExternalId |
provider_activity_id | providerActivityId |
occurred_at | occurredAt, with time and offset |
| — | formId and formVersion: the form and the version that were answered |
task_result.operator_external_id | operatorExternalId |
task_result.result | The answer to the code question, in answers |
task_result.comment | The answer to the comment key, in answers |
task_result.future_scheduled_at | The 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.payload | Not sent: answers carries the structured detail |
The task_result object | Not sent: a body with answers and task_result at once responds 400 |
The rejections change too:
| Current format | With answers |
|---|---|
422 without code: the activity is CANCELED | 409 ACTIVITY_STATUS_NOT_ALLOWED |
422 without code: the day of the activity closed, outside the margin | 409 ACTIVITY_DAY_CLOSED |
422: the result code does not exist or is not active | The 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 missing | REQUIRED on future_scheduled_at, which the form makes required depending on the answers |
422: the scheduled date is in the past | OUT_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 code | 404 with code ACTIVITY_NOT_FOUND |