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

# Validate policy

> Validates policy rules without saving. Use this to check rules before creating a policy.



## OpenAPI

````yaml /api/openapi.json post /v1/policies/validate
openapi: 3.1.0
info:
  title: MeshQu API
  description: >-
    Governance infrastructure for policy-aware AI decisions. MeshQu does not run
    tools. It governs decisions about them.
  version: 1.9.0
  contact:
    name: MeshQu Support
    email: support@meshqu.com
  license:
    name: Proprietary
servers:
  - url: https://api.meshqu.com
    description: Deployed environment
security:
  - apiKey: []
    tenantId: []
tags:
  - name: Operations
    description: Health, readiness, metrics, and signing keys
  - name: Policies
    description: Policy management
  - name: Policy Groups
    description: Policy group management
  - name: Decisions
    description: Policy evaluation and recording
  - name: Chains
    description: Decision chain verification and sealing
  - name: Receipts
    description: Public receipt and bundle retrieval
  - name: Forms
    description: Attestation forms and public submission
  - name: Alerts
    description: Alert management and webhooks
  - name: Audit
    description: Audit log retrieval and verification
  - name: API Keys
    description: API key administration
  - name: Admin
    description: Tenant and platform administration
  - name: Dashboard
    description: Console dashboard data
  - name: Metrics
    description: Decision and overview metrics
  - name: Fields
    description: Field catalogue
  - name: Settings
    description: Tenant settings
  - name: Rule Creation Logs
    description: Rule authoring telemetry
paths:
  /v1/policies/validate:
    post:
      tags:
        - Policies
      summary: Validate policy
      description: >-
        Validates policy rules without saving. Use this to check rules before
        creating a policy.
      operationId: postV1PoliciesValidate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                decision_type:
                  minLength: 1
                  type: string
                rules:
                  minItems: 1
                  type: array
                  items:
                    type: object
                    properties:
                      code:
                        minLength: 1
                        maxLength: 50
                        type: string
                      name:
                        minLength: 1
                        maxLength: 200
                        type: string
                      description:
                        maxLength: 1000
                        type: string
                      rule_type:
                        anyOf:
                          - type: string
                            enum:
                              - presence
                          - type: string
                            enum:
                              - temporal
                          - type: string
                            enum:
                              - threshold
                          - type: string
                            enum:
                              - list
                          - type: string
                            enum:
                              - expression
                      condition:
                        anyOf:
                          - additionalProperties: true
                            type: object
                            properties:
                              required_fields:
                                type: array
                                items:
                                  type: string
                              forbidden_fields:
                                type: array
                                items:
                                  type: string
                              min_length:
                                type: object
                                additionalProperties:
                                  type: integer
                          - additionalProperties: true
                            type: object
                            properties:
                              field:
                                type: string
                              not_expired:
                                type: boolean
                              not_future:
                                type: boolean
                              reference_field:
                                type: string
                              max_days_after:
                                type: integer
                              min_days_before:
                                type: integer
                          - additionalProperties: true
                            type: object
                            properties:
                              field:
                                type: string
                              min:
                                type: number
                              max:
                                type: number
                              greater_than:
                                type: number
                              less_than:
                                type: number
                          - additionalProperties: true
                            type: object
                            properties:
                              field:
                                type: string
                              allowed:
                                type: array
                                items:
                                  type: string
                              forbidden:
                                type: array
                                items:
                                  type: string
                              case_sensitive:
                                type: boolean
                          - additionalProperties: true
                            type: object
                            properties:
                              expression:
                                type: string
                      severity:
                        anyOf:
                          - type: string
                            enum:
                              - low
                          - type: string
                            enum:
                              - medium
                          - type: string
                            enum:
                              - high
                          - type: string
                            enum:
                              - critical
                      is_active:
                        default: true
                        type: boolean
                      when:
                        anyOf:
                          - additionalProperties: false
                            type: object
                            properties:
                              field:
                                type: string
                              equals:
                                anyOf:
                                  - type: string
                                  - type: number
                                  - type: boolean
                            required:
                              - field
                              - equals
                          - additionalProperties: false
                            type: object
                            properties:
                              field:
                                type: string
                              in:
                                type: array
                                items:
                                  anyOf:
                                    - type: string
                                    - type: number
                            required:
                              - field
                              - in
                          - additionalProperties: false
                            type: object
                            properties:
                              field:
                                type: string
                              exists:
                                type: boolean
                            required:
                              - field
                              - exists
                          - additionalProperties: false
                            type: object
                            properties:
                              all:
                                type: array
                                items: 83abff0b-e22a-4f98-ae9c-b4e78ccc21bb
                            required:
                              - all
                          - additionalProperties: false
                            type: object
                            properties:
                              any:
                                type: array
                                items: 83abff0b-e22a-4f98-ae9c-b4e78ccc21bb
                            required:
                              - any
                      source_ref:
                        type: object
                        properties:
                          document:
                            maxLength: 500
                            type: string
                          section:
                            maxLength: 200
                            type: string
                          url:
                            maxLength: 2000
                            type: string
                      replaces_rule_code:
                        maxLength: 50
                        description: >-
                          Advisory lineage: rule code this replaces (not
                          included in snapshot hash)
                        type: string
                    required:
                      - code
                      - name
                      - rule_type
                      - condition
                      - severity
              required:
                - decision_type
                - rules
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  valid:
                    type: boolean
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        rule_index:
                          type: integer
                        rule_code:
                          type: string
                        field:
                          type: string
                        message:
                          type: string
                      required:
                        - rule_index
                        - rule_code
                        - field
                        - message
                  warnings:
                    type: array
                    items:
                      type: object
                      properties:
                        rule_index:
                          type: integer
                        rule_code:
                          type: string
                        message:
                          type: string
                      required:
                        - rule_index
                        - rule_code
                        - message
                required:
                  - valid
                  - errors
                  - warnings
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: mqu_<token>
      description: >-
        MeshQu API key passed as a bearer token: `Authorization: Bearer mqu_…`.
        Mint one in the console (Settings → API keys).
    tenantId:
      type: apiKey
      name: X-MeshQu-Tenant-Id
      in: header
      description: >-
        Tenant UUID for multi-tenant isolation. Required on all authenticated
        routes — validated before authentication (middleware/tenant.ts), so a
        missing or non-UUID header returns 400 (MISSING_TENANT_ID /
        INVALID_TENANT_ID) before the API key is checked.

````