Product-Base Schema

Schema definition for the Product-Base object in product data

Product-Base Schema

This is a data schema, not an API endpoint. The Product-Base object describes the shape of data returned inside product records by the Product Opener API.

{
  "type": "object",
  "description": "Base product data\n",
  "required": [
    "code",
    "schema_version"
  ],
  "allOf": [
    {
      "type": "object",
      "description": "Product type information",
      "properties": {
        "product_type": {
          "type": "string",
          "description": "The product type is a fundamental separation that tells on which platform the product is made available:\nOpen Food Facts, Open Beauty Facts, Open Pet Food Facts or Open Products Facts.\n\nEach platform has variations on the way it analyses the product.\n\nChanging the product type moves the product to the new platform.\nIt must be done thoughtfully.\n",
          "enum": [
            "beauty",
            "food",
            "petfood",
            "product"
          ]
        }
      }
    }
  ],
  "properties": {
    "product_name": {
      "type": "string",
      "description": "The name of the product in the main language of the product (lang field) \n"
    },
    "abbreviated_product_name": {
      "type": "string",
      "description": "Abbreviated product name (e.g. abbreviated product name printed on receipts) in the main language of the product (lang field)"
    },
    "code": {
      "type": "string",
      "description": "barcode of the product (can be EAN-13 or internal codes for some food stores),\nfor products without a barcode,\nOpen Food Facts assigns a number starting with the 200 reserved prefix\n"
    },
    "codes_tags": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "A value which is the type of barcode \"code-13\" or \"code-8\"\nand\nA series of mask for the barcode\nIt helps retrieve barcodes starting by\n",
        "examples": [
          "code-13",
          "3017620422xxx",
          "301762042xxxx",
          "30176204xxxxx",
          "3017620xxxxxx",
          "301762xxxxxxx",
          "30176xxxxxxxx",
          "3017xxxxxxxxx",
          "301xxxxxxxxxx",
          "30xxxxxxxxxxx",
          "3xxxxxxxxxxxx"
        ]
      }
    },
    "generic_name": {
      "type": "string",
      "description": "Generic / legal name of the product in the main language of the product (lang field)\n"
    },
    "id": {
      "description": "internal identifier for the product, usually set to the value of `code`,\nexcept on the producers platform where it is prefixed by the owner\n",
      "type": "string"
    },
    "lc": {
      "type": "string",
      "description": "Main language of the product.\nThis is a duplicate of `lang` property (for historical reasons).\n"
    },
    "lang": {
      "type": "string",
      "description": "Main language of the product.\n\nThis should be the main language of product packaging (if one is predominant).\n\nMain language is also used to decide which ingredients list to parse.\n"
    },
    "nova_group": {
      "type": "integer",
      "description": "Nova group as an integer from 1 to 4. See https://world.openfoodfacts.org/nova\n"
    },
    "nova_groups": {
      "type": "string"
    },
    "obsolete": {
      "type": "string"
    },
    "obsolete_since_date": {
      "description": "A date at which the product was declared obsolete.\nThis means it's not produced any more.\n",
      "type": "string"
    },
    "product_quantity": {
      "type": "string",
      "description": "The size in g or ml for the whole product.\nIt is a normalized version of the `quantity` field.\nA `quantity` of \"2 x 60 g\" leads to `product_quantity`: \"120\".\n",
      "example": "500"
    },
    "product_quantity_unit": {
      "type": "string",
      "description": "The unit (either g or ml) for the corresponding `product_quantity`.\nIt is computed from the `quantity` field.\nA `quantity` of \"6 x 250 ml\" leads to `product_quantity_unit`: \"ml\".\n",
      "example": "g"
    },
    "quantity": {
      "type": "string",
      "description": "The quantity of the product, with the corresponding number of portions or unit (g, ml, kg, l, cl, oz, lbs...).\nIt should be the value as displayed on the product. The ℮ sign is allowed.\nWhen it refers to the number of portions, it can be filled without any units (e.g. \"6 eggs\").\n",
      "example": "3 x 150 g"
    },
    "schema_version": {
      "type": "integer",
      "description": "Version of the product object schema used in the response.\nThis indicates the structure of the 'product' field itself.\nFor more details, please read: https://openfoodfacts.github.io/openfoodfacts-server/api/ref-api-and-product-schema-change-log\n",
      "example": 999
    }
  },
  "patternProperties": {
    "product_name_(?<language_code>\\w\\w)": {
      "type": "string",
      "description": "Product name in language designated by `language_code`, e.g. product_name_fr\n"
    },
    "abbreviated_product_name_(?<language_code>\\w\\w)": {
      "type": "string",
      "description": "Abbreviated product name in language `language_code`."
    },
    "generic_name_(?<language_code>\\w\\w)": {
      "type": "string",
      "description": "Generic/legal name in language designated by `language_code`, e.g. generic_name_en.\n"
    }
  }
}