---
title: "Cancel or retry an automation run"
method: POST
path: "/automations/runs/{id}"
tags: ["Automations"]
---

# Cancel or retry an automation run

`POST /automations/runs/{id}`

## Request

- Base URL: `https://api.groundmail.dev`
- URL: `https://api.groundmail.dev/automations/runs/{id}`
- Auth: HTTP bearer

## Path parameters

- `id` string, required

## Request body

- AutomationRunActionRequest
  - `action` 'cancel' | 'retry', required

## Response `200`

Updated run

- AutomationRunResponse
  - `run` AutomationRun, required
    - `id` string, required
    - `automation_id` string, required
    - `trigger_event_id` string, nullable, required
    - `status` 'queued' | 'running' | 'waiting' | 'completed' | 'failed' | 'cancelled', required
    - `current_step` integer, required
    - `waiting_for_event` string, nullable, required
    - `wait_timeout_at` string, date-time, nullable, required
    - `context` object, required
    - `last_error` string, nullable, required
    - `cancel_requested_at` string, date-time, nullable, required
    - `started_at` string, date-time, nullable, required
    - `completed_at` string, date-time, nullable, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
    - `automation` Automation
      - `id` string, required
      - `name` string, required
      - `status` 'draft' | 'active' | 'paused', required
      - `trigger` AutomationTrigger, required
        - `type` 'event', required
        - `event` string, required
        - `cancel_on_events` string[]: When any listed event fires for the same recipient, cancel queued/running/waiting runs for this automation.
        - `once_per_contact` boolean: Enrol each recipient at most once, ever. Matched on the trigger event's `email` or `user_id`. A later matching event is reported in `enrollment_skips` instead of starting a run.
        - `cooldown_days` integer: Do not enrol the same recipient again within this many days of their last run on this automation. Ignored when `once_per_contact` is true.
      - `steps` AutomationStep[], required
        - `type` 'delay' | 'send_email' | 'send_sms' | 'condition' | 'wait_for_event', required
      - `folder` string, nullable, required: Name of the dashboard folder it is filed in, or null.
      - `created_at` string, date-time, required
      - `updated_at` string, date-time, required
    - `trigger_event` EventRecord
      - `id` string, required
      - `name` string, required
      - `user_id` string, nullable, required
      - `email` string, email, nullable, required
      - `data` object, required
      - `source` 'api' | 'dashboard', required
      - `created_at` string, date-time, required
    - `steps` AutomationRunStep[]: Present on run detail responses
      - `id` string, required
      - `step_index` integer, required
      - `step_type` 'delay' | 'send_email' | 'condition' | 'wait_for_event', required
      - `status` 'started' | 'waiting' | 'completed' | 'failed', required
      - `output` unknown, required
      - `error` string, nullable, required
      - `started_at` string, date-time, required
      - `completed_at` string, date-time, nullable, required
      - `created_at` string, date-time, required
      - `updated_at` string, date-time, required

## Other responses

- `400`: Invalid action
- `401`: Unauthorized
- `404`: Not found

---

[API](https://skmtc.dev/groundmail/apis/groundmail-api.md) · [All operations](https://skmtc.dev/groundmail/apis/groundmail-api/llms.txt) · [OpenAPI document](https://skmtc.dev/groundmail/apis/groundmail-api/revisions/479821c9fecf?raw)
