Reten Docs

Cancel Activity

Cancel an activity that is in READY or RETRYING status.

PATCH /api/activities/:id/cancel

Cancel an activity. The transition to is available from and (see Activity States for the full state machine).

Auth: Required — activity:cancel permission

Path Parameters

ParameterTypeDescription
idUUIDActivity 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

StatusDescription
400The activity is not in READY or RETRYING — Cannot cancel activity in status "<STATUS>". Activity can only be canceled from non-terminal states (READY, RETRYING).
404No activity with that id exists in the active project (an activity of another project included) — Actividad no encontrada