> ## 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.

# Correct many data point values

> Applies many corrections in one all-or-nothing request. Each item speaks the same shape as a single correction and addresses its data point by event ID and slug, so one call can span many events and event types.

If any item fails, nothing is persisted. The response still reports every item so you can find the bad one: failing items carry `status: "error"` with a message, and items that would have succeeded come back as `not_applied`. Fix the reported item and resend the whole batch.

A `not_applied` item still carries a populated `correction` object, describing the change that was rolled back. Its `id` refers to a record that was never persisted, so do not store it or use it in a later request.

Requires corrections to be enabled on the account.



## OpenAPI

````yaml POST /projects/{project_id}/corrections/batch
openapi: 3.1.0
info:
  title: Mangrove - API
  version: 1.1.0
servers:
  - url: https://app.gomangrove.com/api/v1
security:
  - sec0: []
paths:
  /projects/{project_id}/corrections/batch:
    post:
      summary: Correct many data point values
      description: >-
        Applies many corrections in one all-or-nothing request. Each item speaks
        the same shape as a single correction and addresses its data point by
        event ID and slug, so one call can span many events and event types.


        If any item fails, nothing is persisted. The response still reports
        every item so you can find the bad one: failing items carry `status:
        "error"` with a message, and items that would have succeeded come back
        as `not_applied`. Fix the reported item and resend the whole batch.


        A `not_applied` item still carries a populated `correction` object,
        describing the change that was rolled back. Its `id` refers to a record
        that was never persisted, so do not store it or use it in a later
        request.


        Requires corrections to be enabled on the account.
      operationId: correct-many-data-point-values
      parameters:
        - name: project_id
          in: path
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - corrections
              properties:
                corrections:
                  type: array
                  description: >-
                    The corrections to apply, in order. Each item is reported
                    back by its index.
                  items:
                    type: object
                    required:
                      - event
                      - slug
                      - value
                    properties:
                      event:
                        type: string
                        description: 'Event friendly ID. For example: `evt_DLnYvzbjSujNAvXE`'
                      slug:
                        type: string
                        description: Data point type slug on that event's event type.
                      value:
                        description: >-
                          The corrected value. Required; a null value fails the
                          batch.
                        oneOf:
                          - type: number
                          - type: string
                          - type: boolean
                      method:
                        type: string
                        default: manual_entry
                      notes:
                        type: string
                      expect:
                        type: string
                        enum:
                          - gap
                          - existing
                        description: >-
                          Per-item guard, same semantics as the single-value
                          endpoint.
            examples:
              Request Example:
                value:
                  corrections:
                    - event: evt_DLnYvzbjSujNAvXE
                      slug: ambient-temperature-c
                      value: 12.4
                      notes: Sensor drift confirmed against the calibration log.
                    - event: evt_7nxaDUf65c36v6mz
                      slug: mass-flow-rate
                      value: 0
                      method: zero_fill
                      expect: gap
      responses:
        '200':
          description: Every correction applied.
          content:
            application/json:
              examples:
                Result:
                  value:
                    applied: true
                    results:
                      - index: 0
                        status: created
                        correction:
                          id: sub_9TnpQxL2mKdRvWs4
                          data_point_id: in_kiIuaGIUqRxWUmTY
                          stage: ingestion
                          source: api
                          method: manual_entry
                          origin: substituted
                          from_value: 14.9
                          to_value: 12.4
                          notes: Sensor drift confirmed against the calibration log.
                          rule: null
                          created_by: Aaron Rosenberg
                          created_at: '2026-07-21T14:02:55.000Z'
                      - index: 1
                        status: unchanged
                        correction:
                          id: sub_Lp7m2XcQd0RtVbnm
                          data_point_id: in_JuGzRS08MbVSEkCj
                          stage: ingestion
                          source: api
                          method: zero_fill
                          origin: imputed
                          from_value: null
                          to_value: 0
                          notes: null
                          rule: null
                          created_by: Aaron Rosenberg
                          created_at: '2026-07-20T11:30:00.000Z'
              schema:
                $ref: '#/components/schemas/BatchCorrectionsResult'
        '403':
          description: >-
            Corrections are not enabled on the account, or the token does not
            have Data Collection write permission.
          content:
            application/json:
              examples:
                Corrections not enabled:
                  value:
                    errors:
                      - message: Corrections are not enabled
                Insufficient permission:
                  value:
                    errors:
                      - message: You are not authorized to perform this action
        '422':
          description: Nothing was applied. At least one item failed.
          content:
            application/json:
              examples:
                Result:
                  value:
                    applied: false
                    results:
                      - index: 0
                        status: not_applied
                        correction:
                          id: sub_9TnpQxL2mKdRvWs4
                          data_point_id: in_kiIuaGIUqRxWUmTY
                          stage: ingestion
                          source: api
                          method: manual_entry
                          origin: substituted
                          from_value: 14.9
                          to_value: 12.4
                          notes: Sensor drift confirmed against the calibration log.
                          rule: null
                          created_by: Aaron Rosenberg
                          created_at: '2026-07-21T14:02:55.000Z'
                      - index: 1
                        status: error
                        error: Unknown event 'evt_doesNotExist01'
              schema:
                $ref: '#/components/schemas/BatchCorrectionsResult'
      deprecated: false
components:
  schemas:
    BatchCorrectionsResult:
      type: object
      properties:
        applied:
          type: boolean
          description: True when every item succeeded and the batch was committed.
        results:
          type: array
          description: One entry per submitted correction, in request order.
          items:
            type: object
            properties:
              index:
                type: integer
                description: Zero-based position of the item in the submitted array.
              status:
                type: string
                enum:
                  - created
                  - unchanged
                  - not_applied
                  - error
                description: >-
                  `created` applied a new correction. `unchanged` matched the
                  data point's latest correction, so nothing was written.
                  `not_applied` would have succeeded but was rolled back because
                  another item failed. `error` is the item that failed.
              correction:
                $ref: '#/components/schemas/DataPointCorrection'
                description: >-
                  Omitted entirely on `error` items. Present on `created`,
                  `unchanged` and `not_applied` items; on a `not_applied` item
                  it describes a change that was rolled back, so its `id` refers
                  to no stored record.
              error:
                type: string
                description: Present only on items whose status is `error`.
    DataPointCorrection:
      type: object
      description: One entry in a data point's correction history.
      properties:
        id:
          type: string
          description: Correction friendly ID.
          example: sub_9TnpQxL2mKdRvWs4
        data_point_id:
          type: string
          description: Friendly ID of the corrected data point.
          example: in_kiIuaGIUqRxWUmTY
        stage:
          type: string
          enum:
            - ingestion
            - value_stream
          description: >-
            `ingestion` corrections change the data point's value, which every
            model and report reads. Corrections written through this API are
            always `ingestion`. `value_stream` corrections are overrides scoped
            to a single value stream and leave the shared value untouched; they
            cannot be created here.
        source:
          type: string
          enum:
            - manual
            - api
            - rule
            - transformation
          description: >-
            Where the correction came from. Corrections written through this API
            are `api`.
        method:
          type: string
          description: >-
            How the value was arrived at, as supplied by the caller. Reverts are
            recorded with the reserved method `revert`.
          example: manual_entry
        origin:
          type: string
          enum:
            - substituted
            - imputed
            - reverted
          description: >-
            `substituted` changed an existing reading. `imputed` set a value
            where none was recorded, and is the case the Events table calls
            **Value was missing**. `reverted` restored the previous value.
        from_value:
          description: The value before this entry. Null when no reading existed.
          oneOf:
            - type: number
            - type: string
            - type: boolean
            - type: 'null'
        to_value:
          description: The value after this entry.
          oneOf:
            - type: number
            - type: string
            - type: boolean
            - type: 'null'
        notes:
          type:
            - string
            - 'null'
        rule:
          type:
            - object
            - 'null'
          description: >-
            The data rule that wrote this correction. Null for manual and API
            corrections.
          properties:
            name:
              type: string
            friendly_id:
              type: string
        created_by:
          type:
            - string
            - 'null'
          description: Name of the user the correction is attributed to.
        created_at:
          type: string
          format: date-time
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: Authorization
      x-bearer-format: ''

````