> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mithunai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel a running ingestion job early

> Ask an active job to stop. Cancellation is cooperative: a running job stops between documents, and what it already ingested stays rather than being rolled back.

Cancellation is cooperative. A job that is `pending` or `queued` never starts. A `running` job stops between documents, and documents ingested before it stops remain in the collection. The job's status becomes `cancelled` once it has stopped, so poll [Get a job](/api-reference/knowledge/get-job) to confirm. A cancellation applies to the current attempt only: if that attempt ends before it next checks, the job keeps the status it ended with, and if it failed and is retried, the retry runs.

`requested` is `false` when there is no active job with this ID in your organization. That covers a job that has already ended, an ID that does not exist, and another organization's job, which are deliberately not distinguished. Only an ID longer than 64 characters returns `404`.

Cancelling requires a role that can add documents. A read-only member receives `403`.

<ParamField path="job_id" type="string" required>
  Job ID (a UUID).
</ParamField>

## Response

<ResponseField name="requested" type="boolean" required>
  `true` when cancellation was recorded on an active job. `false` otherwise.
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl --request POST "$MITHUNAI_URL/arukz/api/v1/knowledge/jobs/9a4c2e71-6b0d-4f38-a5e2-1c7d8f3b6e40/cancel" \
    --header "Authorization: Bearer $MITHUNAI_API_KEY"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os, requests

  job_id = "9a4c2e71-6b0d-4f38-a5e2-1c7d8f3b6e40"
  response = requests.post(
      f"{os.environ['MITHUNAI_URL']}/arukz/api/v1/knowledge/jobs/{job_id}/cancel",
      headers={"Authorization": f"Bearer {os.environ['MITHUNAI_API_KEY']}"},
      timeout=60,
  )
  response.raise_for_status()
  print(response.json())
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const jobId = '9a4c2e71-6b0d-4f38-a5e2-1c7d8f3b6e40'
  const response = await fetch(
    `${process.env.MITHUNAI_URL}/arukz/api/v1/knowledge/jobs/${jobId}/cancel`,
    {
      method: 'POST',
      headers: { Authorization: `Bearer ${process.env.MITHUNAI_API_KEY}` },
    },
  )
  console.log(await response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  { "requested": true }
  ```

  ```json 200 (no active job) theme={"theme":{"light":"github-light","dark":"github-dark"}}
  { "requested": false }
  ```

  ```json 403 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  { "code": "authorization_error", "message": "You do not have permission to perform this action." }
  ```
</ResponseExample>
