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

# Confirm Column Mapping

> Confirm or edit the column mapping for a document (Phase 7 HITL).

This will update the mapping in document_metadata and trigger
reprocessing of the document with the new mapping.

Requires: document:write permission



## OpenAPI

````yaml /openapi/merchantops-public.json post /api/lakehouse/documents/{document_id}/mapping/confirm
openapi: 3.1.0
info:
  description: >-
    Public API for the MerchantOps product catalog, pricing, and publishing
    surface.
  title: MerchantOps API
  version: 1.0.0
servers:
  - description: Production
    url: https://api.merchantops.ai
security: []
paths:
  /api/lakehouse/documents/{document_id}/mapping/confirm:
    post:
      tags:
        - Product Lakehouse
      summary: Confirm Column Mapping
      description: |-
        Confirm or edit the column mapping for a document (Phase 7 HITL).

        This will update the mapping in document_metadata and trigger
        reprocessing of the document with the new mapping.

        Requires: document:write permission
      operationId: confirm_column_mapping
      parameters:
        - in: path
          name: document_id
          required: true
          schema:
            title: Document Id
            type: string
        - in: header
          name: authorization
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - in: header
          name: X-Organization-ID
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Organization-Id
        - in: cookie
          name: stytch_session
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Stytch Session
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ColumnMappingConfirmRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ColumnMappingConfirmResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    ColumnMappingConfirmRequest:
      description: Request to confirm or edit column mapping.
      properties:
        column_mapping:
          anyOf:
            - additionalProperties:
                anyOf:
                  - type: string
                  - items:
                      type: string
                    type: array
                  - additionalProperties:
                      anyOf:
                        - type: string
                        - items:
                            type: string
                          type: array
                    type: object
                  - type: 'null'
              type: object
            - type: 'null'
          description: >-
            Updated column mapping: {expected_field: excel_column_name, list of
            columns, dict for additional_attributes, or null}
          title: Column Mapping
        field_rules:
          anyOf:
            - additionalProperties:
                items:
                  $ref: '#/components/schemas/FieldRule'
                type: array
              type: object
            - type: 'null'
          title: Field Rules
        group_mappings:
          anyOf:
            - items:
                $ref: '#/components/schemas/GroupMappingConfirm'
              type: array
            - type: 'null'
          title: Group Mappings
        include_policy_notes:
          default: true
          title: Include Policy Notes
          type: boolean
        policy_metadata:
          anyOf:
            - $ref: '#/components/schemas/PolicyMetadataConfig'
            - type: 'null'
        sheet_configs:
          anyOf:
            - items:
                $ref: '#/components/schemas/SheetConfigRequest'
              type: array
            - type: 'null'
          description: >-
            Per-sheet configuration: which sheets to include and their header
            rows
          title: Sheet Configs
      title: ColumnMappingConfirmRequest
      type: object
    ColumnMappingConfirmResponse:
      description: Response after confirming column mapping.
      properties:
        document_id:
          title: Document Id
          type: string
        message:
          title: Message
          type: string
        status:
          title: Status
          type: string
      required:
        - document_id
        - status
        - message
      title: ColumnMappingConfirmResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    FieldRule:
      description: A transformation rule attached to a specific mapped field.
      properties:
        adjustment_amount:
          anyOf:
            - type: number
            - type: 'null'
          title: Adjustment Amount
        char_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Char Count
        default:
          anyOf:
            - type: string
            - type: 'null'
          title: Default
        delimiter:
          anyOf:
            - type: string
            - type: 'null'
          title: Delimiter
        from_end:
          default: false
          title: From End
          type: boolean
        no_end_sentinel:
          default: Until Notified
          title: No End Sentinel
          type: string
        operator:
          anyOf:
            - type: string
            - type: 'null'
          title: Operator
        paired_field:
          anyOf:
            - type: string
            - type: 'null'
          title: Paired Field
        range_delimiter:
          default: through
          title: Range Delimiter
          type: string
        rule_type:
          title: Rule Type
          type: string
        separator:
          anyOf:
            - type: string
            - type: 'null'
          title: Separator
        take:
          anyOf:
            - type: string
            - type: 'null'
          title: Take
        trim_whitespace:
          default: true
          title: Trim Whitespace
          type: boolean
      required:
        - rule_type
      title: FieldRule
      type: object
    GroupMappingConfirm:
      properties:
        column_mapping:
          additionalProperties:
            anyOf:
              - type: string
              - items:
                  type: string
                type: array
              - additionalProperties:
                  anyOf:
                    - type: string
                    - items:
                        type: string
                      type: array
                type: object
              - type: 'null'
          default: {}
          title: Column Mapping
          type: object
        composite_keys:
          default: []
          items:
            $ref: '#/components/schemas/CompositeKeyConfirm'
          title: Composite Keys
          type: array
        group_id:
          title: Group Id
          type: string
        sheet_configs:
          default: []
          items:
            $ref: '#/components/schemas/SheetConfigRequest'
          title: Sheet Configs
          type: array
      required:
        - group_id
      title: GroupMappingConfirm
      type: object
    PolicyMetadataConfig:
      description: Policy-level metadata not present in columns.
      properties:
        date_format:
          default: MM/DD/YYYY
          title: Date Format
          type: string
        effective_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Effective Date
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
      title: PolicyMetadataConfig
      type: object
    SheetConfigRequest:
      description: Per-sheet configuration from user confirmation.
      properties:
        header_row:
          default: 1
          title: Header Row
          type: integer
        name:
          title: Name
          type: string
        skip:
          default: false
          title: Skip
          type: boolean
      required:
        - name
      title: SheetConfigRequest
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    CompositeKeyConfirm:
      properties:
        accepted:
          title: Accepted
          type: boolean
        source_column:
          title: Source Column
          type: string
        splits:
          items:
            $ref: '#/components/schemas/FieldSplit'
          title: Splits
          type: array
      required:
        - source_column
        - splits
        - accepted
      title: CompositeKeyConfirm
      type: object
    FieldSplit:
      properties:
        extract_rule:
          title: Extract Rule
          type: string
        sample_values:
          default: []
          items:
            type: string
          title: Sample Values
          type: array
        target_field:
          title: Target Field
          type: string
      required:
        - target_field
        - extract_rule
      title: FieldSplit
      type: object

````