{
  "$schema": "http://json-schema.org/draft-07/schema",
  "type": "object",
  "properties": {
    "balance": {
      "type": "number",
      "description": "Your current balance (remaining requests)"
    },
    "product": {
      "type": "object",
      "description": "Product info (present only if the request was successful)",
      "properties": {
        "barcode": {
          "type": "string",
          "description": "Product barcode"
        },
        "barcodeDetails": {
          "type": "object",
          "description": "Additional barcode information",
          "properties": {
            "type": {
              "type": "string",
              "description": "Barcode type",
              "enum": ["EAN-8", "EAN-13", "EAN-14", "ISBN"]
            },
            "description": {
              "type": "string",
              "description": "Barcode prefix description"
            },
            "country": {
              "type": ["string", "null"],
              "description": "Barcode country (if defined)"
            }
          }
        },
        "titles": {
          "type": "object",
          "description": "Product titles, \"lang\": \"title\" mapping",
          "additionalProperties": {
            "type": "string"
          }
        },
        "descriptions": {
          "type": ["object", "null"],
          "description": "Product descriptions, \"lang\": \"description\" mapping",
          "additionalProperties": {
            "type": "string"
          }
        },
        "categories": {
          "type": "array",
          "items": {
            "type": "object",
            "minItems": 0,
            "properties": {
              "id": {
                "type": "string",
                "description": "Category id, from Google Taxonomy"
              },
              "titles": {
                "type": "object",
                "description": "Category titles, \"lang\": \"title\" mapping",
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false,
            "required": [
              "id", "titles"
            ]
          },
          "description": "Categories, array of objects (or an empty array)"
        },
        "images": {
          "type": "array",
          "items": {
            "type": "object",
            "minItems": 0,
            "properties": {
              "url": {
                "type": "string",
                "description": "Image url"
              },
              "isCatalog": {
                "type": "boolean",
                "description": "True if an image can be used in a catalog (professionally captured)"
              },
              "width": {
                "type": "number",
                "description": "Image width in pixels"
              },
              "height": {
                "type": "number",
                "description": "Image height in pixels"
              },
              "additionalProperties": false
            },
            "required": [
              "url"
            ]
          },
          "description": "Images, array of objects (or an empty array)"
        },
        "manufacturer": {
          "type": ["object", "null"],
          "description": "Product manufacturer / brand (if available)",
          "properties": {
            "id": {
              "type": ["string", "null"],
              "description": "Product manufacturer / brand id (for recognized manufacturers and brands)"
            },
            "titles": {
              "type": "object",
              "description": "Product manufacturer / brand titles, lang -> title mapping"
            },
            "wikidataId": {
              "type": ["string", "null"],
              "description": "Id of manufacturer / brand in wikidata database, if exists"
            }
          },
          "additionalProperties": false,
          "required": [
            "titles"
          ]
        },
        "relatedBrands": {
          "type": "array",
          "description": "Other brands that may be related to a product (distributors, collaborations etc.)",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": ["string", "null"],
                "description": "Brand id (for recognized brands)"
              },
              "titles": {
                "type": "object",
                "description": "Brand titles, lang -> title mapping"
              },
              "wikidataId": {
                "type": ["string", "null"],
                "description": "Id of brand in wikidata database, if exists"
              }
            },
            "additionalProperties": false,
            "required": [
              "id", "titles"
            ]
          }
        },
        "metadata": {
          "type": ["object", "null"],
          "description": "Product metadata (if available)",
          "properties": {
            "apparel": {
              "type": "object",
              "properties": {
                "sizes": {
                  "type": "array",
                  "items": {
                    "$ref": "#/definitions/Measurement"
                  },
                  "description": "Apparel sizes metadata"
                }
              },
              "additionalProperties": false,
              "description": "Apparel (shoes and clothing) product metadata"
            },
            "electric": {
              "type": "object",
              "properties": {
                "batteryCapacity": {
                  "energy": {
                    "$ref": "#/definitions/Measurement"
                  },
                  "nominal": {
                    "$ref": "#/definitions/Measurement"
                  }
                },
                "batteryChemistry": {
                  "type": "string"
                },
                "batterySize": {
                  "type": "string"
                },
                "voltage": {
                  "input": {
                    "$ref": "#/definitions/Measurement"
                  },
                  "nominal": {
                    "$ref": "#/definitions/Measurement"
                  },
                  "operational": {
                    "$ref": "#/definitions/Measurement"
                  },
                  "additionalProperties": false
                }
              },
              "additionalProperties": false,
              "description": "Metadata for electric products"
            },
            "externalIds": {
              "type": "object",
              "properties": {
                "amazonAsin": {
                  "type": "string",
                  "description": "Amazon ASIN"
                },
                "bisacCodes": {
                  "type": "array",
                  "description": "BISAC codes of a book, a magazine or a newspaper",
                  "items": {
                    "type": "string",
                    "minItems": 1,
                    "maxItems": 3
                  }
                }
              },
              "additionalProperties": false,
              "description": "Product external ids"
            },
            "food": {
              "type": "object",
              "properties": {
                "nutrimentsPer100Grams": {
                  "type": "object",
                  "properties": {
                    "energy": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Energy value (per 100 grams)"
                    },
                    "proteins": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Proteins (per 100 grams)"
                    },
                    "carbohydrates": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Carbohydrates (per 100 grams)"
                    },
                    "totalSugars": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Total sugars (per 100 grams)"
                    },
                    "addedSugars": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Added sugars (per 100 grams)"
                    },
                    "fat": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Fat (per 100 grams)"
                    },
                    "saturatedFat": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Saturated fat (per 100 grams)"
                    },
                    "transFat": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Trans fat (per 100 grams)"
                    },
                    "fiber": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Fiber (per 100 grams)"
                    },
                    "cholesterol": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Cholesterol (per 100 grams)"
                    },
                    "sodium": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Sodium (per 100 grams)"
                    },
                    "potassium": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Potassium (per 100 grams)"
                    },
                    "calcium": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Calcium (per 100 grams)"
                    },
                    "iron": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Iron (per 100 grams)"
                    },
                    "vitaminD": {
                      "$ref": "#/definitions/Measurement",
                      "description": "Vitamin D (per 100 grams)"
                    }
                  },
                  "additionalProperties": false,
                  "description": "Product nutriments per 100 grams"
                },
                "nutriScore": {
                  "type": "object",
                  "properties": {
                    "score": {
                      "type": "number",
                      "description": "NutriScore score"
                    },
                    "grade": {
                      "type": "string",
                      "description": "NutriScore grade"
                    }
                  }
                }
              },
              "additionalProperties": false,
              "description": "Food / beverages metadata"
            },
            "generic": {
              "type": "object",
              "properties": {
                "colors": {
                  "type": "array",
                  "description": "Product colors",
                  "items": {
                    "type": "object",
                    "minItems": 1,
                    "properties": {
                      "baseColor": {
                        "type": "string"
                      },
                      "shade": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "baseColor"
                    ],
                    "additionalProperties": false
                  }
                },
                "contributors": {
                  "type": "array",
                  "description": "Contributors of a product (book authors, media CD performers, etc.), list",
                  "items": {
                    "type": "object",
                    "minItems": 1,
                    "properties": {
                      "names": {
                        "type": "object",
                        "description": "Contributor names, \"lang\": \"title\" mapping",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "type": {
                        "type": "string",
                        "description": "Contributor type"
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "dimensions": {
                  "type": "object",
                  "description": "Product and packaging dimensions",
                  "properties": {
                    "product": {
                      "$ref": "#/definitions/MetadataDimensions"
                    },
                    "packaging": {
                      "$ref": "#/definitions/MetadataDimensions"
                    }
                  },
                  "additionalProperties": false
                },
                "genderFit": {
                  "type": "string"
                },
                "ingredients": {
                  "type": "array",
                  "description": "Ingredients or materials of a product",
                  "items": {
                    "type": "object",
                    "properties": {
                      "groupName": {
                        "type": ["string", "null"]
                      },
                      "ingredientsGroup": {
                        "type": "array",
                        "items": {
                          "$ref": "#/definitions/MetadataIngredient"
                        }
                      }
                    }
                  }
                },
                "power": {
                  "$ref": "#/definitions/Measurement"
                },
                "recommendedAge": {
                  "$ref": "#/definitions/Measurement"
                },
                "storageConditions": {
                  "type": "object",
                  "description": "Product storage conditions",
                  "properties": {
                    "shelfLife": {
                      "$ref": "#/definitions/Measurement"
                    },
                    "temperature": {
                      "$ref": "#/definitions/Measurement"
                    },
                    "humidity": {
                      "$ref": "#/definitions/Measurement"
                    },
                    "recommendations": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                },
                "manufacturerCode": {
                  "type": "string",
                  "description": "Manufacturer product code"
                },
                "numberOfItems": {
                  "type": "integer",
                  "description": "Number of items"
                },
                "volume": {
                  "$ref": "#/definitions/Measurement"
                },
                "weight": {
                  "type": "object",
                  "description": "Product weight",
                  "properties": {
                    "net": {
                      "$ref": "#/definitions/Measurement"
                    },
                    "gross": {
                      "$ref": "#/definitions/Measurement"
                    },
                    "unknown": {
                      "$ref": "#/definitions/Measurement"
                    }
                  },
                  "additionalProperties": false
                }
              },
              "additionalProperties": false,
              "description": "Generic product metadata"
            },
            "printBook": {
              "type": "object",
              "properties": {
                "numPages": {
                  "type": "integer",
                  "description": "Print book pages count"
                },
                "bindingType": {
                  "type": "string",
                  "enum": ["hardcover", "paperback"],
                  "description": "Print book binding type"
                }
              },
              "additionalProperties": false,
              "description": "Print book metadata"
            },
            "media": {
              "type": "object",
              "properties": {
                "publicationYear": {
                  "type": "integer",
                  "description": "Year of the first release or publication"
                }
              },
              "additionalProperties": false,
              "description": "Media products metadata (music recordings, books, etc.)"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false,
      "required": [
        "barcode", "titles", "categories", "images", "manufacturer", "relatedBrands", "metadata"
      ]
    },
    "error": {
      "type": "object",
      "description": "Error info (present only if actual error occurs)",
      "properties": {
        "code": {
          "type": "number"
        },
        "description": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "code", "description"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "balance"
  ],
  "definitions": {
    "MetadataIngredient": {
      "type": "object",
      "properties": {
        "originalNames": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "id": {
          "type": "string"
        },
        "canonicalNames": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "properties": {
          "type": "object",
          "additionalProperties": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "amount": {
          "$ref": "#/definitions/Measurement"
        },
        "isVegan": {
          "type": "boolean"
        },
        "isVegetarian": {
          "type": "boolean"
        },
        "externalIds": {
          "type": "object",
          "properties": {
            "cosIng": {
              "type": "string",
              "description": "CosIng database id"
            },
            "wikidata": {
              "type": "string",
              "description": "Wikidata database id"
            }
          },
          "additionalProperties": false,
          "description": "Ingredient external ids"
        },
        "subIngredients": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/MetadataIngredient"
          }
        }
      },
      "additionalProperties": false
    },
    "MetadataDimensions": {
      "type": "object",
      "properties": {
        "width": {
          "$ref": "#/definitions/Measurement"
        },
        "height": {
          "$ref": "#/definitions/Measurement"
        },
        "length": {
          "$ref": "#/definitions/Measurement"
        },
        "depth": {
          "$ref": "#/definitions/Measurement"
        }
      },
      "additionalProperties": false
    },
    "Measurement": {
      "type": "object",
      "properties": {
        "equals": {
          "$ref": "#/definitions/MeasurementValue"
        },
        "greaterThan": {
          "$ref": "#/definitions/MeasurementValue"
        },
        "lessThan": {
          "$ref": "#/definitions/MeasurementValue"
        }
      },
      "additionalProperties": false
    },
    "MeasurementValue": {
      "type": "object",
      "properties": {
        "value": {
          "type": "string"
        },
        "unit": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  }
}
