# Cancel a command

Launch stage: GA

`POST /api/1.2/commands/cancel`

Cancels a currently running command within an execution context.

 The command ID is obtained from a prior successful call to __execute__. Cancellation is asynchronous:
 this method returns once the request is accepted, and the command moves through the `Cancelling`
 status before reaching a terminal one. Poll __commandStatus__ to observe the outcome; a cancelled
 command ends in the `Finished` status with an `error` result that describes the cancellation.

API scopes: command-execution

## Request body

- `clusterId` (string, optional)
  ID of the cluster that hosts the execution context.
- `commandId` (string, optional)
  ID of the command to cancel, as returned by __execute__.
- `contextId` (string, optional)
  ID of the execution context the command runs in.

## Request

```json
{
  "clusterId": "0123-456789-abcdefg1",
  "contextId": "3f2a9c1e8b7d4a6f9e0c1b2d3a4f5e6d",
  "commandId": "5c8e1d2f3a4b8c9d8e0f1a2b3c4d5e6f"
}
```

## Response

```json
{}
```

