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

# Preview Transform

> Preview the result of applying field rules to sample data.

Pure dry-run — does not persist anything. Returns transformed rows
so the user can see what the extraction will produce.

Requires: document:read permission



## OpenAPI

````yaml /openapi/merchantops-public.json post /api/lakehouse/documents/{document_id}/mapping/preview-transform
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/preview-transform:
    post:
      tags:
        - Product Lakehouse
      summary: Preview Transform
      description: |-
        Preview the result of applying field rules to sample data.

        Pure dry-run — does not persist anything. Returns transformed rows
        so the user can see what the extraction will produce.

        Requires: document:read permission
      operationId: preview_transform
      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/TransformPreviewRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransformPreviewResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    TransformPreviewRequest:
      description: Request body for transform preview.
      properties:
        column_mapping:
          additionalProperties:
            anyOf:
              - type: string
              - type: 'null'
          title: Column Mapping
          type: object
        field_rules:
          additionalProperties:
            items:
              $ref: '#/components/schemas/FieldRule'
            type: array
          default: {}
          title: Field Rules
          type: object
        group_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Group Id
        policy_metadata:
          anyOf:
            - $ref: '#/components/schemas/PolicyMetadataConfig'
            - type: 'null'
      required:
        - column_mapping
      title: TransformPreviewRequest
      type: object
    TransformPreviewResponse:
      description: Response with transformed preview data.
      properties:
        document_id:
          title: Document Id
          type: string
        expansion_note:
          anyOf:
            - type: string
            - type: 'null'
          title: Expansion Note
        source_row_count:
          title: Source Row Count
          type: integer
        transformed_rows:
          items:
            additionalProperties: true
            type: object
          title: Transformed Rows
          type: array
      required:
        - document_id
        - source_row_count
        - transformed_rows
      title: TransformPreviewResponse
      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
    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
    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

````