# Cancel jobs

URL: https://docs.hanzo.ai/docs/openapi/compute/cancelfleetjob

> Cancels a queued or running render in the caller's org.

`POST /v1/compute/fleet/jobs/{id}/cancel`

> [Compute →](https://docs.hanzo.ai/docs/openapi/compute) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                          |
| ------------- | -------------------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/compute/fleet/jobs/{id}/cancel` |
| **Method**    | `POST`                                                   |
| **Operation** | `cancelFleetJob`                                         |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`                   |

Cancels a queued or running render in the caller's org. The engine
cancel is org-scoped, so a tenant can only ever cancel its OWN job: a job in
another tenant's shard is 404, exactly like one that never existed. An
already-finished job is 409.

## Request

4 fields, body `application/json` (required).

| Field    | In   | Type   | Required | Description                                                                                                                                               |
| -------- | ---- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`     | path | string | yes      | ID is the job (activity) id, from the URL path.                                                                                                           |
| `id`     | body | string | —        | ID is the job (activity) id, from the URL path.                                                                                                           |
| `reason` | body | string | —        | Reason is recorded on the cancellation; empty records "canceled from console".                                                                            |
| `run`    | body | string | —        | Run is the run id; empty defaults to the job id, which is what the dispatcher sets (runId == activityId == prompt\_id), so the common case sends no body. |

## Response

| Status    | Body                | Meaning |
| --------- | ------------------- | ------- |
| `200`     | compute.jobCanceled | ok      |
| `default` | problem-details     | refused |

`200` body — 2 fields.

| Field      | In   | Type   | Always | Description                                  |
| ---------- | ---- | ------ | ------ | -------------------------------------------- |
| `canceled` | body | string | —      | Canceled is the job id that was canceled.    |
| `run`      | body | string | —      | Run is the run id the cancel was applied to. |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo compute fleet jobs cancel <id>
```

**SDK**

**.ts**

```ts
import { Configuration, ComputeApi } from 'hanzoai';

const api = new ComputeApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.cancelFleetJob({ id: 'id', id: "<id>", reason: "<reason>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ComputeApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ComputeApi(client).cancel_fleet_job(id='id', id="<id>", reason="<reason>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.ComputeAPI.CancelFleetJob(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, compute_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = compute_api::cancel_fleet_job(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ComputeApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new ComputeApi(client).cancelFleetJob();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/compute/fleet/jobs/<id>/cancel \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "id": "<id>",
       "reason": "<reason>"
     }'
```

**MCP**

Tool `compute`, op `cancelFleetJob` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "compute",
         "arguments": {
           "op": "cancelFleetJob",
           "input": {
             "id": "<id>",
             "reason": "<reason>"
           }
         }
       }
     }'
```

---

[Compute API](https://docs.hanzo.ai/docs/openapi/compute) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
