> ## 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 batch inputs

> Edits an existing batch's inputs — the API equivalent of the dashboard's edit-batch flow. Use it to re-attach data points, adjust upstream batch allocations, or skip data point types so they are recorded as `skipped_input` rather than left missing. Each array replaces the current set for that field (it is not merged). The batch's model runs are re-staged and recomputed asynchronously, so the response returns the batch immediately, before recomputation finishes. A batch that already has allocations cannot be edited.



## OpenAPI

````yaml PATCH /ledgers/{ledger_id}/batches/{id}/update_inputs
openapi: 3.1.0
info:
  title: Mangrove - API
  version: 1.1.0
servers:
  - url: https://app.gomangrove.com/api/v1
security:
  - sec0: []
paths:
  /ledgers/{ledger_id}/batches/{id}/update_inputs:
    patch:
      summary: Update batch inputs
      description: >-
        Edits an existing batch's inputs — the API equivalent of the dashboard's
        edit-batch flow. Use it to re-attach data points, adjust upstream batch
        allocations, or skip data point types so they are recorded as
        `skipped_input` rather than left missing. Each array replaces the
        current set for that field (it is not merged). The batch's model runs
        are re-staged and recomputed asynchronously, so the response returns the
        batch immediately, before recomputation finishes. A batch that already
        has allocations cannot be edited.
      operationId: update-batch-inputs
      parameters:
        - name: ledger_id
          in: path
          description: Ledger friendly ID (e.g., lgr_abc123def456)
          schema:
            type: string
          required: true
        - name: id
          in: path
          description: Batch friendly ID (e.g., bat_abc123def456)
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                data_point_ids:
                  type: array
                  description: >-
                    Data point friendly IDs to attach as the batch's inputs.
                    Replaces the current set. Unknown IDs return 422.
                  items:
                    type: string
                batch_amounts:
                  type: array
                  description: >-
                    Upstream batch allocations. Replaces the current set. An
                    unknown batch_id returns 404.
                  items:
                    type: object
                    properties:
                      batch_id:
                        type: string
                        description: Upstream batch friendly ID
                      primary_output_amount:
                        type: number
                      allocation_group:
                        type: string
                        nullable: true
                skipped_data_point_type_ids:
                  type: array
                  description: >-
                    Numeric data point type IDs to skip. Each skipped type is
                    recorded as a zero-value `skipped_input` placeholder so the
                    batch stays auditable. Replaces the current set. Unknown or
                    out-of-config IDs return 422.
                  items:
                    type: integer
            examples:
              Skip data point types:
                value:
                  skipped_data_point_type_ids:
                    - 42
                    - 99
              Full edit:
                value:
                  data_point_ids:
                    - dat_abc123def456
                  batch_amounts:
                    - batch_id: bat_upstream0001
                      primary_output_amount: 100.5
                      allocation_group: null
                  skipped_data_point_type_ids:
                    - 42
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    id: bat_abc123def456
                    tracking_id: MG-2025-001
                    start_time: '2025-01-01T00:00:00.000Z'
                    end_time: '2025-03-31T23:59:59.000Z'
                    state: processing
                    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: 'Unknown batch ids: bat_upstream0001'
        '422':
          description: '422'
          content:
            application/json:
              examples:
                Cannot edit allocated batch:
                  value:
                    errors:
                      - message: Cannot edit a batch that has allocations
                Unknown data point ids:
                  value:
                    errors:
                      - message: 'Unknown data_point_ids: dat_missing00001'
                Unknown skipped type ids:
                  value:
                    errors:
                      - message: 'Unknown skipped_data_point_type_ids: 999999'
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: Authorization
      x-bearer-format: ''

````