{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ocapi-shop/json-schema/ocapi-shop-product-input-schema.json",
  "title": "ProductInput",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ocapi-shop-openapi.yml#/components/schemas/ProductInput",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Product name shown on the storefront"
    },
    "sku": {
      "type": [
        "string",
        "null"
      ],
      "description": "Unique code within the store; stored uppercase"
    },
    "description": {
      "type": "string",
      "description": "Plain text description"
    },
    "category": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 50,
      "description": "Category name; a new name creates the category"
    },
    "tax_rate": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "maximum": 100,
      "description": "The product's own tax rate in percent, over its category's and the store's; 0 makes it exempt, null uses theirs"
    },
    "weight": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "exclusiveMaximum": 100000,
      "description": "What one unit weighs in kilograms, used by the store's weight tiers (shipping.weight_tiers in the checkout settings); null removes it"
    },
    "look_product_ids": {
      "type": "array",
      "maxItems": 6,
      "items": {
        "type": "string"
      },
      "description": "Replaces the product's look: IDs of other products of the store worn or used with it, offered together in a sheet on the product page, each added on its own. Hidden products are left out of the sheet."
    },
    "story_page_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "The ID of one of the store's pages, shown full width under the buy panel (the product's story, a comparison of its lines); null or \"\" removes it"
    },
    "model_note": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 120,
      "description": "A line about the model in the photos, shown beside the sizes (\"Model is 1.78 m and wears an M\"); null or \"\" removes it"
    },
    "details": {
      "type": "array",
      "maxItems": 8,
      "description": "Replaces the product's titled sections, shown under the description on the product page and opened one at a time (\"Materials & care\", \"Designed for\"). Titles up to 40 characters, texts up to 2000 (bold, italics and links in Markdown).",
      "items": {
        "type": "object",
        "required": [
          "title",
          "text"
        ],
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 40
          },
          "text": {
            "type": "string",
            "maxLength": 2000
          }
        }
      }
    },
    "label": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 24,
      "description": "A tag shown on the product's storefront card, like Best seller or Great gift, beside the automatic ones (New, the discount); null or \"\" removes it"
    },
    "price": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "Regular price in the store currency"
    },
    "sale_price": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "Discounted price, below price; null or 0 removes the sale"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "What one unit costs the merchant, for the profit in Get sales; null removes it. Only the store's owners can set it (others get a 422)"
    },
    "hide_price": {
      "type": "boolean",
      "description": "true shows 'ask for price' instead of a price"
    },
    "hidden": {
      "type": "boolean",
      "description": "true hides the product from the storefront"
    },
    "inventory": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "description": "Units in stock; null is unlimited, 0 is sold out"
    },
    "image_urls": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 20,
      "description": "HTTPS image URLs in display order, replacing the current images. Host outside images with import_image first. The store's plan caps how many a product can have (5 on Starter, 8 on Pro); adding past it fails with plan_limit_reached."
    },
    "video_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "An HTTPS URL of an mp4, mov or webm video, shown on the product page after the first image; null or \"\" removes it"
    },
    "properties": {
      "type": "array",
      "maxItems": 30,
      "description": "Replaces the product's properties: what shoppers filter by in the store (\"Fit\": \"Slim\", \"Fabric\": \"Cotton\"). A name may repeat with other values (\"Activity\": \"Running\", \"Activity\": \"Yoga\"). Names over 30 characters, values over 40, names with \": \" and repeated pairs are refused; reuse the names the store's other products use.",
      "items": {
        "type": "object",
        "required": [
          "name",
          "value"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 30
          },
          "value": {
            "type": "string",
            "maxLength": 40
          }
        }
      }
    },
    "search_hints": {
      "type": "string",
      "description": "Extra words that help shoppers find the product"
    },
    "variant_type": {
      "type": "string",
      "enum": [
        "size1",
        "size2",
        "color",
        "material",
        "other",
        "none"
      ],
      "description": "What the variants differ by"
    },
    "colors": {
      "type": "array",
      "maxItems": 30,
      "description": "Replaces the product's colors, such as Black or Navy, each with its swatch and photos. With colors, every variant names one; [] removes them.",
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "description": "Unique within the product; no slashes"
          },
          "swatch": {
            "type": [
              "string",
              "null"
            ],
            "description": "Hex color such as #111111 for the swatch"
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Which of the product's image_urls show this color"
          }
        }
      }
    },
    "variants": {
      "type": "array",
      "description": "Replaces all variants. Each variant may have its own price and stock. With colors, each variant gives its color and option (such as the size) and is named \"<color> / <option>\"; a variant sent with only its name keeps its color.",
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Unique within the product"
          },
          "color": {
            "type": [
              "string",
              "null"
            ],
            "description": "One of the product's colors"
          },
          "option": {
            "type": [
              "string",
              "null"
            ],
            "description": "With a color: the size or other option, such as M"
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "sale_price": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "description": "Below the variant's price; null or 0 removes the sale"
          },
          "inventory": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "cost": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "description": "What one unit costs the merchant; null uses the product's cost. Owners only; left out, the variant keeps its cost"
          }
        }
      }
    },
    "combos": {
      "type": [
        "array",
        "null"
      ],
      "description": "Pack prices: buy quantity units for price in total. Replaces all combos; null or [] removes them.",
      "items": {
        "type": "object",
        "required": [
          "quantity",
          "price"
        ],
        "properties": {
          "quantity": {
            "type": "integer",
            "minimum": 2
          },
          "price": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "Total price of the pack"
          },
          "variantNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Names of the product's variants it applies to; empty means all"
          }
        }
      }
    },
    "bulk_discount": {
      "type": [
        "object",
        "null"
      ],
      "description": "A discount from minQuantity units on; null removes it",
      "required": [
        "minQuantity",
        "type",
        "value"
      ],
      "properties": {
        "minQuantity": {
          "type": "integer",
          "minimum": 2
        },
        "type": {
          "type": "string",
          "enum": [
            "percentage",
            "fixed"
          ],
          "description": "percentage off each unit, or a fixed price for each unit"
        },
        "value": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "A percentage below 100, or a fixed price below the lowest price of the units it applies to"
        },
        "variantNames": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Names of the product's variants it applies to; empty means all"
        }
      }
    },
    "bogo": {
      "type": [
        "object",
        "null"
      ],
      "description": "Buy buyQuantity, get getQuantity more at discountPercent off (100 is free); null removes it",
      "required": [
        "discountPercent"
      ],
      "properties": {
        "buyQuantity": {
          "type": "integer",
          "minimum": 1,
          "default": 1
        },
        "getQuantity": {
          "type": "integer",
          "minimum": 1,
          "default": 1
        },
        "discountPercent": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        },
        "variantNames": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Names of the product's variants it applies to; empty means all"
        }
      }
    },
    "addons": {
      "type": "array",
      "description": "Extra choices shoppers make when buying, such as gift wrap or an engraving text. Replaces all addons; send back the product's current addons with your change to keep the others. radio, checkbox and counter addons need options. Each max (maxCount, maxDate, maxValue) must be at least its min.",
      "items": {
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "radio",
              "checkbox",
              "counter",
              "text",
              "date",
              "number"
            ],
            "description": "radio picks one option, checkbox several, counter a quantity of each"
          },
          "required": {
            "type": "boolean"
          },
          "minCount": {
            "type": "integer",
            "minimum": 0,
            "description": "checkbox and counter only"
          },
          "maxCount": {
            "type": "integer",
            "minimum": 0,
            "description": "checkbox and counter only"
          },
          "minDate": {
            "type": "string",
            "format": "date",
            "description": "date only"
          },
          "maxDate": {
            "type": "string",
            "format": "date",
            "description": "date only"
          },
          "minValue": {
            "type": "number",
            "description": "number only"
          },
          "maxValue": {
            "type": "number",
            "description": "number only"
          },
          "placeholder": {
            "type": "string",
            "description": "text and number only"
          },
          "options": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "price": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Added to the product price"
                },
                "maxCount": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "counter only"
                },
                "unavailable": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      }
    },
    "booking": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "description": "Makes the product a bookable service: customers pick a time (appointment), a day (date) or a stay (nights)\non its page, or buy tickets to its one date and time (event), and nothing ships. Only the fields sent change; null makes it a regular product again.\n",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "appointment",
            "date",
            "nights",
            "event"
          ],
          "description": "appointment: a set length; date: a whole day; nights: check-in to check-out, priced per night; event: one date and time (event_date, event_start) with tickets up to capacity"
        },
        "duration_minutes": {
          "type": "integer",
          "minimum": 5,
          "maximum": 720,
          "description": "An appointment's length (60 by default)"
        },
        "buffer_minutes": {
          "type": "integer",
          "minimum": 0,
          "maximum": 240,
          "description": "Minutes kept free after each appointment"
        },
        "capacity": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "description": "Places per time, day or night (1 by default); an order item's quantity takes that many"
        },
        "lead_time": {
          "type": "integer",
          "minimum": 0,
          "maximum": 720,
          "description": "How long ahead it must be booked, in lead_unit"
        },
        "lead_unit": {
          "type": "string",
          "enum": [
            "hours",
            "days"
          ]
        },
        "days_ahead": {
          "type": "integer",
          "minimum": 1,
          "maximum": 365,
          "description": "How many days ahead it can be booked (60 by default)"
        },
        "max_nights": {
          "type": "integer",
          "minimum": 1,
          "maximum": 90,
          "description": "The longest stay (30 by default)"
        },
        "event_date": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "An event's date; tickets sell until it starts, whatever the hours or window"
        },
        "event_start": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$",
          "description": "When an event starts, like 19:00; duration_minutes is how long it runs"
        },
        "location": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 200,
          "description": "Where an event happens, shown on its page"
        },
        "meeting_url": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 500,
          "description": "An https link to join an online event, shown only to paid orders"
        },
        "max_per_order": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1,
          "maximum": 1000,
          "description": "For events: the most tickets one storefront order takes (orders you create aren't limited); null is no limit but the capacity"
        },
        "tiers": {
          "type": [
            "array",
            "null"
          ],
          "maxItems": 20,
          "description": "For events: each ticket type's own cap and sales window. Types are the product's variants (their name and price), so name one of them; this replaces every type's settings, and a type left out shares the event's capacity and sells until it starts",
          "items": {
            "type": "object",
            "required": [
              "name"
            ],
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string",
                "description": "The variant's name"
              },
              "capacity": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1,
                "maximum": 1000,
                "description": "The most tickets of this type, within the event's capacity"
              },
              "sales_start": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "When it goes on sale, like 2026-12-01T10:00 or 2026-12-01T10:00:00-05:00 (the store's time zone unless it names an offset)"
              },
              "sales_end": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "When its sales close, written like sales_start; after it"
              }
            }
          }
        },
        "hours": {
          "type": [
            "object",
            "null"
          ],
          "description": "Its own week, like the store's hours ({ monday: [{ opens: \"09:00\", closes: \"13:00\" }] }); a missing or empty day is closed, so {} is closed every day. null follows the store's opening hours, and without either appointments run 09:00 to 18:00",
          "additionalProperties": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "opens",
                "closes"
              ],
              "properties": {
                "opens": {
                  "type": "string"
                },
                "closes": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "available_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Makes the product a drop: until this time (ISO 8601, with its offset) the storefront shows a countdown and a\nNotify me button, and checkout refuses it; at launch the customers waiting are told by email. A product hidden\nuntil then is shown at launch. null or \"\" sells it now.\n"
    },
    "preorder": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "description": "Pre-orders: once its stock (or a variant's) runs out, customers can still order it, and the cart, checkout,\norder, emails and WhatsApp message label those lines as pre-orders with the ship date. null or enabled: false\nturns them off.\n",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "true takes pre-orders (the default when the object is sent)"
        },
        "ships_on": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "When pre-orders ship, like 2026-12-15; null when unknown"
        },
        "limit": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1,
          "maximum": 100000,
          "description": "The most units on pre-order and not shipped yet, across its variants; null is no limit"
        }
      }
    },
    "deposit": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "description": "The deposit checkout asks for on this product (catering, cakes, bookings, custom work), over the store's\ndeposit; null leaves it to the store's. A percentage is of the line (with its share of shipping, taxes and tip);\na fixed amount is per unit.\n",
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "optional",
            "required"
          ],
          "description": "optional (the default) lets the customer pay it all instead; required charges only the deposit online"
        },
        "type": {
          "type": "string",
          "enum": [
            "percentage",
            "fixed"
          ],
          "description": "percentage (the default) or fixed"
        },
        "amount": {
          "type": "number",
          "description": "Above 0: a percentage below 100, or an amount per unit"
        }
      },
      "required": [
        "amount"
      ]
    },
    "subscription": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "description": "\"Subscribe and save\": customers choose at checkout to have the product delivered on a schedule, at the subscriber\ndiscount, instead of buying it once. Only plain products that ship can offer it (not gift cards, digital products,\nbookings, courses, memberships or bundles), and all its variants share it. null turns it off for new customers;\ncurrent subscribers keep their terms.\n",
      "properties": {
        "frequencies": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "enum": [
              "week",
              "2weeks",
              "month"
            ]
          },
          "description": "The frequencies customers pick from"
        },
        "discount_percent": {
          "type": "number",
          "minimum": 0,
          "maximum": 90,
          "description": "Off each delivery's unit price; 0 (the default) for none"
        }
      },
      "required": [
        "frequencies"
      ]
    }
  }
}