Cancel Activity
Cancel an activity that is in READY or RETRYING status.
PATCH /api/activities/:id/cancel
Cancel an activity. The transition to Activity was explicitly canceled from a non-terminal state (READY or RETRYING) because the business reason behind it stopped applying before delivery (for example, the client already took the target action through another channel, opted out, or the recipient stopped being valid). Cancellation is terminal: no result is produced and no dispatch occurs. is available from Activity is fully resolved and ready to act on. If the client has a provider configured to dispatch activities, the system's next action attempts the dispatch; otherwise the activity stays READY and an operator can act on it from the internal platform. and At least one dispatch attempt has failed; the system will retry automatically. Each retry keeps the activity in this state. It moves to DISPATCHED when an attempt succeeds, or to FAILED when the available retries run out. (see Activity States for the full state machine).
Auth: Required — activity:cancel permission
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | UUID | Activity ID |
Example
curl -X PATCH https://api.reten.ai/api/activities/ee0e8400-e29b-41d4-a716-446655440000/cancel \
-H "Authorization: Bearer <token>" \
-H "x-tenant-id: <tenant-id>" \
-H "x-project-id: <project-id>"const activityId = "ee0e8400-e29b-41d4-a716-446655440000";
const response = await fetch(`https://api.reten.ai/api/activities/${activityId}/cancel`, {
method: "PATCH",
headers: {
"Authorization": "Bearer <token>",
"x-tenant-id": "<tenant-id>",
"x-project-id": "<project-id>",
},
});
const data = await response.json();import requests
activity_id = "ee0e8400-e29b-41d4-a716-446655440000"
response = requests.patch(
f"https://api.reten.ai/api/activities/{activity_id}/cancel",
headers={
"Authorization": "Bearer <token>",
"x-tenant-id": "<tenant-id>",
"x-project-id": "<project-id>",
},
)
data = response.json()Response 200 OK
Returns the full activity after the cancellation, including its commerceAssignment and statusEvents. The example below is abbreviated.
{
"id": "ee0e8400-e29b-41d4-a716-446655440000",
"projectId": "3f6c2b1a-8d4e-4f7a-9b2c-5e1d0a7f6c34",
"status": "CANCELED"
}Error Responses
| Status | Description |
|---|---|
400 | The activity is not in READY or RETRYING — Cannot cancel activity in status "<STATUS>". Activity can only be canceled from non-terminal states (READY, RETRYING). |
404 | No activity with that id exists in the active project (an activity of another project included) — Actividad no encontrada |