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

# List rules

> Lists the data rules on a project, most recently created first. Requires a token with Data Rules read permission.



## OpenAPI

````yaml GET /projects/{project_id}/rules
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:
    get:
      summary: List rules
      description: >-
        Lists the data rules on a project, most recently created first. Requires
        a token with Data Rules read permission.
      operationId: list-project-rules
      parameters:
        - name: project_id
          in: path
          schema:
            type: string
          required: true
        - name: page
          in: query
          schema:
            type: integer
            default: 1
        - name: page_size
          in: query
          schema:
            type: integer
            default: 20
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    data:
                      - id: rule_Qb3k9TzdL0pWnXyz
                        name: Negative Temp Alert
                        rule_type: alert
                        action: alert
                        method_chain: []
                        target_type: data_point
                        status: active
                        enabled: true
                        rule_text: '{{data-point.ambient-temperature-c}} < 0'
                        subject_slugs: []
                        alert_message: Ambient temperature below zero
                        version: 1
                        effective_from: null
                        effective_to: null
                        model_id: null
                        model_name: null
                        created_by: Sam Okonkwo
                        created_at: '2026-06-03T20:20:29.697Z'
                        updated_at: '2026-06-03T20:20:29.697Z'
                    info:
                      items: 1
                      page_size: 20
                      total_items: 1
                      current_page: 1
                      next_page: null
                      previous_page: null
                      total_pages: 1
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Rule'
                  info:
                    type: object
        '403':
          description: '403'
          content:
            application/json:
              examples:
                Result:
                  value:
                    errors:
                      - message: You are not authorized to perform this action
      deprecated: false
components:
  schemas:
    Rule:
      type: object
      description: >-
        A data rule on a project. The rule's identity is stable across edits;
        the condition lives on its latest version.
      properties:
        id:
          type: string
          description: Rule friendly ID.
          example: rule_Qb3k9TzdL0pWnXyz
        name:
          type: string
        rule_type:
          type: string
          enum:
            - alert
            - substitution
          description: Derived from `action`. Read-only.
        action:
          type: string
          enum:
            - alert
            - substitute
          description: >-
            `alert` flags the matching record and changes nothing. `substitute`
            replaces the matching value with one derived from `method_chain`.
            Only data point rules may substitute.
        method_chain:
          type: array
          description: >-
            Ordered substitution candidates. The first method that resolves
            wins. Empty on alert rules.
          items:
            $ref: '#/components/schemas/SubstitutionMethod'
        target_type:
          type: string
          enum:
            - data_point
            - model
          description: >-
            `data_point` evaluates event data as it arrives. `model` evaluates
            model outputs after a batch calculation.
        status:
          type: string
          enum:
            - active
        enabled:
          type: boolean
        rule_text:
          type: string
          description: The condition, in the rule expression language.
          example: '{{data-point.ambient-temperature-c}} < 0'
        subject_slugs:
          type: array
          items:
            type: string
          description: >-
            On an alert rule, narrows which of the values the condition reads
            may be flagged. On a substitute rule, names the single value the
            rule corrects.
        alert_message:
          type: string
          nullable: true
          description: >-
            Shown on the records this rule flags. Required on an alert rule.
            Optional on a substitute rule, where it covers the records whose
            method chain resolved nothing, and Mangrove supplies a default.
        version:
          type: integer
        effective_from:
          type: string
          format: date
          nullable: true
        effective_to:
          type: string
          format: date
          nullable: true
        model_id:
          type: string
          nullable: true
          description: Model rules only.
        model_name:
          type: string
          nullable: true
        created_by:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    SubstitutionMethod:
      type: object
      description: One candidate in a substitute rule's method chain.
      properties:
        method:
          type: string
          enum:
            - constant
            - fallback_to_dpt
            - forward_fill
            - backward_fill
            - trailing_average
            - trailing_min
            - trailing_max
          description: >-
            `constant` uses a fixed number and always resolves, so no method may
            follow it. `fallback_to_dpt` copies another data point type on the
            same event. `forward_fill` and `backward_fill` borrow the nearest
            earlier or later valid reading. The three trailing methods take the
            average, lowest or highest reading across a window.
        params:
          type: object
          description: >-
            `constant` takes `value`. `fallback_to_dpt` takes `slug`. The
            trailing methods take `window`. The two fills take no parameters.
          properties:
            value:
              type: number
              description: >-
                `constant` only. Rejected when the value would itself match the
                rule's condition.
            slug:
              type: string
              description: >-
                `fallback_to_dpt` only. A data point type slug on the same
                event.
            window:
              type: object
              description: Trailing methods only.
              properties:
                kind:
                  type: string
                  enum:
                    - rolling
                    - calendar
                value:
                  type: integer
                  description: Required on a rolling window. Not used on a calendar window.
                unit:
                  type: string
                  description: >-
                    Rolling windows take `second`, `minute`, `hour`, `day`,
                    `week`, `month` or `year`. Calendar windows take `day`,
                    `week`, `month`, `quarter` or `year`.
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: Authorization
      x-bearer-format: ''

````