> ## 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 Variants Csv

> Upload variants from CSV for a product.

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

CSV must have a ``key`` column. All other columns are mapped as variant
properties. ``product_key`` comes from the URL path. Maximum 250 rows.



## OpenAPI

````yaml /openapi/merchantops-public.json post /api/products/{product_key}/variants/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/{product_key}/variants/upload-csv:
    post:
      tags:
        - Variants
      summary: Upload Variants Csv
      description: |-
        Upload variants from CSV for a product.

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

        CSV must have a ``key`` column. All other columns are mapped as variant
        properties. ``product_key`` comes from the URL path. Maximum 250 rows.
      operationId: upload_variants_csv
      parameters:
        - in: path
          name: product_key
          required: true
          schema:
            title: Product Key
            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/VariantCsvUploadRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VariantBatchResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    VariantCsvUploadRequest:
      description: Request model for uploading variants from CSV.
      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
      required:
        - csv_content
      title: VariantCsvUploadRequest
      type: object
    VariantBatchResponse:
      description: Response model for batch variant operations.
      properties:
        created:
          description: Number of variants successfully created
          title: Created
          type: integer
        errors:
          description: List of errors for failed variants
          items:
            additionalProperties: true
            type: object
          title: Errors
          type: array
      required:
        - created
      title: VariantBatchResponse
      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

````