{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ometria/json-schema/ometria-product-schema.json",
  "title": "Product",
  "description": "Describes a Product record.",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/ometria-swagger-openapi.json#/components/schemas/Product",
  "type": "object",
  "required": [
    "@type",
    "id",
    "title",
    "price"
  ],
  "properties": {
    "@type": {
      "type": "string",
      "description": "The value must be \"product\". This shows that this record represents a product object."
    },
    "id": {
      "type": "string",
      "description": "The ID of the product. Max length: 255."
    },
    "title": {
      "type": "string",
      "description": "The title of this product as displayed to customers, max length: 140.\nIf you exceed the character limit, this field will pass validation but appear truncated in the Ometria interface."
    },
    "is_variant": {
      "type": "boolean",
      "description": "Whether or not this product record represents a <a href=\"https://ometria-api-reference.readme.io/docs/products-product-listings-and-product-variants\" target=\"_blank\">variant product</a>."
    },
    "parent_id": {
      "type": "string",
      "description": "The ID of the parent product, if this product is a variant. Max length: 255."
    },
    "price": {
      "type": "number",
      "description": "The default display price (account default currency / store).",
      "format": "float"
    },
    "sku": {
      "type": "string",
      "description": "The SKU of the product, max length: 255.\nIf left empty this field is set to `null`."
    },
    "special_price_dt_from": {
      "type": "string",
      "description": "Optional. The datetime that the <a href=\"https://ometria-api-reference.readme.io/docs/product-endpoint#special-price\" target=\"_blank\">special price</a> begins. Format YYYY-MM-DD HH:II:SS.",
      "format": "date-time"
    },
    "special_price_dt_to": {
      "type": "string",
      "description": "Optional. The datetime that the <a href=\"https://ometria-api-reference.readme.io/docs/product-endpoint#special-price\" target=\"_blank\">special price</a> ends. Format YYYY-MM-DD HH:II:SS.",
      "format": "date-time"
    },
    "special_price": {
      "type": "number",
      "description": "Optional. A <a href=\"https://ometria-api-reference.readme.io/docs/product-endpoint#special-price\" target=\"_blank\">special</a> (discounted) price used in conjunction with special_price_dt_from and special_price_dt_to.",
      "format": "float"
    },
    "is_active": {
      "description": "Is this product considered active on the website?. E.g. is it visible and (in principle) buyable? Please use \"is_in_stock\" to indicate whether a product is in stock or not.",
      "type": "boolean"
    },
    "is_in_stock": {
      "type": "boolean",
      "description": "Is this product in stock?"
    },
    "url": {
      "type": "string",
      "description": "The URL to the product's page on your site, max length: 1024."
    },
    "image_url": {
      "type": "string",
      "description": "The URL to the product's image on your site, max length: 1024."
    },
    "attributes": {
      "description": "Array of ProductAttribute objects.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProductAttribute"
      }
    },
    "listings": {
      "description": "Array of ProductListing objects used to work out which stores this product is available in, and any store specific details.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProductListing"
      }
    },
    "properties": {
      "type": "object",
      "description": "Custom key / value pairs accessible in emails using this product object"
    }
  },
  "$defs": {
    "ProductAttribute": {
      "type": "object",
      "description": "Describes an attribute attached to a Product.",
      "required": [
        "type",
        "id",
        "label"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The type of the attribute, max length: 128.\nThis field is required if you are using the attributes array."
        },
        "id": {
          "type": "string",
          "description": "The ID of the attribute, max length: 128."
        },
        "label": {
          "type": "string",
          "description": "The label of the attribute, max length: 128"
        }
      }
    },
    "ProductListing": {
      "type": "object",
      "description": "Describes an individual store listing for a product.",
      "required": [
        "title",
        "price",
        "store",
        "currency"
      ],
      "properties": {
        "title": {
          "type": "string",
          "description": "The title of the product, max length: 140.\nIf you exceed the character limit the field will pass validation but appear truncated in Ometria."
        },
        "price": {
          "type": "number",
          "description": "The price of the product.",
          "format": "float"
        },
        "store": {
          "type": "string",
          "description": "Required. Identifier representing the store the product belongs to. This will match the code passed in an order.\nMax length: 32, must be lower case. Example: `_store_1234`."
        },
        "currency": {
          "type": "string",
          "description": "The currency for this product listing.\nMust follow ISO 4217 format, max length: 3, upper case.\nThis field is required if you are using the listings array.\nIf left empty this field is set to 'null'.",
          "minLength": 3,
          "maxLength": 3
        },
        "is_active": {
          "type": "boolean",
          "description": "Is this product listing considered active on the website? I.e. Is it visible and available to purchase?\nUse \"is_in_stock\" to indicate whether a product is in stock or not."
        },
        "special_price": {
          "type": "number",
          "description": "A <a href=\"https://ometria-api-reference.readme.io/docs/product-endpoint#special-price\" target=\"_blank\">special</a> (discounted) price used in connection with special_price_dt_from and special_price_dt_to on the parent product object.",
          "format": "float"
        },
        "url": {
          "type": "string",
          "description": "The URL to this product listing on your site, max length: 1024."
        },
        "image_url": {
          "type": "string",
          "description": "The URL to the product listing's image on your site, max length: 1024."
        }
      }
    }
  }
}