API Reference

Cancel Automation Run

POST /automations/:id/runs/:run_id/cancel — stop one run that is still going.

POST/automations/:id/runs/:run_id/cancel

Stops one run that is still running. The contact leaves the flow at the step it was waiting on, nothing further is sent for that run, and the run ends with status cancelled. Other runs of the automation are not touched.

Cancelling a run that has already finished is safe: nothing changes, and the response has cancelled: false with the run's own status.

Needs a full-access API key. A sending-only key gets 401 restricted_api_key.
Path parameters
idstringrequired

The automation id.

run_idstringrequired

The run id, from List Automation Runs.

const res = await fetch('https://www.senddart.com/api/automations/c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd/runs/a1b2c3d4-e5f6-7890-abcd-ef1234567890/cancel', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer mb_xxxxxxxxx' },
});
const data = await res.json();
console.log(data);

Response

{
  "object": "automation_run",
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "automation_id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd",
  "status": "cancelled",
  "cancelled": true
}

A run that is not part of this automation, or not yours, returns 404 not_found.