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

# Cancel Job

> Cancel a running or pending job.

Idempotent: cancelling an already-cancelled job returns 200.
For RUNNING jobs, returns 202 since the workflow handles cancellation
asynchronously.



## OpenAPI

````yaml https://dex.sgp.scale.com/openapi.json post /v1/projects/{project_id}/jobs/{job_id}/cancel
openapi: 3.1.0
info:
  title: Document Understanding API
  description: API for uploading and processing documents
  version: 0.4.5
servers: []
security:
  - ApiKey: []
    AccountId: []
tags:
  - name: Projects
    description: Operations related to project creation and management
  - name: Files
    description: Operations related to file upload and access
  - name: Parse
    description: Operations related to starting parse jobs and accessing their results
  - name: Vector Stores
    description: Operations related to vector store creation and management
  - name: Extract
    description: Operations related to starting extract jobs and accessing their results
  - name: Research
    description: Dex Research agent kickoff and results.
  - name: Jobs
    description: Operations related to monitoring jobs and their status
paths:
  /v1/projects/{project_id}/jobs/{job_id}/cancel:
    post:
      tags:
        - Jobs
      summary: Cancel Job
      description: |-
        Cancel a running or pending job.

        Idempotent: cancelling an already-cancelled job returns 200.
        For RUNNING jobs, returns 202 since the workflow handles cancellation
        asynchronously.
      operationId: cancel_job_v1_projects__project_id__jobs__job_id__cancel_post
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            title: Project Id
        - name: job_id
          in: path
          required: true
          schema:
            type: string
            title: Job Id
      responses:
        '200':
          description: Job cancelled (PENDING) or already cancelled (idempotent)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobEntity'
        '202':
          description: Cancellation requested for a RUNNING job
        '400':
          description: Job is in a terminal state (SUCCEEDED/FAILED)
        '404':
          description: Project or job not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    JobEntity:
      properties:
        id:
          type: string
          title: Id
          description: ID of the entity
        project_id:
          type: string
          title: Project Id
          description: ID of the project
        object:
          type: string
          const: job
          title: Object
          default: job
        operation:
          $ref: '#/components/schemas/JobOperationType'
          description: Operation type (e.g., 'parse')
        status:
          $ref: '#/components/schemas/JobStatus'
          description: Current job status
        source_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Id
          description: Source document/file ID
        correlation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Correlation Id
          description: Request correlation ID for tracing
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the job was created
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
          description: When the job started processing
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
          description: When the job completed
        result:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Result
          description: Job result payload when completed
        progress:
          anyOf:
            - $ref: '#/components/schemas/BatchParseProgress'
            - type: 'null'
          description: Live progress payload (used by batch jobs)
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message if job failed
        history:
          anyOf:
            - items:
                $ref: '#/components/schemas/JobHistoryEvent'
              type: array
            - type: 'null'
          title: History
          description: Timeline of job execution events
      type: object
      required:
        - id
        - project_id
        - operation
        - status
        - created_at
      title: JobEntity
      description: Job response model representing an asynchronous operation.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    JobOperationType:
      type: string
      enum:
        - parse
        - batch_parse
        - extract
        - research
        - vector_store
        - chunk
        - summarization
        - create_index
        - update_index
      title: JobOperationType
      description: Enum for job operation values.
    JobStatus:
      type: string
      enum:
        - pending
        - running
        - succeeded
        - partially_succeeded
        - failed
        - cancelled
      title: JobStatus
      description: Enum for job status values.
    BatchParseProgress:
      properties:
        total:
          type: integer
          title: Total
          description: Total number of files in the batch
        succeeded:
          type: integer
          title: Succeeded
          description: Number of successfully parsed files
        failed:
          type: integer
          title: Failed
          description: Number of files that failed to parse
        cancelled:
          type: integer
          title: Cancelled
          description: Number of cancelled child jobs
        pending:
          type: integer
          title: Pending
          description: Number of files still pending (0 when job is terminal)
        child_jobs:
          items:
            $ref: '#/components/schemas/BatchChildJobInfo'
          type: array
          title: Child Jobs
          description: Per-child job status
      type: object
      required:
        - total
        - succeeded
        - failed
        - cancelled
        - pending
        - child_jobs
      title: BatchParseProgress
      description: Live progress tracking for a batch parse job.
    JobHistoryEvent:
      properties:
        step:
          type: string
          title: Step
          description: Human-readable step name
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: When this event occurred
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
          description: Duration in milliseconds (for completed steps)
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: Event status (e.g., 'completed', 'failed')
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: Additional event details
      type: object
      required:
        - step
        - timestamp
      title: JobHistoryEvent
      description: A single event in the job execution timeline.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    BatchChildJobInfo:
      properties:
        source_document_id:
          type: string
          title: Source Document Id
          description: Source document ID
        job_id:
          type: string
          title: Job Id
          description: Child job ID
        status:
          $ref: '#/components/schemas/JobStatus'
          description: Status of the child job
        parse_result_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parse Result Id
          description: Parse result ID if succeeded
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message if failed
      type: object
      required:
        - source_document_id
        - job_id
        - status
      title: BatchChildJobInfo
      description: Status of a single child job within a batch.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication
    AccountId:
      type: apiKey
      in: header
      name: x-selected-account-id
      description: Selected Account ID

````