{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/catalogapi-com/json-schema/catalogapi-com-cart-view-response-schema.json",
  "title": "CartViewResponse",
  "description": "Response containing the current state of a user's cart",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/catalogapi-com-openapi.yml#/components/schemas/CartViewResponse",
  "properties": {
    "cart": {
      "$ref": "#/$defs/Cart"
    },
    "errors": {
      "description": "Any errors encountered during cart operations",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "matched_entities": {
      "description": "Details for categories, tags, and brands referenced by items in the cart. Only included when matched_entities=true query parameter is passed.",
      "items": {
        "properties": {
          "discount_percent": {
            "description": "Discount percentage if this is a tag",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "description": "The ID of the entity",
            "type": "integer"
          },
          "name": {
            "description": "Name of the entity",
            "type": "string"
          },
          "type": {
            "description": "The entity type",
            "enum": [
              "tag",
              "brand",
              "category"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "success": {
      "description": "Indicates successful operation",
      "type": "boolean"
    },
    "timestamp": {
      "description": "When this response was generated",
      "format": "datetime",
      "type": "string"
    }
  },
  "required": [
    "success",
    "timestamp",
    "cart"
  ],
  "type": "object",
  "$defs": {
    "Cart": {
      "description": "Shopping cart with line items and metadata",
      "properties": {
        "address_1": {
          "description": "Primary address line",
          "type": [
            "string",
            "null"
          ]
        },
        "address_2": {
          "description": "Secondary address line (apartment, suite, etc.)",
          "type": [
            "string",
            "null"
          ]
        },
        "address_3": {
          "description": "Third address line",
          "type": [
            "string",
            "null"
          ]
        },
        "address_4": {
          "description": "Fourth address line",
          "type": [
            "string",
            "null"
          ]
        },
        "cart_version": {
          "description": "Version identifier for the cart",
          "format": "uuid",
          "type": "string"
        },
        "city": {
          "description": "City",
          "type": [
            "string",
            "null"
          ]
        },
        "country": {
          "description": "Country code",
          "type": [
            "string",
            "null"
          ]
        },
        "currency": {
          "description": "ISO currency code",
          "type": "string"
        },
        "email": {
          "description": "Email address",
          "format": "email",
          "type": [
            "string",
            "null"
          ]
        },
        "given_name": {
          "description": "First/given name",
          "type": [
            "string",
            "null"
          ]
        },
        "is_locked": {
          "description": "Whether the cart is locked",
          "type": "boolean"
        },
        "line_items": {
          "description": "Array of all line items in the cart",
          "items": {
            "$ref": "#/$defs/CartLineItem"
          },
          "type": "array"
        },
        "metadata": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Metadata for the line item (flat map with string values only)",
          "type": "object"
        },
        "phone_number": {
          "description": "Phone number",
          "type": [
            "string",
            "null"
          ]
        },
        "postal_code": {
          "description": "Postal code",
          "type": [
            "string",
            "null"
          ]
        },
        "state_or_region": {
          "description": "State or region",
          "type": [
            "string",
            "null"
          ]
        },
        "surname": {
          "description": "Last/family name",
          "type": [
            "string",
            "null"
          ]
        },
        "total": {
          "description": "Total amount including tax/shipping",
          "type": "string"
        },
        "total_line_items": {
          "description": "Total number of line items in cart",
          "type": "integer"
        },
        "total_points": {
          "description": "Total points",
          "type": "integer"
        },
        "unique_item_count": {
          "description": "Number of unique catalog items",
          "type": "integer"
        }
      },
      "required": [
        "total",
        "currency",
        "cart_version",
        "line_items",
        "total_line_items",
        "unique_item_count",
        "metadata",
        "given_name",
        "surname",
        "address_1",
        "address_2",
        "address_3",
        "address_4",
        "city",
        "state_or_region",
        "postal_code",
        "country",
        "email",
        "phone_number",
        "is_locked"
      ],
      "title": "Cart",
      "type": "object"
    },
    "CartLineItem": {
      "allOf": [
        {
          "$ref": "#/$defs/CatalogItem"
        },
        {
          "properties": {
            "errors": {
              "description": "Any errors for this line item",
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "is_stock_reserved": {
              "description": "Whether stock is reserved for this item",
              "type": "boolean"
            },
            "line_item_id": {
              "description": "Unique identifier for this line item. Either the ID you supplied when adding the item, or a generated UUID.",
              "type": "string"
            },
            "metadata": {
              "description": "Arbitrary key-value pairs for storing custom data specific to this line item",
              "type": "object"
            },
            "options": {
              "description": "Selected product options with translations",
              "items": {
                "properties": {
                  "order": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "translations": {
                    "items": {
                      "properties": {
                        "language": {
                          "type": "string"
                        },
                        "option_name": {
                          "type": "string"
                        },
                        "value_name": {
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "type": "object"
              },
              "type": "array"
            },
            "stock_reserved_until": {
              "description": "When the stock reservation expires",
              "format": "datetime",
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "line_item_id",
            "metadata",
            "errors",
            "stock_reserved_until",
            "is_stock_reserved",
            "options"
          ],
          "type": "object"
        }
      ],
      "description": "Cart line item containing full catalog item details plus cart-specific fields",
      "title": "CartLineItem",
      "type": "object"
    },
    "CatalogItem": {
      "description": "A single catalog item with all its details",
      "properties": {
        "category_ids": {
          "description": "Array of category IDs this item belongs to",
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "shipping_estimate": {
          "description": "Estimated shipping cost",
          "format": "decimal",
          "type": "string"
        },
        "price_high": {
          "description": "Highest price across all variations of this product",
          "format": "decimal",
          "type": [
            "string",
            "null"
          ]
        },
        "is_primary": {
          "description": "Whether this is a primary item",
          "type": "boolean"
        },
        "original_points": {
          "description": "Original points value before discounts",
          "type": "integer"
        },
        "price": {
          "description": "Current item price",
          "format": "decimal",
          "type": "string"
        },
        "item_type_id": {
          "description": "Item type identifier",
          "type": "integer"
        },
        "points_low": {
          "description": "Lowest points value across all variations of this product",
          "type": [
            "integer",
            "null"
          ]
        },
        "rank": {
          "description": "Display rank/order",
          "type": "integer"
        },
        "description": {
          "description": "Detailed description of the item",
          "type": "string"
        },
        "catalog_item_id": {
          "description": "Unique identifier for this catalog item",
          "type": "integer"
        },
        "face_currency": {
          "description": "Currency of the face value",
          "type": [
            "string",
            "null"
          ]
        },
        "supplier_reference_id": {
          "description": "Supplier's reference ID",
          "type": "string"
        },
        "images": {
          "description": "Array of product images",
          "items": {
            "$ref": "#/$defs/CatalogItemImage"
          },
          "type": "array"
        },
        "name": {
          "description": "Display name of the item",
          "type": "string"
        },
        "product_id": {
          "description": "Product identifier UUID",
          "type": [
            "string",
            "null"
          ]
        },
        "retail_price": {
          "description": "Retail price",
          "format": "decimal",
          "type": "string"
        },
        "fulfillment_type": {
          "description": "How this item is fulfilled",
          "type": "string"
        },
        "price_low": {
          "description": "Lowest price across all variations of this product",
          "format": "decimal",
          "type": [
            "string",
            "null"
          ]
        },
        "is_available": {
          "description": "Whether the item is available",
          "type": "boolean"
        },
        "is_explicit": {
          "description": "Whether the item contains explicit content",
          "type": "boolean"
        },
        "is_limited_stock": {
          "description": "Whether the item has limited stock",
          "type": "boolean"
        },
        "brand_id": {
          "description": "Brand identifier",
          "type": "integer"
        },
        "availability": {
          "description": "Availability status description",
          "type": "string"
        },
        "original_price": {
          "description": "Original item price before discounts",
          "format": "decimal",
          "type": "string"
        },
        "face_value": {
          "description": "Face value of the item (e.g., gift card value)",
          "format": "decimal",
          "type": [
            "string",
            "null"
          ]
        },
        "model": {
          "description": "Model number",
          "type": "string"
        },
        "product_options": {
          "additionalProperties": {
            "items": {
              "properties": {
                "order": {
                  "description": "Display order for this option",
                  "type": "string"
                },
                "slug": {
                  "description": "Option identifier (e.g., 'color', 'size')",
                  "type": "string"
                },
                "translations": {
                  "description": "Translations for option name and value",
                  "items": {
                    "properties": {
                      "language": {
                        "type": "string"
                      },
                      "option_name": {
                        "type": "string"
                      },
                      "value_name": {
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "type": "array"
                },
                "value": {
                  "description": "Option value (e.g., 'blue', 'large')",
                  "type": "string"
                }
              },
              "type": "object"
            },
            "type": "array"
          },
          "description": "Available options for all variations of this product, keyed by catalog_item_id",
          "type": "object"
        },
        "points_high": {
          "description": "Highest points value across all variations of this product",
          "type": [
            "integer",
            "null"
          ]
        },
        "supplier_id": {
          "description": "Supplier identifier",
          "type": "integer"
        },
        "product_name": {
          "description": "An alternate name describing an item that is a variation",
          "type": [
            "string",
            "null"
          ]
        },
        "required_fields": {
          "description": "Fields required for ordering this item (loaded from the index during cart verify)",
          "properties": {
            "address_1": {
              "description": "Whether address line 1 is required",
              "type": "boolean"
            },
            "address_2": {
              "description": "Whether address line 2 is required",
              "type": "boolean"
            },
            "address_3": {
              "description": "Whether address line 3 is required",
              "type": "boolean"
            },
            "address_4": {
              "description": "Whether address line 4 is required",
              "type": "boolean"
            },
            "city": {
              "description": "Whether city is required",
              "type": "boolean"
            },
            "country": {
              "description": "Whether country is required",
              "type": "boolean"
            },
            "email": {
              "description": "Whether email is required",
              "type": "boolean"
            },
            "given_name": {
              "description": "Whether given name is required",
              "type": "boolean"
            },
            "phone_number": {
              "description": "Whether phone number is required",
              "type": "boolean"
            },
            "postal_code": {
              "description": "Whether postal code is required",
              "type": "boolean"
            },
            "state_or_region": {
              "description": "Whether state/region is required",
              "type": "boolean"
            },
            "surname": {
              "description": "Whether surname is required",
              "type": "boolean"
            }
          },
          "type": "object"
        },
        "is_taxable": {
          "description": "Whether the item is taxable",
          "type": "boolean"
        },
        "brand": {
          "description": "Brand name",
          "type": "string"
        },
        "tag_ids": {
          "description": "Array of tag IDs associated with this item",
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "points": {
          "description": "Current points value for this item",
          "type": "integer"
        }
      },
      "required": [
        "catalog_item_id",
        "product_id",
        "name",
        "description",
        "brand",
        "brand_id",
        "model",
        "category_ids",
        "tag_ids",
        "item_type_id",
        "supplier_id",
        "supplier_reference_id",
        "availability",
        "is_available",
        "is_primary",
        "is_limited_stock",
        "is_taxable",
        "is_explicit",
        "fulfillment_type",
        "price",
        "points",
        "original_price",
        "original_points",
        "retail_price",
        "shipping_estimate",
        "images",
        "product_options",
        "rank",
        "required_fields"
      ],
      "title": "CatalogItem",
      "type": "object"
    },
    "CatalogItemImage": {
      "description": "Product image with multiple size variations",
      "properties": {
        "alt": {
          "description": "Alt text for accessibility",
          "type": "string"
        },
        "is_primary": {
          "description": "Whether this is the primary image for the product",
          "type": "boolean"
        },
        "order": {
          "description": "Display order for this image",
          "type": "integer"
        },
        "urls": {
          "description": "URLs for different image sizes and ratios",
          "properties": {
            "image_150_1_1": {
              "description": "150px square (1:1 ratio)",
              "type": "string"
            },
            "image_150_3_2": {
              "description": "150px width (3:2 ratio)",
              "type": "string"
            },
            "image_300_1_1": {
              "description": "300px square (1:1 ratio)",
              "type": "string"
            },
            "image_300_3_2": {
              "description": "300px width (3:2 ratio)",
              "type": "string"
            },
            "image_500_1_1": {
              "description": "500px square (1:1 ratio)",
              "type": "string"
            },
            "image_500_3_2": {
              "description": "500px width (3:2 ratio)",
              "type": "string"
            },
            "image_75_1_1": {
              "description": "75px square (1:1 ratio)",
              "type": "string"
            },
            "image_75_3_2": {
              "description": "75px width (3:2 ratio)",
              "type": "string"
            }
          },
          "required": [
            "image_75_1_1",
            "image_150_1_1",
            "image_300_1_1",
            "image_500_1_1",
            "image_75_3_2",
            "image_150_3_2",
            "image_300_3_2",
            "image_500_3_2"
          ],
          "type": "object"
        }
      },
      "required": [
        "is_primary",
        "order",
        "alt",
        "urls"
      ],
      "title": "CatalogItemImage",
      "type": "object"
    }
  }
}