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

# Update Batch Session

> Updates a batch session. Supports cancelling a running or pending batch,
which terminates all running sessions in the batch.




## OpenAPI

````yaml /openapi.yaml patch /v1/batch-sessions/{batch_id}
openapi: 3.1.0
info:
  title: AnchorBrowser API
  version: 1.0.0
  description: APIs to manage all browser-related actions and configuration.
servers:
  - url: https://api.anchorbrowser.io
    description: API server
security: []
paths:
  /v1/batch-sessions/{batch_id}:
    patch:
      tags:
        - Batch Sessions
      summary: Update Batch Session
      description: |
        Updates a batch session. Supports cancelling a running or pending batch,
        which terminates all running sessions in the batch.
      parameters:
        - name: batch_id
          in: path
          required: true
          description: The unique identifier of the batch
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchSessionUpdateRequestSchema'
            examples:
              cancel_batch:
                summary: Cancel a running batch
                value:
                  status: cancelled
      responses:
        '200':
          description: Batch updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/BatchSessionUpdateResponseSchema'
        '401':
          description: Invalid API Key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Batch not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Invalid state transition (batch already cancelled or completed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - api_key_header: []
components:
  schemas:
    BatchSessionUpdateRequestSchema:
      type: object
      required:
        - status
      properties:
        status:
          type: string
          enum:
            - cancelled
          description: Target status for the batch
    BatchSessionUpdateResponseSchema:
      type: object
      properties:
        batch_id:
          type: string
          format: uuid
          description: Unique identifier for the batch
        status:
          type: string
          enum:
            - cancelled
          description: New status of the batch
        cancelled_sessions:
          type: integer
          description: Number of running sessions that were terminated
        message:
          type: string
          description: Summary message
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
  securitySchemes:
    api_key_header:
      type: apiKey
      in: header
      name: anchor-api-key
      description: API key passed in the header

````