{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/salesforce-commerce-cloud/json-schema/salesforce-commerce-cloud-variant-schema.json",
  "title": "Variant",
  "description": "A product which is a variation within a master product that describes different colors, sizes, or other variation attributes. *Has a SKU*",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/salesforce-commerce-cloud-products-api-openapi.yml#/components/schemas/Variant",
  "required": [
    "productId"
  ],
  "type": "object",
  "properties": {
    "ats": {
      "type": "number",
      "description": "The Available To Sell (ATS) inventory value of the product. This is a calculated value.",
      "format": "double"
    },
    "defaultProductVariation": {
      "type": "boolean",
      "description": "A flag indicating whether the variant is a default variant."
    },
    "image": {
      "$ref": "#/$defs/MediaFile"
    },
    "inStock": {
      "type": "boolean",
      "description": "True if the product is in stock, false if not."
    },
    "online": {
      "type": "boolean",
      "description": "If the product is currently online.\n True if online, false if not."
    },
    "orderable": {
      "type": "boolean",
      "description": "A flag indicating whether the variant is orderable."
    },
    "price": {
      "type": "number",
      "description": "The sales price of the variant.",
      "format": "double"
    },
    "priceCurrency": {
      "type": "string",
      "description": "Currency code for the price of the product."
    },
    "productId": {
      "$ref": "#/$defs/ProductId"
    },
    "searchable": {
      "type": "object",
      "additionalProperties": {
        "type": "boolean"
      },
      "description": "A flag indicating whether the variant is searchable."
    },
    "variationAttributes": {
      "items": {
        "$ref": "#/$defs/VariationAttribute"
      },
      "type": "array",
      "description": "Variation attributes."
    },
    "variationValues": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "The actual variation attribute ID - value pairs."
    }
  },
  "$defs": {
    "MediaFile": {
      "required": [
        "path"
      ],
      "type": "object",
      "properties": {
        "absUrl": {
          "type": "string",
          "description": "The absolute URL with request protocol."
        },
        "alt": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The alternative image text."
        },
        "disBaseUrl": {
          "type": "string",
          "description": "The Dynamic Image Service (DIS) base URL for product images only."
        },
        "path": {
          "type": "string",
          "description": "The raw media file path."
        },
        "title": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The image title."
        }
      },
      "description": "Document representing media file."
    },
    "ProductId": {
      "minLength": 1,
      "maxLength": 100,
      "type": "string",
      "description": "The id (SKU) of the product."
    },
    "VariationAttribute": {
      "required": [
        "attributeDefinitionId"
      ],
      "type": "object",
      "properties": {
        "attributeDefinitionId": {
          "type": "string",
          "description": "The id of the requested attribute definition."
        },
        "attributeDefinitionName": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The localized display name of the variation attribute definition."
        },
        "defaultValue": {
          "type": "string",
          "description": "Default variation attribute value."
        },
        "id": {
          "minLength": 1,
          "type": "string",
          "description": "The ID of the variation attribute."
        },
        "name": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The localized display name of the variation attribute."
        },
        "shared": {
          "type": "boolean",
          "description": "Returns the value of attribute 'shared' if attribute is local or shared."
        },
        "slicing": {
          "type": "boolean",
          "description": "Returns the value of attribute 'slicing'."
        },
        "values": {
          "items": {
            "$ref": "#/$defs/VariationAttributeValue"
          },
          "type": "array",
          "description": "The sorted array of variation values. This array can be empty."
        },
        "variationAttributeType": {
          "type": "string",
          "description": "Variation attribute type.",
          "enum": [
            "string",
            "int",
            "unknown"
          ]
        }
      },
      "description": "Document representing a variation attribute."
    },
    "VariationAttributeValue": {
      "required": [
        "value"
      ],
      "type": "object",
      "properties": {
        "description": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The localized description of the variation value."
        },
        "image": {
          "$ref": "#/$defs/MediaFile"
        },
        "imageSwatch": {
          "$ref": "#/$defs/MediaFile"
        },
        "name": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The localized display name of the variation value."
        },
        "orderable": {
          "type": "boolean",
          "description": "A flag indicating whether at least one variant with this variation attribute value is available to sell."
        },
        "position": {
          "type": "number",
          "description": "The position of the value among all values of a variation attribute.",
          "format": "double"
        },
        "value": {
          "minLength": 1,
          "type": "string",
          "description": "The actual variation value."
        }
      },
      "description": "Document representing a variation attribute value."
    }
  }
}