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

# Cancel a batch

> Cancel a pending or scheduled batch and its underlying workflow. Admin only. Idempotent once cancelled. Only `pending`/`scheduled` batches can be cancelled (409 otherwise). Cross-tenant access returns 404.



## OpenAPI

````yaml /openapi.json delete /batches/{batch_id}
openapi: 3.1.0
info:
  title: GetDialed Flows API
  version: 0.1.0
servers:
  - url: https://api.getdialed.ai/flows
    description: Production
security: []
paths:
  /batches/{batch_id}:
    delete:
      tags:
        - batches
      summary: Cancel a batch
      description: >-
        Cancel a pending or scheduled batch and its underlying workflow. Admin
        only. Idempotent once cancelled. Only `pending`/`scheduled` batches can
        be cancelled (409 otherwise). Cross-tenant access returns 404.
      operationId: cancel_batch_batches__batch_id__delete
      parameters:
        - name: batch_id
          in: path
          required: true
          schema:
            type: string
            title: Batch Id
      responses:
        '204':
          description: Successful Response
        '401':
          description: Missing or invalid authentication
          content:
            application/json:
              example:
                detail: Authentication required
        '403':
          description: Caller is authenticated but not an admin
          content:
            application/json:
              example:
                detail: Admin role required
        '404':
          description: >-
            No such batch for this organization (cross-tenant access also
            returns 404)
          content:
            application/json:
              example:
                detail: Batch not found
        '409':
          description: Batch is already running or in a terminal state
          content:
            application/json:
              example:
                detail: Can only cancel pending or scheduled batches
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit exceeded — retry after the Retry-After header
          headers:
            Retry-After:
              description: Seconds to wait before retrying
              schema:
                type: integer
          content:
            application/json:
              example:
                detail: 'Rate limit exceeded: 100 per 1 minute'
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    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-API-Key
    HTTPBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````