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

# Cancel Batch

> Cancels a running batch. This will mark the batch as cancelled and remove any pending jobs from the queue. Jobs that are already in progress will complete.



## OpenAPI

````yaml openapi-v0.json post /v0/batches/{id}/cancel
openapi: 3.0.0
info:
  title: API Documentation
  description: API description
  version: '0'
  contact: {}
servers:
  - url: https://api.promptloop.com/
    description: Production API v0
security: []
tags: []
paths:
  /v0/batches/{id}/cancel:
    post:
      tags:
        - Batches
      summary: Cancel Batch
      description: >-
        Cancels a running batch. This will mark the batch as cancelled and
        remove any pending jobs from the queue. Jobs that are already in
        progress will complete.
      operationId: BatchesController_cancelBatch
      parameters:
        - name: id
          required: true
          in: path
          description: Batch ID to cancel
          schema:
            type: string
      responses:
        '200':
          description: Batch successfully cancelled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelBatchResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      security:
        - x-api-key: []
components:
  schemas:
    CancelBatchResponseDto:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
            - error
          example: success
        data:
          $ref: '#/components/schemas/BatchCancelResponseDto'
        message:
          type: string
        error:
          $ref: '#/components/schemas/ErrorDetailsDto'
      required:
        - status
        - data
        - message
    ErrorResponseDto:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
            - error
          example: error
        data:
          type: object
        message:
          type: string
        error:
          $ref: '#/components/schemas/ErrorDetailsDto'
      required:
        - status
        - data
        - message
    BatchCancelResponseDto:
      type: object
      properties:
        batch_id:
          type: string
          example: a427201b-2340-4f06-ad68-2da8e0fdb120
          description: Batch ID
        cancelled:
          type: boolean
          example: true
          description: Whether the batch was cancelled
        jobs_removed:
          type: number
          example: 5
          description: Number of jobs that were removed from queue
      required:
        - batch_id
        - cancelled
        - jobs_removed
    ErrorDetailsDto:
      type: object
      properties:
        code:
          type: number
        details:
          type: string
      required:
        - code
        - details
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key

````