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

# Cancel a batch job

> Marks a batch job for cancellation. Jobs in `QUEUED` state will not be processed. Jobs in `PROCESSING` state may not stop immediately.

**Errors**
- `400 already_cancelled` — Job is already `CANCELLED` or `CANCELLING`.
- `400 not_cancellable` — Job has status `COMPLETED` or `ERROR`.
- `400` — Invalid `process_id` or job does not belong to your account.



## OpenAPI

````yaml https://api.revenuebase.ai/v2/openapi.json post /v2/jobs/{process_id}/cancel
openapi: 3.1.0
info:
  title: Revenuebase API v2
  version: 0.1.0
servers:
  - url: https://api.revenuebase.ai
security: []
paths:
  /v2/jobs/{process_id}/cancel:
    post:
      tags:
        - Jobs
      summary: Cancel a batch job
      description: >-
        Marks a batch job for cancellation. Jobs in `QUEUED` state will not be
        processed. Jobs in `PROCESSING` state may not stop immediately.


        **Errors**

        - `400 already_cancelled` — Job is already `CANCELLED` or `CANCELLING`.

        - `400 not_cancellable` — Job has status `COMPLETED` or `ERROR`.

        - `400` — Invalid `process_id` or job does not belong to your account.
      operationId: cancel_job_v2_jobs__process_id__cancel_post
      parameters:
        - name: process_id
          in: path
          required: true
          schema:
            type: integer
            title: Process Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchEmailStatusResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: Python
          label: Python SDK
          source: |-
            from revenuebase_sdk import RevenuebaseClient

            client = RevenuebaseClient()

            job = client.jobs.cancel(process_id=42)
            print(job.current_status)  # "CANCELLING"
components:
  schemas:
    BatchEmailStatusResponse:
      properties:
        process_id:
          type: integer
          title: Process Id
        filename:
          type: string
          title: Filename
        current_status:
          type: string
          title: Current Status
        message:
          type: string
          title: Message
      type: object
      required:
        - process_id
        - filename
        - current_status
        - message
      title: BatchEmailStatusResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-key

````