> ## 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 Property Overrides Csv

> Upload per-ProductType OR per-Category enrichment overrides from CSV.

Required columns: product_type_key, property_key.
Optional columns: prompt_name_override, ai_matching_guidance_override,
                  enrichment_config_override_json.

Target syntax in `product_type_key`:
- `<key>`              → per-ProductType override (writes onto the
                         ProductType's PropertyReference). Existing
                         behavior, unchanged.
- `category:<key>`     → per-Category override (writes to the
                         `category_enrichment_overrides` collection).
                         Resolves at enrichment time when the
                         ProductType has `category=<key>` set.

The category form lets a customer hold one prompt per category
(e.g. Footwear / Apparel / Accessories) instead of duplicating the
same override across every ProductType in that category.

Behavior:
- Idempotent upsert: each row replaces any existing override at the
  same target.
- Empty cells clear the corresponding field.
- Rows whose ProductType or Property don't exist are recorded as
  skipped, not failed.
- Requires `product_type:write` (covers both targets).



## OpenAPI

````yaml /openapi/merchantops-public.json post /api/property-definitions/overrides/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/property-definitions/overrides/upload-csv:
    post:
      tags:
        - Property Definitions
      summary: Upload Property Overrides Csv
      description: |-
        Upload per-ProductType OR per-Category enrichment overrides from CSV.

        Required columns: product_type_key, property_key.
        Optional columns: prompt_name_override, ai_matching_guidance_override,
                          enrichment_config_override_json.

        Target syntax in `product_type_key`:
        - `<key>`              → per-ProductType override (writes onto the
                                 ProductType's PropertyReference). Existing
                                 behavior, unchanged.
        - `category:<key>`     → per-Category override (writes to the
                                 `category_enrichment_overrides` collection).
                                 Resolves at enrichment time when the
                                 ProductType has `category=<key>` set.

        The category form lets a customer hold one prompt per category
        (e.g. Footwear / Apparel / Accessories) instead of duplicating the
        same override across every ProductType in that category.

        Behavior:
        - Idempotent upsert: each row replaces any existing override at the
          same target.
        - Empty cells clear the corresponding field.
        - Rows whose ProductType or Property don't exist are recorded as
          skipped, not failed.
        - Requires `product_type:write` (covers both targets).
      operationId: upload_property_overrides_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__property_definitions__CsvUploadRequest
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/merchantops_server__api__routers__property_definitions__CsvBatchResponse
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    merchantops_server__api__routers__property_definitions__CsvUploadRequest:
      description: Request model for CSV upload.
      properties:
        csv_content:
          description: CSV content as string
          title: Csv Content
          type: string
      required:
        - csv_content
      title: PropertyDefinitionsCsvUploadRequest
      type: object
    merchantops_server__api__routers__property_definitions__CsvBatchResponse:
      description: Response model for batch CSV upload operations.
      properties:
        cleaned:
          default: 0
          description: Number of existing null values cleaned up from the database
          title: Cleaned
          type: integer
        created:
          description: Number of new records created
          title: Created
          type: integer
        errors:
          description: List of errors
          items:
            $ref: '#/components/schemas/CsvBatchError'
          title: Errors
          type: array
        failed:
          description: Number of rows that failed
          title: Failed
          type: integer
        skipped:
          default: 0
          description: Number of rows skipped due to null/empty values
          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: PropertyDefinitionsCsvBatchResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    CsvBatchError:
      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: CsvBatchError
      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

````