> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fanfare.io/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /products

> Create or update a product (upsert when sync source provided)



## OpenAPI

````yaml /api/openapi/admin-api.json post /products
openapi: 3.1.0
info:
  description: Admin API for Fanfare
  title: Fanfare Admin API
  version: 1.0.0
servers:
  - description: Production
    url: https://admin.fanfare.io/api
  - description: Local development
    url: http://localhost:4800
security:
  - SecretKeyAuth: []
paths:
  /products:
    post:
      tags:
        - Products
      description: Create or update a product (upsert when sync source provided)
      operationId: postProducts
      requestBody:
        content:
          application/json:
            schema:
              properties:
                defaultVariantId:
                  format: uuid
                  nullable: true
                  type: string
                description:
                  nullable: true
                  type: string
                handle:
                  nullable: true
                  type: string
                metadata:
                  additionalProperties: {}
                  nullable: true
                  type: object
                name:
                  type: string
                primarySyncSource:
                  nullable: true
                  properties:
                    lastSyncedAt:
                      nullable: true
                      type: string
                    sourceData:
                      additionalProperties: {}
                      nullable: true
                      type: object
                    syncSource:
                      type: string
                    syncSourceId:
                      type: string
                    syncStatus:
                      enum:
                        - PENDING
                        - SUCCESS
                        - FAILED
                      nullable: true
                      type: string
                  required:
                    - syncSource
                    - syncSourceId
                  type: object
                productMediaAssets:
                  items:
                    properties:
                      mediaAsset:
                        properties:
                          altText:
                            nullable: true
                            type: string
                          description:
                            nullable: true
                            type: string
                          mimeType:
                            enum:
                              - image/jpeg
                              - image/jpg
                              - image/png
                              - image/gif
                              - image/webp
                              - video/mp4
                              - video/webm
                              - video/quicktime
                            type: string
                          name:
                            type: string
                          sourceUrl:
                            nullable: true
                            type: string
                          thumbnailUrl:
                            nullable: true
                            type: string
                        required:
                          - name
                          - mimeType
                        type: object
                      position:
                        type: number
                      purpose:
                        type: string
                    required:
                      - position
                      - purpose
                      - mediaAsset
                    type: object
                  nullable: true
                  type: array
                url:
                  type: string
                variantOptionIds:
                  items:
                    format: uuid
                    type: string
                  nullable: true
                  type: array
                variants:
                  items:
                    properties:
                      inventoryPolicy:
                        enum:
                          - untracked
                          - deny
                          - continue
                        type: string
                      inventoryQuantity:
                        type: number
                      metadata:
                        additionalProperties: {}
                        nullable: true
                        type: object
                      optionAssignments:
                        items:
                          properties:
                            optionId:
                              format: uuid
                              type: string
                            valueId:
                              format: uuid
                              type: string
                          required:
                            - optionId
                            - valueId
                          type: object
                        type: array
                      optionValues:
                        items:
                          properties:
                            optionName:
                              type: string
                            value:
                              type: string
                          required:
                            - optionName
                            - value
                          type: object
                        type: array
                      price:
                        type: string
                      sku:
                        type: string
                    required:
                      - sku
                      - price
                      - inventoryQuantity
                      - inventoryPolicy
                    type: object
                  nullable: true
                  type: array
              required:
                - name
                - url
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  archived:
                    type: boolean
                  createdAt:
                    format: date-time
                    type: string
                  createdBy:
                    type: string
                  defaultVariantId:
                    anyOf:
                      - format: uuid
                        type: string
                      - type: 'null'
                  description:
                    anyOf:
                      - type: string
                      - type: 'null'
                  handle:
                    anyOf:
                      - type: string
                      - type: 'null'
                  id:
                    format: uuid
                    type: string
                  metadata:
                    anyOf:
                      - additionalProperties: {}
                        propertyNames:
                          type: string
                        type: object
                      - type: 'null'
                  name:
                    minLength: 1
                    type: string
                  organizationId:
                    format: uuid
                    type: string
                  primaryExternalId:
                    anyOf:
                      - type: string
                      - type: 'null'
                  primaryLastSyncedAt:
                    anyOf:
                      - format: date-time
                        type: string
                      - type: 'null'
                  primarySourceVendor:
                    anyOf:
                      - type: string
                      - type: 'null'
                  primarySyncSource:
                    anyOf:
                      - properties:
                          archived:
                            type: boolean
                          createdAt:
                            format: date-time
                            type: string
                          createdBy:
                            type: string
                          id:
                            format: uuid
                            type: string
                          lastSyncedAt:
                            anyOf:
                              - format: date-time
                                type: string
                              - type: 'null'
                          organizationId:
                            format: uuid
                            type: string
                          sourceData:
                            anyOf:
                              - additionalProperties: {}
                                propertyNames:
                                  type: string
                                type: object
                              - type: 'null'
                          syncSource:
                            type: string
                          syncSourceId:
                            type: string
                          syncStatus:
                            anyOf:
                              - enum:
                                  - PENDING
                                  - SUCCESS
                                  - FAILED
                              - type: 'null'
                            default: PENDING
                          updatedAt:
                            anyOf:
                              - format: date-time
                                type: string
                              - type: 'null'
                          updatedBy:
                            anyOf:
                              - type: string
                              - type: 'null'
                        required:
                          - id
                          - organizationId
                          - createdAt
                          - createdBy
                          - archived
                          - syncSource
                          - syncSourceId
                        type: object
                      - type: 'null'
                  primarySyncSourceId:
                    anyOf:
                      - type: string
                      - type: 'null'
                  productMediaAssets:
                    anyOf:
                      - items:
                          properties:
                            id:
                              format: uuid
                              type: string
                            mediaAsset:
                              properties:
                                altText:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                archived:
                                  type: boolean
                                createdAt:
                                  format: date-time
                                  type: string
                                createdBy:
                                  type: string
                                description:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                id:
                                  format: uuid
                                  type: string
                                mimeType:
                                  enum:
                                    - image/jpeg
                                    - image/jpg
                                    - image/png
                                    - image/gif
                                    - image/webp
                                    - video/mp4
                                    - video/webm
                                    - video/quicktime
                                name:
                                  minLength: 1
                                  type: string
                                organizationId:
                                  format: uuid
                                  type: string
                                publicUrl:
                                  anyOf:
                                    - format: uri
                                      type: string
                                    - type: 'null'
                                sourceUrl:
                                  anyOf:
                                    - format: uri
                                      type: string
                                    - type: 'null'
                                thumbnailUrl:
                                  anyOf:
                                    - format: uri
                                      type: string
                                    - type: 'null'
                                updatedAt:
                                  anyOf:
                                    - format: date-time
                                      type: string
                                    - type: 'null'
                                updatedBy:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                uploadUrl:
                                  anyOf:
                                    - format: uri
                                      type: string
                                    - type: 'null'
                              required:
                                - id
                                - organizationId
                                - createdAt
                                - createdBy
                                - archived
                                - name
                                - mimeType
                              type: object
                            mediaAssetId:
                              format: uuid
                              type: string
                            organizationId:
                              format: uuid
                              type: string
                            position:
                              minimum: 0
                              type: integer
                            productId:
                              format: uuid
                              type: string
                            purpose:
                              type: string
                          required:
                            - id
                            - organizationId
                            - position
                            - purpose
                            - productId
                            - mediaAssetId
                            - mediaAsset
                          type: object
                        type: array
                      - type: 'null'
                  updatedAt:
                    anyOf:
                      - format: date-time
                        type: string
                      - type: 'null'
                  updatedBy:
                    anyOf:
                      - type: string
                      - type: 'null'
                  url:
                    format: uri
                    type: string
                  variants:
                    anyOf:
                      - items:
                          properties:
                            options:
                              items:
                                properties:
                                  optionId:
                                    format: uuid
                                    type: string
                                  optionName:
                                    type: string
                                  value:
                                    type: string
                                  valueId:
                                    format: uuid
                                    type: string
                                required:
                                  - optionId
                                  - optionName
                                  - valueId
                                  - value
                                type: object
                              type: array
                            archived:
                              type: boolean
                            createdAt:
                              format: date-time
                              type: string
                            createdBy:
                              type: string
                            id:
                              format: uuid
                              type: string
                            inventoryPolicy:
                              enum:
                                - untracked
                                - deny
                                - continue
                            inventoryQuantity:
                              type: integer
                            metadata:
                              anyOf:
                                - additionalProperties: {}
                                  propertyNames:
                                    type: string
                                  type: object
                                - type: 'null'
                            organizationId:
                              format: uuid
                              type: string
                            price:
                              pattern: ^\d{1,12}(\.\d{1,8})?$
                              type: string
                            primaryExternalId:
                              anyOf:
                                - type: string
                                - type: 'null'
                            primaryLastSyncedAt:
                              anyOf:
                                - format: date-time
                                  type: string
                                - type: 'null'
                            primarySourceVendor:
                              anyOf:
                                - type: string
                                - type: 'null'
                            primarySyncSourceId:
                              anyOf:
                                - type: string
                                - type: 'null'
                            productId:
                              format: uuid
                              type: string
                            sku:
                              minLength: 1
                              type: string
                            updatedAt:
                              anyOf:
                                - format: date-time
                                  type: string
                                - type: 'null'
                            updatedBy:
                              anyOf:
                                - type: string
                                - type: 'null'
                          required:
                            - id
                            - organizationId
                            - createdAt
                            - createdBy
                            - archived
                            - productId
                            - sku
                            - price
                            - inventoryQuantity
                            - inventoryPolicy
                            - options
                          type: object
                        type: array
                      - type: 'null'
                required:
                  - id
                  - organizationId
                  - createdAt
                  - createdBy
                  - archived
                  - name
                  - url
                type: object
          description: Product created or updated successfully
        '400':
          content:
            application/json:
              schema:
                properties:
                  error:
                    const: validation_error
                  issues:
                    items:
                      properties:
                        expected:
                          type: string
                        kind:
                          type: string
                        message:
                          type: string
                        path:
                          items:
                            properties:
                              input: {}
                              key:
                                type: string
                              origin:
                                type: string
                              type:
                                type: string
                            required:
                              - type
                              - origin
                              - input
                              - key
                            type: object
                          type: array
                        received:
                          type: string
                        type:
                          type: string
                      required:
                        - kind
                        - type
                        - expected
                        - received
                        - message
                        - path
                      type: object
                    type: array
                required:
                  - error
                  - issues
                type: object
          description: Bad Request - Invalid input schema
        '401':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                required:
                  - error
                type: object
          description: Unauthorized - Authentication required
        '403':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                required:
                  - error
                type: object
          description: Forbidden - User must be authenticated
        '500':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                required:
                  - error
                type: object
          description: Internal server error
components:
  securitySchemes:
    SecretKeyAuth:
      description: Fanfare secret key. Keep secret credentials on your server.
      scheme: bearer
      type: http

````