> For a complete page index of the Captain API documentation, fetch https://docs.captain.dev/llms.txt?excludeSpec=true

# Cancel Parse Job

DELETE https://api.captain.dev/v3/parse/jobs/{job_id}

Stops a running parse job, or deletes a finished job's result before it expires. A cancelled job is not billed.

Reference: https://docs.captain.dev/reference/v3/parse/jobs/cancel

## Request

### Path parameters

- `job_id` (string, required)

### Headers

- `authorization` (string, optional)

## Response

### 200

The job after cancellation.

- `job_id` (string, required)
- `type` (enum, required)
  - Allowed values: `document`, `spreadsheet`
- `status` (enum, required)
  - Allowed values: `queued`, `processing`, `completed`, `failed`, `cancelled`
- `created_at` (string, required)
- `file` (ParseJobV3File, optional)
- `options` (ParseJobV3Options, optional) — The options the job ran with. Credentials are never returned.
- `chunker_version` (string, optional, nullable)
- `usage` (ParseJobV3Usage, optional) — What this job was billed, at the same rates as indexing. Documents bill per page. Spreadsheets bill no pages: their credits come from the sheet text and any described images.
- `chunk_count` (integer, optional, nullable)
- `chunks` (list of ParseChunkV3, optional, nullable) — The chunks, in order, when the result is 1 MB or smaller. Larger results are returned only through `result_url`.
- `result_url` (string, optional, nullable)
- `result_expires_at` (string, optional, nullable)
- `error` (ParseJobV3Error, optional, nullable) — Why the job failed. Present when `status` is `failed`. A failed job is not billed.
- `completed_at` (string, optional, nullable)

## Errors

### 401 Unauthorized Error

Missing or invalid API key.

- `error` (string, optional)
- `message` (string, optional)

### 404 Not Found Error

No parse job with this id belongs to the organization (`not_found`).

- `error` (string, required)
- `message` (string, required)
- `path` (string, optional)

## Types

### ParseJobV3File

- `name` (string, optional)
- `type` (string, optional)
- `pages` (integer, optional, nullable)

### ParseJobV3Options

The options the job ran with. Credentials are never returned.

### ParseJobV3Usage

What this job was billed, at the same rates as indexing. Documents bill per page. Spreadsheets bill no pages: their credits come from the sheet text and any described images.

- `pages_basic` (integer, optional) — Pages billed at the basic rate.
- `pages_advanced` (integer, optional) — Pages billed at the advanced rate.
- `credits` (double, optional) — Total credits billed for the job, including spreadsheet text and image credits.

### ParseChunkV3

- `chunk_id` (string, required) — Stable identifier of the chunk within this job.
- `chunk_index` (integer, required) — Position of the chunk within its parent section. Numbering restarts for each `parent_chunk_index`.
- `parent_chunk_index` (integer, required) — Index of the parent section the chunk was cut from. Order chunks by `parent_chunk_index`, then `chunk_index`.
- `text` (string, required) — Chunk text, the same text Captain embeds and stores when indexing this file.
- `tokens` (integer, required) — Token count of the chunk.
- `location` (ParseLocationV3, required) — Source position for a returned chunk. Fields that do not apply to the source type are returned as null.
- `chunk_type` (enum, optional, nullable) — Layout role of the chunk when the parser reports one. Can be null, for example on long documents parsed in page ranges.
  - Allowed values: `body`, `table`, `heading`, `page_header`, `page_footer`, `footnote`, `figure`
- `sheet` (ParseChunkSheetV3, optional, nullable) — Spreadsheet structure for a chunk. Present on spreadsheet chunks only.
- `tags` (list of string, optional, nullable) — Present when `include_tags_summary` is true.
- `summary` (string, optional, nullable)
- `verified_facts` (ParseChunkV3VerifiedFacts, optional, nullable) — Present on spreadsheet row-group chunks when `include_verified_facts` is true.

### ParseJobV3Error

Why the job failed. Present when `status` is `failed`. A failed job is not billed.

- `code` (string, required) — One of `unsupported_file_type`, `download_failed`, `file_too_large`, `parse_failed`, `chunk_failed`, `assemble_failed`, `timed_out` or `start_failed`.
- `message` (string, required)

### ParseLocationV3

Source position for a returned chunk. Fields that do not apply to the source type are returned as null.

- `page_start` (integer, optional, nullable) — First page covered by the chunk for paged documents.
- `page_end` (integer, optional, nullable) — Last page covered by the chunk for paged documents.
- `start_sec` (double, optional, nullable)
- `end_sec` (double, optional, nullable)
- `sheet_name` (string, optional, nullable) — Worksheet name for spreadsheet chunks.
- `section` (string, optional, nullable)
- `row_start` (integer, optional, nullable) — First spreadsheet row covered by the chunk.
- `row_end` (integer, optional, nullable) — Last spreadsheet row covered by the chunk.
- `col_start` (integer, optional, nullable) — First spreadsheet column covered by the chunk.
- `col_end` (integer, optional, nullable) — Last spreadsheet column covered by the chunk.
- `columns` (list of string, optional, nullable)
- `row_role` (string, optional, nullable)

### ParseChunkSheetV3

Spreadsheet structure for a chunk. Present on spreadsheet chunks only.

- `section` (string, optional, nullable)
- `columns` (list of string, optional, nullable) — Column headers exactly as they appear in the sheet. Multi-row headers are joined with ` / `.
- `row_role` (string, optional, nullable)
- `structured_fields` (map from string to string, optional, nullable) — Values of the chunk's first row, keyed by column header.

### ParseChunkV3VerifiedFacts

Present on spreadsheet row-group chunks when `include_verified_facts` is true.

## Examples

**Response**

```json
{
  "job_id": "prs_8f14e45fceea167a5a36dedd4bea2543",
  "type": "document",
  "status": "cancelled",
  "created_at": "2026-10-01T15:04:05Z",
  "file": {
    "name": "report.pdf",
    "type": "pdf",
    "pages": 12
  },
  "options": {
    "processing_type": "advanced"
  },
  "chunker_version": null,
  "usage": {
    "pages_basic": 0,
    "pages_advanced": 0,
    "credits": 0
  },
  "chunk_count": null,
  "chunks": null,
  "result_url": null,
  "result_expires_at": null,
  "error": null,
  "completed_at": "2026-10-01T15:04:20Z"
}
```

**SDK Code**

```python
import requests

BASE_URL = "https://api.captain.dev"
API_KEY = "your_api_key"
JOB_ID = "prs_8f14e45fceea167a5a36dedd4bea2543"

headers = {
    "Authorization": f"Bearer {API_KEY}",
}

response = requests.delete(
    f"{BASE_URL}/v3/parse/jobs/{JOB_ID}",
    headers=headers,
    timeout=30.0
)

if response.status_code == 200:
    job = response.json()
    print(f"Job {job['job_id']} is {job['status']}")
else:
    print(f"Error: {response.status_code}")
```

```typescript
const BASE_URL = "https://api.captain.dev";
const API_KEY = "your_api_key";
const JOB_ID = "prs_8f14e45fceea167a5a36dedd4bea2543";

const response = await fetch(
    `${BASE_URL}/v3/parse/jobs/${JOB_ID}`,
    {
        method: "DELETE",
        headers: {
            "Authorization": `Bearer ${API_KEY}`,
        }
    }
);

if (response.ok) {
    const job = await response.json();
    console.log(`Job ${job.job_id} is ${job.status}`);
} else {
    console.error(`Error: ${response.status}`);
}
```