> ## Documentation Index
> Fetch the complete documentation index at: https://docs-pos.solya.app/llms.txt
> Use this file to discover all available pages before exploring further.

# List the network's business rules

> Returns the rules this network has defined, in EVALUATION order (priority, then id) — which is the order they will fire in, not an alphabetical convenience. Narrow with `actionFamily` (the act guarded) and `active`. Page with `page`/`pageSize` (max 100). A rule carries its `enforcementMode`: `BLOCK` refuses the act, `WARN` allows it and says so, `LOG` only leaves a trace — three values, and an interface offering two of them is lying about one.



## OpenAPI

````yaml /openapi.json get /v1/rules
openapi: 3.0.3
info:
  title: Solya POS API
  version: 1.0.0
  description: >-
    The Solya POS backend HTTP surface. Every documented operation is
    agent-ready: it carries an `operationId`, an agent-facing `description`, the
    `pos.*` scopes it enforces (`x-required-permissions`) and an `x-agent-tier`.
    Success responses return the payload as raw JSON; failures return the
    `ErrorResponse` envelope (`{ error: { code, message, statusCode } }`).
servers:
  - url: /
    description: The backend, relative to its deployed origin.
security: []
paths:
  /v1/rules:
    get:
      tags:
        - Settings
      summary: List the network's business rules
      description: >-
        Returns the rules this network has defined, in EVALUATION order
        (priority, then id) — which is the order they will fire in, not an
        alphabetical convenience. Narrow with `actionFamily` (the act guarded)
        and `active`. Page with `page`/`pageSize` (max 100). A rule carries its
        `enforcementMode`: `BLOCK` refuses the act, `WARN` allows it and says
        so, `LOG` only leaves a trace — three values, and an interface offering
        two of them is lying about one.
      operationId: listRules
      parameters:
        - schema:
            default: 1
            type: integer
            minimum: 1
            maximum: 9007199254740991
          in: query
          name: page
          required: false
          description: 1-based page index to return. Defaults to 1.
        - schema:
            default: 20
            type: integer
            minimum: 1
            maximum: 100
          in: query
          name: pageSize
          required: false
          description: Rows per page, 1..100. Defaults to 20.
        - schema:
            type: string
            enum:
              - RESTOCK_PLAN
              - REBALANCE_PLAN
              - MARKDOWN_PLAN
              - PRE_SEASON_PLAN
              - SUPPLIER_RETURN_PLAN
              - SUPPLIER_EXCHANGE_PLAN
              - RECOMMENDATION
              - WORKFLOW
          in: query
          name: actionFamily
          required: false
          description: >-
            The act the rule guards: one of the six plan families,
            `RECOMMENDATION` or `WORKFLOW`. Omit to list every rule.
        - schema:
            type: string
            enum:
              - 'true'
              - 'false'
          in: query
          name: active
          required: false
          description: >-
            `true` or `false` — keep only switched-on (or switched-off) rules;
            omit for both.
      responses:
        '200':
          description: A page of rules, in evaluation order, with the pagination totals.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      allOf:
                        - type: object
                          properties:
                            id:
                              type: string
                              minLength: 1
                            name:
                              type: string
                              minLength: 1
                              maxLength: 255
                            description:
                              nullable: true
                              type: string
                              maxLength: 2000
                            category:
                              type: string
                              enum:
                                - CAPACITY
                                - ASSORTMENT
                                - ORDERING
                                - TRANSFER
                                - PRICING
                                - DISTRIBUTION
                                - COMPLIANCE
                            condition:
                              type: object
                              properties:
                                contextType:
                                  type: string
                                  minLength: 1
                                contextParams:
                                  type: object
                                  additionalProperties:
                                    anyOf:
                                      - type: string
                                      - type: number
                                      - type: boolean
                                operator:
                                  type: string
                                  enum:
                                    - LOWER_THAN
                                    - LOWER_OR_EQUAL
                                    - GREATER_THAN
                                    - GREATER_OR_EQUAL
                                    - EQUAL
                                    - NOT_EQUAL
                                thresholdValue:
                                  type: number
                              required:
                                - contextType
                                - contextParams
                                - operator
                                - thresholdValue
                              additionalProperties: false
                            enforcementMode:
                              type: string
                              enum:
                                - BLOCK
                                - WARN
                                - LOG
                            checkLevel:
                              type: string
                              enum:
                                - SHOP
                                - BRAND
                                - PRODUCT
                                - VARIANT
                                - INVENTORY_ITEM
                                - PLAN
                                - PLAN_ITEM
                            evaluationPoints:
                              type: array
                              items:
                                type: string
                                enum:
                                  - PRE_PLAN_ITEM_ADD
                                  - PRE_PLAN_VALIDATE
                                  - RECOMMENDATION_GENERATION
                                  - WORKFLOW_EXECUTION
                                  - MANUAL_CHECK
                            actionFamily:
                              nullable: true
                              type: string
                              enum:
                                - RESTOCK_PLAN
                                - REBALANCE_PLAN
                                - MARKDOWN_PLAN
                                - PRE_SEASON_PLAN
                                - SUPPLIER_RETURN_PLAN
                                - SUPPLIER_EXCHANGE_PLAN
                                - RECOMMENDATION
                                - WORKFLOW
                            scopes:
                              type: array
                              items:
                                type: object
                                properties:
                                  position:
                                    type: integer
                                    minimum: 0
                                    maximum: 9007199254740991
                                  criteria:
                                    type: array
                                    items:
                                      oneOf:
                                        - type: object
                                          properties:
                                            kind:
                                              type: string
                                              enum:
                                                - TAG
                                            tagId:
                                              type: string
                                              minLength: 1
                                          required:
                                            - kind
                                            - tagId
                                          additionalProperties: false
                                        - type: object
                                          properties:
                                            kind:
                                              type: string
                                              enum:
                                                - ENTITY
                                            entityType:
                                              type: string
                                              enum:
                                                - PRODUCT
                                                - BRAND
                                                - VARIANT
                                                - INVENTORY_ITEM
                                                - SUPPLIER
                                                - FAMILY
                                            entityId:
                                              type: string
                                              minLength: 1
                                          required:
                                            - kind
                                            - entityType
                                            - entityId
                                          additionalProperties: false
                                  thresholdValue:
                                    type: number
                                required:
                                  - position
                                  - criteria
                                  - thresholdValue
                                additionalProperties: false
                            active:
                              type: boolean
                            priority:
                              type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                            templateId:
                              nullable: true
                              type: string
                              minLength: 1
                            phase:
                              nullable: true
                              type: string
                              enum:
                                - SCORING
                                - SIZING
                                - SOURCING
                                - APPROVAL
                            paradigm:
                              type: string
                              enum:
                                - VALIDATION
                                - DECISION_SHAPING
                            origin:
                              type: string
                              enum:
                                - centrale
                                - os
                            payload:
                              nullable: true
                          required:
                            - id
                            - name
                            - description
                            - category
                            - condition
                            - enforcementMode
                            - checkLevel
                            - evaluationPoints
                            - actionFamily
                            - scopes
                            - active
                            - priority
                            - templateId
                            - phase
                            - paradigm
                            - origin
                            - payload
                          additionalProperties: false
                        - type: object
                          properties:
                            version:
                              type: integer
                              minimum: 0
                              exclusiveMinimum: true
                              maximum: 9007199254740991
                          required:
                            - version
                          additionalProperties: false
                    description: The rows on this page, in the query's sort order.
                  total:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                    description: >-
                      Total rows matching the filter across ALL pages, not just
                      this one.
                  page:
                    type: integer
                    minimum: 0
                    exclusiveMinimum: true
                    maximum: 9007199254740991
                    description: The 1-based page number served.
                  pageSize:
                    type: integer
                    minimum: 0
                    exclusiveMinimum: true
                    maximum: 9007199254740991
                    description: Rows requested per page.
                  pageCount:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                    description: >-
                      Total number of pages; stop walking when `page` reaches
                      it.
                required:
                  - items
                  - total
                  - page
                  - pageSize
                  - pageCount
                additionalProperties: false
                description: >-
                  A page of rules, in evaluation order, with the pagination
                  totals.
                example:
                  items:
                    - id: rule-exchange-ratio
                      name: Ratio de recommande
                      description: >-
                        Sur un échange, recommander au moins 110 % de ce qui est
                        renvoyé.
                      category: COMPLIANCE
                      condition:
                        contextType: EXCHANGE_RECEIVE_RATIO
                        contextParams: {}
                        operator: LOWER_THAN
                        thresholdValue: 110
                      enforcementMode: BLOCK
                      checkLevel: PLAN
                      evaluationPoints:
                        - PRE_PLAN_VALIDATE
                      actionFamily: SUPPLIER_EXCHANGE_PLAN
                      scopes:
                        - position: 0
                          criteria:
                            - kind: ENTITY
                              entityType: SUPPLIER
                              entityId: supplier-sportswear
                          thresholdValue: 130
                      active: true
                      priority: 0
                      templateId: exchange_reorder_ratio
                      phase: null
                      paradigm: VALIDATION
                      payload: null
                      version: 1
                  total: 1
                  page: 1
                  pageSize: 20
                  pageCount: 1
        '400':
          description: >-
            The request failed schema validation; `error.fieldErrors` lists the
            fields.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          description: No valid credential was presented — send a bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: The actor is authenticated but lacks the required `pos.*` scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: An unexpected server error — safe to retry idempotent requests.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ValidationErrorResponse:
      type: object
      required:
        - error
      additionalProperties: false
      description: >-
        A `VALIDATION_FAILED` envelope carrying the offending fields in
        `fieldErrors`.
      properties:
        error:
          type: object
          required:
            - code
            - message
            - statusCode
          additionalProperties: false
          properties:
            code:
              type: string
              enum:
                - VALIDATION_FAILED
            message:
              type: string
            statusCode:
              type: integer
            fieldErrors:
              type: array
              description: >-
                One entry per rejected field: the field path and why it was
                rejected.
              items:
                type: object
                required:
                  - field
                  - message
                additionalProperties: false
                properties:
                  field:
                    type: string
                    description: Dot-path of the offending field.
                  message:
                    type: string
                    description: Why the field was rejected.
    ErrorResponse:
      type: object
      required:
        - error
      additionalProperties: false
      description: The uniform failure envelope every non-2xx response returns.
      properties:
        error:
          type: object
          required:
            - code
            - message
            - statusCode
          additionalProperties: false
          properties:
            code:
              type: string
              enum:
                - VALIDATION_FAILED
                - UNAUTHORIZED
                - FORBIDDEN
                - NOT_FOUND
                - CONFLICT
                - BUSINESS_RULE_VIOLATION
                - INTERNAL_ERROR
              description: >-
                Machine-readable kernel `ResultCode` — branch on this, not on
                `message`.
            message:
              type: string
              description: >-
                Human-readable explanation. Safe to surface; never leaks server
                internals.
            statusCode:
              type: integer
              description: >-
                The HTTP status, mirrored into the body so a client need not
                read headers.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        `Authorization: Bearer <token>`. Accepts EITHER a Keycloak access token
        (scopes-in-token) OR an opaque POS session token; both resolve to the
        same `pos.*` scope vocabulary the route guards enforce.

````