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

# Reverse a rule run

> Takes a run back, undoing the verdicts it wrote. The run transitions immediately, so a second call finds a run that can no longer transition, while the unwinding itself happens in the background.

Rows are left untouched where a verdict was dismissed, where the row sits in a batch that has been reported, and where a later run has taken it over. Each is listed in `reversal_summary`.

Check `reversible` before calling. When it is false, `non_reversible_reason` says why.



## OpenAPI

````yaml POST /projects/{project_id}/rules/{rule_id}/runs/{id}/reverse
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}/rules/{rule_id}/runs/{id}/reverse:
    post:
      summary: Reverse a rule run
      description: >-
        Takes a run back, undoing the verdicts it wrote. The run transitions
        immediately, so a second call finds a run that can no longer transition,
        while the unwinding itself happens in the background.


        Rows are left untouched where a verdict was dismissed, where the row
        sits in a batch that has been reported, and where a later run has taken
        it over. Each is listed in `reversal_summary`.


        Check `reversible` before calling. When it is false,
        `non_reversible_reason` says why.
      operationId: reverse-rule-run
      parameters:
        - name: project_id
          in: path
          required: true
          description: Project friendly ID (e.g. `prj_AbCd1234567890Ef`).
          schema:
            type: string
        - name: rule_id
          in: path
          required: true
          description: Rule friendly ID.
          schema:
            type: string
        - name: id
          in: path
          required: true
          description: Run friendly ID (e.g. `rrun_AbCd1234567890Ef`).
          schema:
            type: string
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    id: rrun_AbCd1234567890Ef
                    rule_id: rule_AbCd1234567890Ef
                    state: reversing
                    phase: evaluating
                    trigger: on_demand
                    range_start: '2026-07-01T00:00:00Z'
                    range_end: '2026-07-31T23:59:59Z'
                    started_at: '2026-08-28T14:22:06Z'
                    finished_at: null
                    last_evaluated_at: '2026-08-28T14:22:31Z'
                    targets_total: 1450
                    targets_processed: 600
                    passed_count: 580
                    alerted_count: 20
                    results_changed_count: 12
                    newly_alerted_count: 9
                    newly_cleared_count: 3
                    reversible: false
                    non_reversible_reason: A run cannot be reversed while it is still evaluating
                    reversal_summary: null
                    triggered_by: Sam Okonkwo
                    error_message: null
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Run friendly ID (e.g. `rrun_AbCd1234567890Ef`).
                  rule_id:
                    type: string
                  state:
                    type: string
                    enum:
                      - running
                      - completed
                      - failed
                      - superseded
                      - reversing
                      - reversed
                      - reversal_failed
                  phase:
                    type: string
                    nullable: true
                    enum:
                      - queued
                      - preparing
                      - evaluating
                    description: >-
                      Where a running run has got to. Null once it is no longer
                      running.
                  trigger:
                    type: string
                    enum:
                      - authoring
                      - ingestion
                      - schedule_sweep
                      - on_demand
                    description: >-
                      What started the run. A run you create here is
                      `on_demand`.
                  range_start:
                    type: string
                    format: date-time
                  range_end:
                    type: string
                    format: date-time
                  started_at:
                    type: string
                    format: date-time
                    nullable: true
                  finished_at:
                    type: string
                    format: date-time
                    nullable: true
                  last_evaluated_at:
                    type: string
                    format: date-time
                    nullable: true
                  targets_total:
                    type: integer
                  targets_processed:
                    type: integer
                  passed_count:
                    type: integer
                  alerted_count:
                    type: integer
                  results_changed_count:
                    type: integer
                    description: How many verdicts this run actually changed.
                  newly_alerted_count:
                    type: integer
                  newly_cleared_count:
                    type: integer
                  reversible:
                    type: boolean
                    description: Whether this run can still be taken back.
                  non_reversible_reason:
                    type: string
                    nullable: true
                    description: Why it cannot, when `reversible` is false.
                  reversal_summary:
                    type: object
                    nullable: true
                    description: >-
                      What a reversal did, once one has run, including the rows
                      it declined to touch and why.
                  triggered_by:
                    type: string
                    nullable: true
                    description: >-
                      The name of the person who started it. Null for a run
                      started by an account-scoped token, which has no person
                      behind it.
                  error_message:
                    type: string
                    nullable: true
        '422':
          description: '422'
          content:
            application/json:
              examples:
                Result:
                  value:
                    errors:
                      - message: A reversal is already in progress for this rule
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        message:
                          type: string
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: Authorization
      x-bearer-format: ''

````