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

# Flush batch



## OpenAPI

````yaml /openapi.json post /api/v1/automations/{automationId}/batches/{batchId}/flush
openapi: 3.1.0
info:
  title: Capy API
  version: 1.0.0
  description: Programmatic access to Capy's agent platform.
servers:
  - url: https://api.capy.ai
security:
  - bearerAuth: []
tags:
  - name: automations
  - name: projects
  - name: threads
  - name: folders
  - name: tasks
  - name: messages
  - name: reviews
  - name: reviewRules
  - name: usage
  - name: users
paths:
  /api/v1/automations/{automationId}/batches/{batchId}/flush:
    post:
      tags:
        - automations
      summary: Flush batch
      operationId: automations.flushBatch
      parameters:
        - name: automationId
          in: path
          schema:
            type: string
          required: true
        - name: batchId
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: AutomationWebhookBatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationWebhookBatchEncoded'
        '401':
          description: capy/Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/capy_UnauthorizedEncoded'
        '403':
          description: capy/Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/capy_ForbiddenEncoded'
        '404':
          description: capy/AutomationNotFound
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/capy_AutomationNotFoundEncoded'
        '429':
          description: capy/RateLimited
          headers:
            retry-after:
              schema:
                type: integer
              required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/capy_RateLimitedEncoded'
      security:
        - bearerAuth: []
components:
  schemas:
    AutomationWebhookBatchEncoded:
      type: object
      properties:
        id:
          type: string
        automationId:
          type: string
        triggerId:
          type: string
        status:
          $ref: '#/components/schemas/WebhookBatchStatus'
        group:
          type: array
          items:
            $ref: '#/components/schemas/WebhookBatchGroupValue'
        eventCount:
          type: integer
        byteCount:
          type: integer
        firstEventAt:
          type: string
        lastEventAt:
          type: string
        dispatchAfter:
          type: string
        maxEvents:
          type: integer
        maxWaitSeconds:
          type: integer
        quietPeriodSeconds:
          anyOf:
            - type: integer
            - type: 'null'
        closedAt:
          anyOf:
            - type: string
            - type: 'null'
        reason:
          anyOf:
            - $ref: '#/components/schemas/WebhookBatchReason'
            - type: 'null'
        runId:
          anyOf:
            - type: string
            - type: 'null'
        runStatus:
          anyOf:
            - type: string
              enum:
                - queued
                - running
                - completed
                - failed
                - skipped
                - cancelled
            - type: 'null'
        jamId:
          anyOf:
            - type: string
            - type: 'null'
        failure:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - id
        - automationId
        - triggerId
        - status
        - group
        - eventCount
        - byteCount
        - firstEventAt
        - lastEventAt
        - dispatchAfter
        - maxEvents
        - maxWaitSeconds
        - quietPeriodSeconds
        - closedAt
        - reason
        - runId
        - runStatus
        - jamId
        - failure
      additionalProperties: false
    capy_UnauthorizedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - capy/Unauthorized
      required:
        - _tag
      additionalProperties: false
    capy_ForbiddenEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - capy/Forbidden
      required:
        - _tag
      additionalProperties: false
    capy_AutomationNotFoundEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - capy/AutomationNotFound
        automationId:
          type: string
      required:
        - _tag
        - automationId
      additionalProperties: false
    capy_RateLimitedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - capy/RateLimited
        retryAfterSeconds:
          type: integer
      required:
        - _tag
        - retryAfterSeconds
      additionalProperties: false
    WebhookBatchStatus:
      type: string
      enum:
        - collecting
        - queued
        - cancelled
      description: >-
        Collecting accepts events; queued has one automation run; cancelled
        retains scrubbed history without a run.
    WebhookBatchGroupValue:
      anyOf:
        - type: string
        - type: number
        - type: boolean
      description: >-
        A non-null finite JSON scalar; string, number, and boolean grouping
        values remain distinct.
    WebhookBatchReason:
      type: string
      enum:
        - count
        - quiet
        - max_wait
        - bytes
        - manual
        - cancelled
        - configuration_changed
        - disabled
        - project_deleted
      description: The boundary that closed or cancelled a webhook batch.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Capy API key
      description: An API key created in Capy under Settings → API.

````