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

# Cancel a batch job

> Cancels a batch job. This will stop the batch job from being processed further.



## OpenAPI

````yaml /openapi.json post /v1/batch-jobs/{batchJobId}/cancel
openapi: 3.0.0
info:
  title: Clavata Public API v1
  description: Endpoints for creating and managing jobs via the Clavata Public API.
  version: 1.0.0
  contact:
    name: Clavata.ai
    url: https://clavata.ai
    email: support@clavata.ai
servers:
  - url: https://gateway.app.clavata.ai:8443
security:
  - Bearer_Token: []
tags:
  - name: Public API
    description: Endpoints for creating and managing jobs via the Clavata Public API.
paths:
  /v1/batch-jobs/{batchJobId}/cancel:
    post:
      tags:
        - Batch Processing
      summary: Cancel a batch job
      description: >-
        Cancels a batch job. This will stop the batch job from being processed
        further.
      operationId: GatewayService_CancelBatchJob
      parameters:
        - name: batchJobId
          description: The ID of the batch job to cancel
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GatewayServiceCancelBatchJobBody'
        required: true
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1CancelBatchJobResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1GRPCErrorResponse'
        '499':
          description: Precheck Failures (Canceled)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1PrecheckFailureResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
components:
  schemas:
    GatewayServiceCancelBatchJobBody:
      type: object
    v1CancelBatchJobResponse:
      type: object
      properties:
        batchJobId:
          type: string
          title: The ID of the batch job that was canceled
        state:
          $ref: '#/components/schemas/v1BatchJobState'
        error:
          $ref: '#/components/schemas/v1BatchJobError'
    rpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
    v1GRPCErrorResponse:
      type: object
      properties:
        code:
          type: integer
          format: int32
          description: A [gRPC status code](https://grpc.io/docs/guides/status-codes/)
          title: gRPC Status Code
          readOnly: true
        message:
          type: string
          description: The human-readable error message
          title: Error Message
          readOnly: true
      title: A gRPC Status response
    v1PrecheckFailureResponse:
      type: object
      properties:
        code:
          type: integer
          format: int32
          description: A [gRPC status code](https://grpc.io/docs/guides/status-codes/)
          title: gRPC Status Code
          readOnly: true
        message:
          type: string
          description: The human-readable error message
          title: Error Message
          readOnly: true
        details:
          type: array
          items:
            $ref: '#/components/schemas/v1PrecheckFailure'
          description: An array of objects detailing why the content failed the prechecks.
    v1BatchJobState:
      type: string
      enum:
        - BATCH_JOB_STATE_UNSPECIFIED
        - BATCH_JOB_STATE_ERROR
        - BATCH_JOB_STATE_INITIALIZED
        - BATCH_JOB_STATE_QUEUED
        - BATCH_JOB_STATE_PREPROCESSING
        - BATCH_JOB_STATE_PREPROCESSED
        - BATCH_JOB_STATE_SUBMITTED
        - BATCH_JOB_STATE_POSTPROCESSING
        - BATCH_JOB_STATE_POSTPROCESSED
        - BATCH_JOB_STATE_COMPLETED
        - BATCH_JOB_STATE_CANCELLED
      default: BATCH_JOB_STATE_UNSPECIFIED
    v1BatchJobError:
      type: object
      properties:
        errorCode:
          $ref: '#/components/schemas/v1BatchJobErrorCode'
        errorMessage:
          type: string
    protobufAny:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties: {}
    v1PrecheckFailure:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/v1PrecheckFailureType'
        message:
          type: string
          title: An error message associated with the failure
        details:
          description: >-
            Details provides Additional about the failure. The shape will be
            different for each failure

            type.
        matchConfidence:
          $ref: '#/components/schemas/v1PrecheckMatchConfidence'
    v1BatchJobErrorCode:
      type: string
      enum:
        - BATCH_JOB_ERROR_UNSPECIFIED
        - BATCH_JOB_ERROR_INVALID_INPUT_FILE
        - BATCH_JOB_ERROR_INVALID_POLICY
        - BATCH_JOB_ERROR_INVALID_POLICY_VERSION
        - BATCH_JOB_ERROR_INVALID_PRIORITY
      default: BATCH_JOB_ERROR_UNSPECIFIED
    v1PrecheckFailureType:
      type: string
      enum:
        - PRECHECK_FAILURE_TYPE_UNSPECIFIED
        - PRECHECK_FAILURE_TYPE_NCMEC
        - PRECHECK_FAILURE_TYPE_UNSUPPORTED_IMAGE_FORMAT
        - PRECHECK_FAILURE_TYPE_INVALID_IMAGE
      default: PRECHECK_FAILURE_TYPE_UNSPECIFIED
      description: |2-
         - PRECHECK_FAILURE_TYPE_UNSPECIFIED: The precheck failure type is not specified
         - PRECHECK_FAILURE_TYPE_NCMEC: The content has been identified as CSAM due to its hash matching an entry in the NCMEC database.
         - PRECHECK_FAILURE_TYPE_UNSUPPORTED_IMAGE_FORMAT: The image format is not supported.
         - PRECHECK_FAILURE_TYPE_INVALID_IMAGE: The provided image is invalid or corrupted.
    v1PrecheckMatchConfidence:
      type: string
      enum:
        - PRECHECK_MATCH_CONFIDENCE_UNSPECIFIED
        - PRECHECK_MATCH_CONFIDENCE_EXACT
        - PRECHECK_MATCH_CONFIDENCE_HIGH
        - PRECHECK_MATCH_CONFIDENCE_MEDIUM
        - PRECHECK_MATCH_CONFIDENCE_LOW
      default: PRECHECK_MATCH_CONFIDENCE_UNSPECIFIED
      description: |2-
         - PRECHECK_MATCH_CONFIDENCE_UNSPECIFIED: Default / legacy / non-CSAM. Not a customer-facing confidence tier.
         - PRECHECK_MATCH_CONFIDENCE_EXACT: Exact match (NCMEC direct md5/sha1 hash lookup). Highest confidence; customers may auto-enforce.
         - PRECHECK_MATCH_CONFIDENCE_HIGH: PhotoDNA perceptual match, closest distance band (near-duplicate).
         - PRECHECK_MATCH_CONFIDENCE_MEDIUM: PhotoDNA perceptual match, middle distance band (moderate similarity).
         - PRECHECK_MATCH_CONFIDENCE_LOW: PhotoDNA perceptual match, farthest distance band (loose similarity; review recommended).
  securitySchemes:
    Bearer_Token:
      type: http
      scheme: bearer
      bearerFormat: JWT

````