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

# Cancel Batch

> Cancels a running or pending batch and removes all pending calls from the processing queue.



## OpenAPI

````yaml post /api/v1/batch/cancel
openapi: 3.0.3
info:
  title: Dialgen API
  description: >-
    Dialgen API allows you to programmatically initiate and monitor AI-powered
    voice calls, either one at a time or in high-volume batches.
  version: 1.0.0
  contact:
    name: Dialgen Support
    url: https://sa.dialgen.ai
servers:
  - url: https://sa.dialgen.ai
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Agents
    description: Operations related to AI agents
  - name: Calls
    description: Operations related to individual calls
  - name: Batches
    description: Operations related to batch campaigns
paths:
  /api/v1/batch/cancel:
    post:
      tags:
        - Batches
      summary: Cancel Batch
      description: >-
        Cancels a running or pending batch and removes all pending calls from
        the processing queue.
      operationId: cancelBatch
      parameters:
        - name: batchId
          in: query
          description: The ID of the batch to cancel
          required: true
          schema:
            type: string
            example: batch_123...
      responses:
        '200':
          description: Batch cancelled successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelBatchResponse'
              example:
                success: true
                batchId: batch_123...
                status: cancelled
                cancelledJobs: 50
                message: Batch processing cancelled successfully
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    CancelBatchResponse:
      type: object
      properties:
        success:
          type: boolean
        batchId:
          type: string
        status:
          type: string
        cancelledJobs:
          type: number
        message:
          type: string
    Error:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
        message:
          type: string
        details:
          type: object
  responses:
    BadRequest:
      description: Missing or invalid fields/parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Bad Request
            message: Missing required parameter
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Unauthorized
            message: Invalid or missing API key
    NotFound:
      description: The requested resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Not Found
            message: Resource not found
    InternalServerError:
      description: An unexpected server error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Internal Server Error
            message: An unexpected error occurred
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer token authentication. Obtain your API key from the Dialgen API
        Keys dashboard at https://sa.dialgen.ai/api-keys

````