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

> ## Agent Instructions
> Start with /introduction/getting-started. Use the Direct Query API (POST /query) with the Newton Fusion model (text, image, and video reasoning) or the Newton Omega encoder (time-series embeddings). ATAI_API_ENDPOINT must include the version path: /v0.5 for most APIs, /v0.6 for the Fine-Tuning Service. Pages whose descriptions are marked (Archived) document the legacy Lens runtime — do not use them for new projects.

# Cancel Job

> Cancel a running or pending job

<Callout icon="clock" color="#3064E3" iconType="solid">
  Requires [version 1.1.0](/release-notes/1.1.x#v1-1-0) or later of the Archetype platform.
</Callout>

## Overview

This endpoint cancels a job whose status is currently `PENDING`, `RUNNING`, or `PREEMPTED`.
Cancelled jobs cannot be resumed. To pause a job temporarily, use the [Pause
Job](/api-reference/batch/jobs/pause-job) endpoint instead.

## Request

<ParamField path="id" type="string" required>
  The unique job identifier
</ParamField>

## Response

<ResponseField name="id" type="string">
  The ID of the cancelled job
</ResponseField>

<ResponseField name="status" type="string">
  Updated job status (`CANCELLED`)
</ResponseField>

<ResponseField name="cancelled_at" type="string">
  Timestamp when the job was cancelled
</ResponseField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl -X POST https://api.u1.archetypeai.app/v0.5/batch/jobs/job_2abc3def4ghi5jkl6mno7pqr/cancel \
    -H "Authorization: Bearer $ATAI_API_KEY"
  ```

  ```python Python theme={"system"}
  import requests
  import os

  api_key = os.environ.get("ATAI_API_KEY")
  job_id = "job_2abc3def4ghi5jkl6mno7pqr"

  response = requests.post(
      f"https://api.u1.archetypeai.app/v0.5/batch/jobs/{job_id}/cancel",
      headers={"Authorization": f"Bearer {api_key}"}
  )

  result = response.json()
  print(f"Job {result['id']} — Status: {result['status']}")
  ```

  ```javascript JavaScript theme={"system"}
  const jobId = 'job_2abc3def4ghi5jkl6mno7pqr';

  const response = await fetch(`https://api.u1.archetypeai.app/v0.5/batch/jobs/${jobId}/cancel`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
    }
  });

  const result = await response.json();
  console.log(`Job ${result.id} — Status: ${result.status}`);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={"system"}
  {
    "id": "job_2abc3def4ghi5jkl6mno7pqr",
    "status": "CANCELLED",
    "cancelled_at": "2026-04-14T10:10:00Z"
  }
  ```

  ```json 404 - Not Found theme={"system"}
  {
    "code": "NOT_FOUND",
    "message": "Job not found",
    "error_uid": "err_abc123"
  }
  ```

  ```json 409 - Invalid State Transition theme={"system"}
  {
    "code": "CONFLICT",
    "message": "Cannot cancel job in COMPLETED state",
    "error_uid": "err_def456"
  }
  ```

  ```json 401 - Unauthorized theme={"system"}
  {
    "detail": "Invalid access with key: api_key_not_found"
  }
  ```
</ResponseExample>

<Note>
  Only jobs in `PENDING` or `RUNNING` status can be cancelled. Attempting to cancel a job that has already completed, failed, or been cancelled will return a `409 Conflict` error.
</Note>
