---
title: "POST /v1/jobs/{jobId}/cancel"
description: Cancel a job — Requests cancellation of an in-flight job you can write to. A job that has already finished returns its current status unchanged.
full: true
---

**Auth:** required. Send an `ivy_` API key (`Authorization: Bearer ivy_…`), a signed-in session token (`Authorization: Bearer …`) or the session cookie (browser sessions). See [Authentication](/docs/api/authentication).

Requests cancellation of an in-flight job you can write to. A job that has already finished returns its current status unchanged. Credits held for the job are released after cancellation is confirmed, not in this response. A project viewer, or a caller with no access, receives 404.

## Request

### Path parameters

- `jobId` (string (uuid)) —
Job UUID.

### Request body

No body is read.

Type: `object`

## Responses

### `200` OK

Cancellation acknowledged, or the job had already finished

Response shape:

- `id` (string) —

- `status` (string) —

- `message` (string) —
"Job already finished" when the job was already in a terminal state.

### `400` Bad Request

Invalid request

Response shape: `object`

### `401` Unauthorized

Authentication required

Response shape: `object`

### `404` Not Found

Resource not found

Response shape: `object`

### `429` Too Many Requests

Rate limit exceeded

Response shape: `object`

### `502` Bad Gateway

The compute backend did not accept the cancellation (failed or timed out after 15 seconds)

Response shape: `object`

**curl**

```bash
curl -X POST 'https://ivybiosciences.com/api/v1/jobs/{jobId}/cancel' \
  -H "Authorization: Bearer $IVY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{}'
```

**JavaScript**

```js
const res = await fetch('https://ivybiosciences.com/api/v1/jobs/{jobId}/cancel', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.IVY_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
const data = await res.json();
```

**Python**

```python
import os, requests

res = requests.post(
    "https://ivybiosciences.com/api/v1/jobs/{jobId}/cancel",
    headers={"Authorization": f"Bearer {os.environ['IVY_API_KEY']}"},
    json={},
)
data = res.json()
```
