> ## 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 Product Types Csv

> Upload product types from CSV content.

Required columns: key, name
Optional columns: description_en, category_key

Performs upsert: creates new ProductTypes or updates existing ones by key.

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



## OpenAPI

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


        Required columns: key, name

        Optional columns: description_en, category_key


        Performs upsert: creates new ProductTypes or updates existing ones by
        key.


        **Authentication Required**: Requires `product_type:write` permission.
      operationId: upload_product_types_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__product_types__CsvUploadRequest
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/merchantops_server__api__routers__product_types__CsvBatchResponse
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    merchantops_server__api__routers__product_types__CsvUploadRequest:
      description: Request model for CSV upload.
      properties:
        csv_content:
          description: CSV content as string
          title: Csv Content
          type: string
      required:
        - csv_content
      title: ProductTypesCsvUploadRequest
      type: object
    merchantops_server__api__routers__product_types__CsvBatchResponse:
      description: Response model for batch CSV upload operations.
      properties:
        created:
          description: Number of new records created
          title: Created
          type: integer
        errors:
          description: List of errors
          items:
            $ref: '#/components/schemas/BatchError'
          title: Errors
          type: array
        failed:
          description: Number of rows that failed
          title: Failed
          type: integer
        skipped:
          default: 0
          description: Number of rows skipped
          title: Skipped
          type: integer
        total:
          description: Total rows processed
          title: Total
          type: integer
        updated:
          description: Number of existing records updated
          title: Updated
          type: integer
      required:
        - total
        - created
        - updated
        - failed
      title: ProductTypesCsvBatchResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    BatchError:
      description: Error details for a single row in batch processing.
      properties:
        error:
          description: Error message
          title: Error
          type: string
        key:
          anyOf:
            - type: string
            - type: 'null'
          description: Key of the item that failed
          title: Key
        row:
          description: Row number (1-indexed, excluding header)
          title: Row
          type: integer
      required:
        - row
        - error
      title: BatchError
      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

````