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

# Export Products

> Export products to Excel/CSV with custom column mapping (synchronous).

Use the async variant (``/export-async``) for large selections; this
endpoint streams the file inline and is intended for small selections.

**Authentication Required**: Requires `product:read` permission.



## OpenAPI

````yaml /openapi/merchantops-public.json post /api/products/export
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/products/export:
    post:
      tags:
        - Products
      summary: Export Products
      description: |-
        Export products to Excel/CSV with custom column mapping (synchronous).

        Use the async variant (``/export-async``) for large selections; this
        endpoint streams the file inline and is intended for small selections.

        **Authentication Required**: Requires `product:read` permission.
      operationId: export_products
      parameters:
        - 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/ProductExportRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema: {}
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    ProductExportRequest:
      description: Request model for exporting products to Excel.
      properties:
        column_mappings:
          anyOf:
            - items:
                $ref: '#/components/schemas/ColumnMappingConfig'
              type: array
            - type: 'null'
          description: Column mapping configuration (required for column_based mode)
          title: Column Mappings
        export_format:
          default: xlsx
          description: 'File format: ''xlsx'' for Excel, ''csv'' for CSV'
          enum:
            - xlsx
            - csv
          title: Export Format
          type: string
        export_mode:
          default: attribute_rows
          description: >-
            Export format: 'column_based' uses custom column mappings,
            'attribute_rows' creates one row per property
          enum:
            - column_based
            - attribute_rows
          title: Export Mode
          type: string
        filter_by_label:
          default: false
          description: If true, filter products by specific labels
          title: Filter By Label
          type: boolean
        filter_latest_version:
          default: false
          description: If true, only export the latest version of each product
          title: Filter Latest Version
          type: boolean
        label_keys:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Label keys to filter by (used when filter_by_label=true)
          title: Label Keys
        product_keys:
          description: List of product keys to export
          items:
            type: string
          title: Product Keys
          type: array
        source_filter:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Filter products by source (e.g., ['merchant_input', 'scraper'])
          title: Source Filter
      required:
        - product_keys
      title: ProductExportRequest
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ColumnMappingConfig:
      description: Configuration for a single export column.
      properties:
        array_handling:
          anyOf:
            - enum:
                - repeat_columns
                - repeat_rows
              type: string
            - type: 'null'
          description: >-
            How to handle array fields: repeat_columns creates multiple columns,
            repeat_rows creates multiple rows
          title: Array Handling
        column_name:
          description: Name of the column in Excel
          title: Column Name
          type: string
        source_field:
          description: Product field key (e.g., 'name', 'brand', 'features')
          title: Source Field
          type: string
        sub_field:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            For object arrays (e.g., image_array): extract this sub-field from
            each object
          title: Sub Field
        use_label:
          anyOf:
            - type: boolean
            - type: 'null'
          default: false
          description: >-
            For enum fields: export the display label instead of the raw
            key/value
          title: Use Label
      required:
        - column_name
        - source_field
      title: ColumnMappingConfig
      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

````