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

# Upload Csv

> Create products from CSV content.

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

CSV must have headers with columns: key, name, brand (optional),
vendorId (optional), productType (required if no default provided).

Maximum 250 rows allowed.
Creates a Job to track the batch operation.



## OpenAPI

````yaml /openapi/merchantops-public.json post /api/products/upload-csv
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/upload-csv:
    post:
      tags:
        - Products
      summary: Upload Csv
      description: |-
        Create products from CSV content.

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

        CSV must have headers with columns: key, name, brand (optional),
        vendorId (optional), productType (required if no default provided).

        Maximum 250 rows allowed.
        Creates a Job to track the batch operation.
      operationId: upload_csv
      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/merchantops_server__api__routers__products__models__CsvUploadRequest
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductBatchResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    merchantops_server__api__routers__products__models__CsvUploadRequest:
      description: Request model for CSV upload.
      properties:
        batch_size:
          default: 25
          description: Batch size for processing (1-50)
          maximum: 50
          minimum: 1
          title: Batch Size
          type: integer
        csv_content:
          description: CSV content as string
          title: Csv Content
          type: string
        default_product_type:
          anyOf:
            - type: string
            - type: 'null'
          description: Default ProductType key
          title: Default Product Type
        enrich_product:
          default: true
          description: Run AI enrichment (description, features, attributes)
          title: Enrich Product
          type: boolean
        scrape_brand_site:
          default: true
          description: Scrape brand website during enrichment
          title: Scrape Brand Site
          type: boolean
        search_lakehouse:
          default: true
          description: Search product lakehouse for existing data
          title: Search Lakehouse
          type: boolean
        validate:
          default: false
          description: Validate against ProductType
          title: Validate
          type: boolean
      required:
        - csv_content
      title: ProductsCsvUploadRequest
      type: object
    ProductBatchResponse:
      description: Response model for batch product creation.
      properties:
        created:
          description: Number successfully created
          title: Created
          type: integer
        errors:
          description: List of errors
          items:
            additionalProperties:
              type: string
            type: object
          title: Errors
          type: array
        failed:
          description: Number that failed
          title: Failed
          type: integer
        job_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Job ID for tracking batch progress
          title: Job Id
        skipped:
          default: 0
          description: Number unchanged (no new version created)
          title: Skipped
          type: integer
        total:
          description: Total products submitted
          title: Total
          type: integer
      required:
        - total
        - created
        - failed
      title: ProductBatchResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      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

````