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

# Preview a rule

> Evaluates a condition against recent records and reports what would pass and what would fail, without saving anything. Use it to size an alert before committing to it.

A preview reports on the condition only. It does not compute the values a substitute rule's method chain would produce.



## OpenAPI

````yaml POST /projects/{project_id}/rules/preview
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/preview:
    post:
      summary: Preview a rule
      description: >-
        Evaluates a condition against recent records and reports what would pass
        and what would fail, without saving anything. Use it to size an alert
        before committing to it.


        A preview reports on the condition only. It does not compute the values
        a substitute rule's method chain would produce.
      operationId: preview-project-rule
      parameters:
        - name: project_id
          in: path
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - rule
              properties:
                page:
                  type: integer
                  default: 1
                page_size:
                  type: integer
                  default: 25
                  description: Maximum 200.
                rule:
                  type: object
                  required:
                    - rule_text
                    - target_type
                  properties:
                    rule_text:
                      type: string
                    target_type:
                      type: string
                      enum:
                        - data_point
                        - model
                    modeling_model_id:
                      type: string
                      description: >-
                        Required when previewing a model rule. Pass the model's
                        friendly ID.
                    subject_slugs:
                      type: array
                      items:
                        type: string
                      description: >-
                        Narrows preview results to these slugs. Ignored for
                        model previews.
                    effective_from:
                      type: string
                      format: date
                      nullable: true
                    effective_to:
                      type: string
                      format: date
                      nullable: true
                    id:
                      type: string
                      description: >-
                        An existing rule's friendly ID, excluded from duplicate
                        detection so you can preview an edit.
            examples:
              Request Example:
                value:
                  rule:
                    rule_text: '{{data-point.ambient-temperature-c}} < 0'
                    target_type: data_point
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  valid:
                    type: boolean
                  error:
                    type: string
                    nullable: true
        '422':
          description: >-
            A duplicate rule repeats its detail as a `duplicate_rule` sibling of
            `errors` as well as inside the entry. Its `message` ends with the
            existing rule's effective period in parentheses, which the example
            below leaves off: read the period from `duplicate_rule` rather than
            parsing the text.
          content:
            application/json:
              examples:
                Result:
                  value:
                    errors:
                      - message: >-
                          A rule with the same expression already exists: 'Fill
                          ambient temperature dropouts'
                        field: rule_text
                        code: duplicate_rule
                        duplicate_rule:
                          friendly_id: rule_Qb3k9TzdL0pWnXyz
                          name: Fill ambient temperature dropouts
                          effective_from: '2026-01-01'
                          effective_to: null
                    duplicate_rule:
                      friendly_id: rule_Qb3k9TzdL0pWnXyz
                      name: Fill ambient temperature dropouts
                      effective_from: '2026-01-01'
                      effective_to: null
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: Authorization
      x-bearer-format: ''

````