---
title: "Cancel a Maestro run"
method: POST
path: "/v1/app-automate/maestro/{project_id}/{run_id}/cancel"
tags: ["App-automate Maestro"]
---

# Cancel a Maestro run

`POST /v1/app-automate/maestro/{project_id}/{run_id}/cancel`

Immediately cancels a queued or running Maestro run. The run is marked CANCELLED so its workers stop requesting devices and stop retrying, every flow that has not finished yet is closed out as cancelled, any device session the run already acquired is released, and any request still queued on the grid is dropped. Flows that already completed keep their results and reports. Cancelling is idempotent only in the sense that it is safe to call once: a run that has already reached a terminal state (DONE, FAILED or CANCELLED) returns 409.

## Path parameters

- `project_id` integer, required
- `run_id` integer, required

## Response `200`

The run was cancelled.

- TestingbotEntitiesMaestroCancelAck — Testingbot_Entities_MaestroCancelAck model
  - `success` boolean, required — Whether the cancel was applied.
  - `run` TestingbotEntitiesMaestroRunSummary, required
    - `id` integer, required — Unique numeric Maestro run ID.
    - `project_id` integer, required — Maestro project the run belongs to.
    - `name` string, required — Build name the run was submitted under.
    - `status` string, required — Run state: WAITING, READY, DONE, FAILED or CANCELLED.
    - `success` integer, required — 1 when every flow passed, 0 otherwise. Always 0 for a cancelled run.
    - `capabilities` object, required — Capabilities the run was started with.
    - `created_at` string, date-time, required — When the run was submitted. Unchanged by a cancel.
    - `completed_at` string, date-time, required — When the run reached a terminal state.
  - `cancelled_flow_count` integer, required — How many flows were still queued or running and got closed out. 0 means the run held no unfinished flows (its device session, if any, is still released).

## Other responses

- `401` — Authentication required
- `403` — Account is read-only
- `404` — Project or run not found
- `409` — Run has already finished

---

[API](https://skmtc.dev/testingbot/apis/testingbot-rest-api.md) · [All operations](https://skmtc.dev/testingbot/apis/testingbot-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/testingbot/testingbot-rest-api/revisions/235c6ba65e6f/schema)
