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

# Get Column Mapping

> Get the column mapping for a document (Phase 7 HITL).

Returns the LLM-generated and validated column mapping along with
all available columns from the spreadsheet for editing.

Requires: document:read permission



## OpenAPI

````yaml /openapi/merchantops-public.json get /api/lakehouse/documents/{document_id}/mapping
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:
    get:
      tags:
        - Product Lakehouse
      summary: Get Column Mapping
      description: |-
        Get the column mapping for a document (Phase 7 HITL).

        Returns the LLM-generated and validated column mapping along with
        all available columns from the spreadsheet for editing.

        Requires: document:read permission
      operationId: get_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
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ColumnMappingResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    ColumnMappingResponse:
      description: Response model for column mapping review (Phase 7 HITL).
      properties:
        ambiguous_mappings:
          items:
            type: string
          title: Ambiguous Mappings
          type: array
        available_columns:
          items:
            type: string
          title: Available Columns
          type: array
        column_mapping:
          additionalProperties:
            anyOf:
              - type: string
              - items:
                  type: string
                type: array
              - additionalProperties:
                  anyOf:
                    - type: string
                    - items:
                        type: string
                      type: array
                type: object
              - type: 'null'
          title: Column Mapping
          type: object
        confidence:
          title: Confidence
          type: number
        document_id:
          title: Document Id
          type: string
        file_analysis:
          anyOf:
            - $ref: '#/components/schemas/FileAnalysis'
            - type: 'null'
        filename:
          title: Filename
          type: string
        is_valid:
          title: Is Valid
          type: boolean
        missing_required_fields:
          items:
            type: string
          title: Missing Required Fields
          type: array
        recalled_field_rules:
          anyOf:
            - additionalProperties:
                items:
                  additionalProperties: true
                  type: object
                type: array
              type: object
            - type: 'null'
          title: Recalled Field Rules
        validated_at:
          title: Validated At
          type: string
        warnings:
          items:
            type: string
          title: Warnings
          type: array
      required:
        - document_id
        - filename
        - column_mapping
        - confidence
        - is_valid
        - missing_required_fields
        - ambiguous_mappings
        - warnings
        - validated_at
        - available_columns
      title: ColumnMappingResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    FileAnalysis:
      description: Analysis of workbook file structure (sheets, headers).
      properties:
        policy_notes:
          default: []
          items:
            $ref: '#/components/schemas/PolicyNote'
          title: Policy Notes
          type: array
        recommended_sheets:
          default: []
          items:
            type: string
          title: Recommended Sheets
          type: array
        sheet_groups:
          default: []
          items:
            $ref: '#/components/schemas/SheetGroup'
          title: Sheet Groups
          type: array
        sheets:
          default: []
          items:
            $ref: '#/components/schemas/SheetAnalysis'
          title: Sheets
          type: array
        skip_sheets:
          default: []
          items:
            type: string
          title: Skip Sheets
          type: array
        template_brand_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Template Brand Key
        template_found:
          default: false
          title: Template Found
          type: boolean
      title: FileAnalysis
      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
    PolicyNote:
      properties:
        source_sheet:
          title: Source Sheet
          type: string
        text:
          title: Text
          type: string
      required:
        - source_sheet
        - text
      title: PolicyNote
      type: object
    SheetGroup:
      properties:
        columns:
          default: []
          items:
            type: string
          title: Columns
          type: array
        composite_keys:
          default: []
          items:
            $ref: '#/components/schemas/CompositeKeySplit'
          title: Composite Keys
          type: array
        confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence
        group_id:
          title: Group Id
          type: string
        is_valid:
          default: false
          title: Is Valid
          type: boolean
        mapping:
          anyOf:
            - additionalProperties:
                anyOf:
                  - type: string
                  - type: 'null'
              type: object
            - type: 'null'
          title: Mapping
        missing_required_fields:
          default: []
          items:
            type: string
          title: Missing Required Fields
          type: array
        sample_rows:
          default: []
          items:
            additionalProperties: true
            type: object
          title: Sample Rows
          type: array
        sheet_names:
          items:
            type: string
          title: Sheet Names
          type: array
      required:
        - group_id
        - sheet_names
      title: SheetGroup
      type: object
    SheetAnalysis:
      description: Analysis of a single sheet in a workbook.
      properties:
        classification:
          anyOf:
            - type: string
            - type: 'null'
          title: Classification
        classification_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Classification Reason
        columns:
          default: []
          items:
            type: string
          title: Columns
          type: array
        data_rows:
          anyOf:
            - type: integer
            - type: 'null'
          title: Data Rows
        header_row:
          anyOf:
            - type: integer
            - type: 'null'
          title: Header Row
        name:
          title: Name
          type: string
        recommended_header_row:
          anyOf:
            - type: integer
            - type: 'null'
          title: Recommended Header Row
        skip:
          default: false
          title: Skip
          type: boolean
        visibility:
          default: visible
          title: Visibility
          type: string
      required:
        - name
      title: SheetAnalysis
      type: object
    CompositeKeySplit:
      properties:
        confidence:
          default: 0
          title: Confidence
          type: number
        pattern_description:
          title: Pattern Description
          type: string
        source_column:
          title: Source Column
          type: string
        splits:
          items:
            $ref: '#/components/schemas/FieldSplit'
          title: Splits
          type: array
      required:
        - source_column
        - pattern_description
        - splits
      title: CompositeKeySplit
      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

````