# Stop a job run

> Source: https://docs.clonepartner.com/api-reference/job-runs/stop-job-run/

`POST /api/job-runs/{id}/stop`

Stops a running job run, cancels active task subprocesses, and marks the job run as completed. Individual task runs are stopped via SIGINT (local) or executor cancel (remote); their job-run-task rows become cancelled or skipped.

**Operation ID:** `stopJobRun`

## Authentication

### Option 1

- **BearerAuth** (`http bearer`)
  API key token. Create via POST /api/api-keys. Format: `envoy_<hex>`

### Option 2

- **CookieAuth** (`apiKey`)
  Session cookie set after login + TOTP verification

## Path parameters

- `id` — `integer`, `required`
  Resource ID

## Success responses

### 200

Job run stopped

**Content type:** `application/json`

- Type: `object`
- Properties:
  - `success` (`boolean`)

## Error responses

### 400

Cannot stop

**Content type:** `application/json`

- Reference: `Error`
  - Type: `object`
  - Properties:
    - `error` (`string`)
      - Example: `NOT_FOUND`
    - `message` (`string`)
      - Example: `Resource not found`

## Examples

### cURL

```bash
curl --request POST \
  --url 'https://your-envoy.example.com/api/job-runs/YOUR_ID/stop' \
  --header 'Authorization: Bearer $API_KEY'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/job-runs/YOUR_ID/stop', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
  },
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);
```
