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

# Cancel a pending job

> Cancel a PENDING job.

Cancel a PENDING job. Running or terminal jobs cannot be canceled.

Only a `pending` job (not yet claimed by the worker) can be canceled; it
transitions to `canceled` and stops being drained. A `running` or
already-terminal (`succeeded`/`failed`/`canceled`) job returns 409
`job_not_cancelable` -- cancellation never interrupts in-flight work. A job
that is not in the caller's visible set returns 404 `job_not_found` (a job
owned by another member is a 404, not a 409 -- admin keys act org-wide;).

## Authorization

This route requires the `write` scope.

A missing or invalid credential returns 401 [`authentication_error`](/errors/authentication_error). A valid credential without the scope returns 403 [`permission_denied`](/errors/permission_denied), and the problem body names the exact scope required.

## Headers

These are request conventions the contract does not declare as parameters, so they do not appear in the schema tables below.

| Header            | Applies        | What it does                                                                                        |
| ----------------- | -------------- | --------------------------------------------------------------------------------------------------- |
| `X-Exo-API-Key`   | Required       | Your Exo API key, `exo_<env>_<token>`. `Authorization: Bearer exo_...` is accepted as an alternate. |
| `X-Exo-Subject`   | Not applicable | This route is not subject-scoped.                                                                   |
| `Idempotency-Key` | Not honoured   | This route does not replay: cancelling an already-cancelled job is a no-op on the job's own state.  |
| `X-Request-Id`    | Response       | Returned on every response, including `204`s. Quote it in a support request.                        |

## Success responses

| Status | Meaning             |
| ------ | ------------------- |
| `200`  | Successful Response |

## Errors

| Status | Code                                                   | When                                                           |
| ------ | ------------------------------------------------------ | -------------------------------------------------------------- |
| `400`  | [`invalid_request`](/errors/invalid_request)           | Malformed request, for example an invalid cursor.              |
| `401`  | [`authentication_error`](/errors/authentication_error) | Missing or invalid credentials.                                |
| `403`  | [`permission_denied`](/errors/permission_denied)       | Missing scope, or an unprovisioned subject selector.           |
| `404`  | [`not_found`](/errors/not_found)                       | The resource does not exist, or is not visible to this caller. |
| `409`  | [`conflict`](/errors/conflict)                         | A conflict with the current state of the resource.             |
| `422`  | [`validation_error`](/errors/validation_error)         | The request was understood but failed field validation.        |
| `429`  | [`rate_limit_exceeded`](/errors/rate_limit_exceeded)   | Rate limit exceeded. Retry after the Retry-After interval.     |
| `503`  | [`service_degraded`](/errors/service_degraded)         | A dependency is temporarily unavailable. Safe to retry.        |

Beyond the shared statuses, this route can answer with [`job_not_cancelable`](/errors/job_not_cancelable), [`job_not_found`](/errors/job_not_found). Every problem body names its own `code`, and the `type` URI always resolves to the matching page.

Every error is an RFC 9457 `application/problem+json` body carrying a stable `code`, a `requestId`, and a `suggestedAction` where Exo has one. See [Errors](/platform/errors).

## Notes

* **Only a `pending` job can be cancelled.** A job the worker has already claimed returns 409 `job_not_cancelable`. Cancellation never interrupts work in flight.
* **A job you cannot see returns 404, not 409.** The visibility check runs before the state check.


## OpenAPI

````yaml openapi.json POST /v1/jobs/{job_id}/cancel
openapi: 3.1.0
info:
  contact:
    name: Exo
    url: https://get-exo.com/
  description: >-
    The Exo public developer API: ingest content, retrieve identity-conditioned
    context, and read the knowledge graph. Authenticate every request with an
    Exo API key, either as the X-Exo-API-Key header or as Authorization: Bearer
    exo_... . Errors follow RFC 9457 problem+json with a stable snake_case code
    on every body.
  title: Exo API
  version: 1.0.0
servers:
  - url: https://api.get-exo.com
security:
  - ApiKeyHeader: []
  - BearerAuth: []
tags:
  - name: retrieve
    x-group: Retrieval
  - name: search
    x-group: Search
  - name: ingest
    x-group: Ingestion
  - name: jobs
    x-group: Jobs
  - name: subjects
    x-group: Subjects
  - name: recall
    x-group: Recall
  - name: graph
    x-group: Graph
  - name: insights
    x-group: Contradictions and proposals
  - name: condition
    x-group: Condition
  - name: brain
    x-group: Brain
  - name: sessions
    x-group: Coding sessions
  - name: connectors
    x-group: Connectors
  - name: events
    x-group: Events and webhooks
  - name: meta
    x-group: Identity
  - name: keys
    x-group: Keys and sandbox
  - name: usage
    x-group: Usage
  - name: settings
    x-group: Settings
  - name: exports
    x-group: Exports
  - name: team
    x-group: Team
  - name: admin
    x-group: Account and purge
paths:
  /v1/jobs/{job_id}/cancel:
    post:
      tags:
        - jobs
      summary: Cancel a pending job
      description: >-
        Cancel a PENDING job. Running or terminal jobs cannot be canceled.


        Only a ``pending`` job (not yet claimed by the worker) can be canceled;
        it

        transitions to ``canceled`` and stops being drained. A ``running`` or

        already-terminal (``succeeded``/``failed``/``canceled``) job returns 409

        ``job_not_cancelable`` -- cancellation never interrupts in-flight work.
        A job

        that is not in the caller's visible set returns 404 ``job_not_found`` (a
        job

        owned by another member is a 404, not a 409 -- admin keys act org-wide;
        see

        ``_scope_predicate``).
      operationId: cancelJob
      parameters:
        - description: The job id (a UUID) returned by an ingest or import call.
          in: path
          name: job_id
          required: true
          schema:
            description: The job id (a UUID) returned by an ingest or import call.
            title: Job Id
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
          description: Successful Response
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Malformed request, for example an invalid cursor.
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Missing or invalid credentials
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Missing scope or unprovisioned subject
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: No such job in this organization
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The job is not in a cancelable (pending) state
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Validation Error
        '429':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Rate limit exceeded
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: A dependency is unavailable
components:
  schemas:
    Job:
      description: >-
        A pollable ingest/import/session job (spec 4.3).


        ``status`` is one of ``pending | running | succeeded | failed |
        canceled``

        (documented as a string, not a closed enum, so a future internal status

        never breaks a tolerant reader). ``error`` is the human failure reason,

        non-null only on ``failed``. ``result`` is the server's interpretation
        of a

        finished job (nodes/edges/domains created), null until the worker
        reports it.
      properties:
        completedAt:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Completedat
        createdAt:
          format: date-time
          title: Createdat
          type: string
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        id:
          title: Id
          type: string
        jobType:
          title: Jobtype
          type: string
        result:
          anyOf:
            - $ref: '#/components/schemas/JobResult'
            - type: 'null'
        status:
          title: Status
          type: string
      required:
        - id
        - jobType
        - status
        - createdAt
      title: Job
      type: object
    Problem:
      description: |-
        RFC 9457 problem+json envelope (spec D9), documented in OpenAPI.

        Invariant: ``code`` equals the tail of the ``type`` URI
        (``https://docs.get-exo.com/errors/<code>``).
      properties:
        code:
          title: Code
          type: string
        detail:
          title: Detail
          type: string
        documentationUrl:
          anyOf:
            - type: string
            - type: 'null'
          title: Documentationurl
        errors:
          anyOf:
            - items:
                $ref: '#/components/schemas/FieldViolation'
              type: array
            - type: 'null'
          title: Errors
        requestId:
          default: ''
          title: Requestid
          type: string
        status:
          title: Status
          type: integer
        suggestedAction:
          anyOf:
            - type: string
            - type: 'null'
          title: Suggestedaction
        title:
          title: Title
          type: string
        type:
          title: Type
          type: string
      required:
        - type
        - title
        - status
        - detail
        - code
      title: Problem
      type: object
    JobResult:
      description: >-
        The server's interpretation of a finished job: what it created.


        Populated from the worker's ``result`` block in ``payload_inline`` once
        the

        job completes; any field the worker did not report stays null.
      properties:
        domainsDetected:
          anyOf:
            - type: integer
            - type: 'null'
          title: Domainsdetected
        edgesCreated:
          anyOf:
            - type: integer
            - type: 'null'
          title: Edgescreated
        nodesCreated:
          anyOf:
            - type: integer
            - type: 'null'
          title: Nodescreated
      title: JobResult
      type: object
    FieldViolation:
      description: A single field-level violation inside a Problem ``errors[]`` list.
      properties:
        code:
          title: Code
          type: string
        field:
          title: Field
          type: string
        message:
          title: Message
          type: string
        pointer:
          title: Pointer
          type: string
      required:
        - pointer
        - field
        - code
        - message
      title: FieldViolation
      type: object
  securitySchemes:
    ApiKeyHeader:
      description: An Exo API key (exo_...) sent as the X-Exo-API-Key header.
      in: header
      name: X-Exo-API-Key
      type: apiKey
    BearerAuth:
      description: The same Exo API key (exo_...) sent as an Authorization bearer token.
      scheme: bearer
      type: http

````