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

# Approve an AI match-rule suggestion (create the rule)

> Approves a PENDING_REVIEW suggestion and creates the match rule through the deterministic configuration write path. This is the ONLY path from an AI suggestion to an active match rule, and it runs only on explicit human approval. The approving principal is recorded for audit. Tenant from the JWT, context from the path.



## OpenAPI

````yaml en/openapi/v3-current/matcher.yaml post /v1/matching/contexts/{contextId}/rule-suggestions/{suggestionId}/approve
openapi: 3.1.0
info:
  title: Matcher APIs
  description: >-
    Complete API reference for the Matcher reconciliation engine, providing
    automated transaction matching between Midaz Ledger and external systems.
  version: 4.1.0
  license:
    name: Elastic License 2.0
    url: https://www.elastic.co/licensing/elastic-license
servers:
  - url: https://matcher.sandbox.lerian.net
security: []
paths:
  /v1/matching/contexts/{contextId}/rule-suggestions/{suggestionId}/approve:
    post:
      tags:
        - Matching
      summary: Approve an AI match-rule suggestion (create the rule)
      description: >-
        Approves a PENDING_REVIEW suggestion and creates the match rule through
        the deterministic configuration write path. This is the ONLY path from
        an AI suggestion to an active match rule, and it runs only on explicit
        human approval. The approving principal is recorded for audit. Tenant
        from the JWT, context from the path.
      operationId: approveMatchRuleSuggestion
      parameters:
        - description: Context ID
          in: path
          name: contextId
          required: true
          schema:
            description: Context ID
            format: uuid
            type: string
        - description: Suggestion ID
          in: path
          name: suggestionId
          required: true
          schema:
            description: Suggestion ID
            format: uuid
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApproveRuleSuggestionResponse'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      security:
        - BearerAuth: []
components:
  schemas:
    ApproveRuleSuggestionResponse:
      additionalProperties: false
      properties:
        createdRuleId:
          description: Identifier of the match rule created from the approved suggestion
          examples:
            - 550e8400-e29b-41d4-a716-446655440000
          type: string
        reviewId:
          description: Identifier of the approved suggestion review
          examples:
            - 550e8400-e29b-41d4-a716-446655440000
          type: string
      required:
        - reviewId
        - createdRuleId
      type: object
    Detail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          examples:
            - ERR-0001
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Bearer token authentication (format: "Bearer {token}")'

````