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

# Update a batch

> Updates a batch's tracking ID, the only editable field on a batch. The tracking ID is free text — commas and spaces are allowed, so a batch covering several deliveries can carry all of their numbers — and it is what the dashboard and reports show to identify the batch. Send an empty string to clear it. A batch whose tracking ID was computed from its model run cannot be renamed: a model that partitions by tracking ID (including composite partitions such as `tracking_id_and_feedstock`) stamps each batch from its own partitioning data points, and editing one returns 422. To change those, correct the tracking IDs on the underlying events and regenerate the batch.



## OpenAPI

````yaml PATCH /batches/{batch_id}
openapi: 3.1.0
info:
  title: Mangrove - API
  version: 1.1.0
servers:
  - url: https://app.gomangrove.com/api/v1
security:
  - sec0: []
paths:
  /batches/{batch_id}:
    patch:
      summary: Update a batch
      description: >-
        Updates a batch's tracking ID, the only editable field on a batch. The
        tracking ID is free text — commas and spaces are allowed, so a batch
        covering several deliveries can carry all of their numbers — and it is
        what the dashboard and reports show to identify the batch. Send an empty
        string to clear it. A batch whose tracking ID was computed from its
        model run cannot be renamed: a model that partitions by tracking ID
        (including composite partitions such as `tracking_id_and_feedstock`)
        stamps each batch from its own partitioning data points, and editing one
        returns 422. To change those, correct the tracking IDs on the underlying
        events and regenerate the batch.
      operationId: update-batch
      parameters:
        - name: batch_id
          in: path
          description: Batch friendly ID (e.g., ba_abc123def456)
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                tracking_id:
                  type: string
                  description: The batch's tracking ID. Send an empty string to clear it.
            examples:
              Rename a batch:
                value:
                  tracking_id: 2356-R, 2357-R, 2358-R
              Clear the tracking ID:
                value:
                  tracking_id: ''
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    id: ba_abc123def456
                    tracking_id: 2356-R, 2357-R, 2358-R
                    start_time: '2025-01-01T00:00:00.000Z'
                    end_time: '2025-03-31T23:59:59.000Z'
                    state: complete
                    error_message: null
                    primary_output:
                      id: 1
                      name: RNG produced
                      unit: MMBtu
                      data_point_type_id: 5
                      value: 9146
                    has_rule_alerts: false
                    created_at: '2025-01-15T10:00:00.000Z'
                    updated_at: '2025-04-02T11:30:00.000Z'
        '404':
          description: '404'
          content:
            application/json:
              examples:
                Result:
                  value:
                    errors:
                      - message: record not found
        '422':
          description: '422'
          content:
            application/json:
              examples:
                Tracking ID computed from the model run:
                  value:
                    errors:
                      - message: >-
                          Tracking id cannot be changed when computed from model
                          run
                        field: tracking_id
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: Authorization
      x-bearer-format: ''

````