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

# Propose a config-only field-map/dialect mapping for a source sample

> Inspects a representative sample of a source file and returns a CONFIG-ONLY mapping/dialect proposal (column→canonical-key suggestions, dialect, per-field confidence and rationale). It is ADVISORY and side-effect-free: producing a proposal PERSISTS NOTHING. The operator reviews the proposal and confirms it through the EXISTING field-map declaration path. The tenant is resolved from the JWT and the context/source from the path — never from the body. The response never carries parsed values, amounts, or transactions.



## OpenAPI

````yaml en/openapi/v3-current/matcher.yaml post /v1/imports/contexts/{contextId}/sources/{sourceId}/mapping-proposal
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/imports/contexts/{contextId}/sources/{sourceId}/mapping-proposal:
    post:
      tags:
        - Ingestion
      summary: Propose a config-only field-map/dialect mapping for a source sample
      description: >-
        Inspects a representative sample of a source file and returns a
        CONFIG-ONLY mapping/dialect proposal (column→canonical-key suggestions,
        dialect, per-field confidence and rationale). It is ADVISORY and
        side-effect-free: producing a proposal PERSISTS NOTHING. The operator
        reviews the proposal and confirms it through the EXISTING field-map
        declaration path. The tenant is resolved from the JWT and the
        context/source from the path — never from the body. The response never
        carries parsed values, amounts, or transactions.
      operationId: proposeMapping
      parameters:
        - description: Context ID
          in: path
          name: contextId
          required: true
          schema:
            description: Context ID
            format: uuid
            type: string
        - description: Source ID
          in: path
          name: sourceId
          required: true
          schema:
            description: Source ID
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProposeMappingRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MappingProposalResponse'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      security:
        - BearerAuth: []
components:
  schemas:
    ProposeMappingRequest:
      additionalProperties: false
      properties:
        format:
          description: Declared file format hint
          enum:
            - csv
            - json
            - xml
            - camt053
          examples:
            - csv
          type: string
        hints:
          additionalProperties:
            type: string
          description: >-
            Optional non-secret operator nudges (e.g. locale=pt-BR,
            has_header=true)
          type: object
        sample:
          description: Representative source-file sample
          examples:
            - |
              id;value;ccy;posted_at
              A1;10,50;BRL;2025-06-01
          minLength: 1
          type: string
      required:
        - sample
      type: object
    MappingProposalResponse:
      additionalProperties: false
      properties:
        dialect:
          $ref: '#/components/schemas/DialectResponse'
          description: >-
            Proposed source dialect; null when the advisor has no dialect
            suggestion
        fields:
          description: Per-field breakdown backing the proposed mapping
          items:
            $ref: '#/components/schemas/FieldProposalResponse'
          type:
            - array
            - 'null'
        mapping:
          additionalProperties: {}
          description: >-
            Proposed canonical field map (canonical key -> source column); null
            when the advisor could not propose a mapping
          type: object
      required:
        - fields
      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
    DialectResponse:
      additionalProperties: false
      properties:
        dateStyle:
          description: >-
            Detected date convention: iso (YYYY-MM-DD), iso_offset (RFC 3339
            with offset), dmy (DD/MM/YYYY), or mdy (MM/DD/YYYY)
          examples:
            - iso
          type: string
        decimalStyle:
          description: 'Detected amount decimal convention: dot (1234.56) or comma (1234,56)'
          examples:
            - comma
          type: string
        delimiter:
          description: 'Detected CSV field separator: comma, semicolon, tab, or pipe'
          examples:
            - semicolon
          type: string
        encoding:
          description: >-
            Detected file character encoding: utf-8, utf-8-sig (UTF-8 with BOM),
            cp1252 (Windows Latin-1), or iso-8859-1
          examples:
            - utf-8
          type: string
      required:
        - encoding
        - delimiter
        - decimalStyle
        - dateStyle
      type: object
    FieldProposalResponse:
      additionalProperties: false
      properties:
        canonicalKey:
          description: Canonical field-map key the proposal targets
          examples:
            - amount
          type: string
        confidence:
          description: Advisor confidence in this mapping, 0.0 (none) to 1.0 (certain)
          examples:
            - 0.92
          format: double
          maximum: 1
          minimum: 0
          type: number
        rationale:
          description: Short human-readable explanation for the suggestion
          examples:
            - numeric column with comma decimal
          type: string
        sourceColumn:
          description: Proposed source column feeding the canonical key
          examples:
            - value
          type: string
      required:
        - canonicalKey
        - sourceColumn
        - confidence
        - rationale
      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}")'

````