io.github.cyanheads/openfoodfacts-mcp-server is an MCP server published by io.github.cyanheads, hosted at openfoodfacts.caseyjhand.com. When last checked on 2026-11-23 it was working: it answers and lists its tools. It declares 4 tools, including off_get_product, off_search_products, off_compare_products, off_browse_taxonomy.
Barcode lookup, nutrition search, and product comparison for 3M+ crowd-sourced food products.
428 connections through 5 shared values. Tap any node.
Fetch a packaged food product by barcode (4–40 digits: EAN-13, EAN-8, UPC, and the shorter and longer codes Open Food Facts also holds) from Open Food Facts. Returns the product name and generic name, brand, quantity, ingredients (raw text and parsed list), declared allergens, trace allergens the label warns about, additives, the product-level vegan/vegetarian/palm-oil analysis, computed scores (Nutri-Score a–e, NOVA 1–4, Green-Score), the low/moderate/high levels of fat, saturated fat, sugars, and salt Open Food Facts computes, nutrition per serving and per 100 g, or per 100 ml for liquids, categories, labels, packaging, origins, countries of sale, image URL, and data completeness. Open Food Facts is a crowd-sourced database — a missing field means "not yet entered by contributors," not that the attribute is absent from the actual product. Nutrition is the exception: Open Food Facts returns one preparation state per read, so a read of prepared figures (_prepared keys under nutriments) omits as-sold figures the record can still hold; when that happens, one more product read fetches the as-sold set the record stores into the as-sold fields, and nutriments.stored_as_sold says whether it was read, the record stores none, or it could not be read. Computed scores carry regional formula caveats and are indicators, not absolute rankings. Data is under ODbL 1.0 — cite Open Food Facts in downstream use.
None yet. Changes appear after a server's second daily check.
Squares are this server's values; dots are other servers sharing them. A shared address or publisher is a lead, not proof of a common operator.
Inferred from the host name and headers: what a server runs on, not who runs it.
| Parameter | Type | Description |
|---|---|---|
| fields | array | Subset of fields to return. Omitting returns all standard fields. Use to reduce payload when only scores or ingredients are needed. A field that cannot be read on its own arrives with what it depends on: nutriments brings serving_size, serving_quantity, and serving_quantity_unit so per-serving figur… |
| barcode * | string | Product barcode, digits only: 4–40 digits after any leading zeros. The primary key for Open Food Facts — the barcode of an off_search_products row works as is. Example: "3017620422003" (Nutella FR). |
{
"name": "off_get_product",
"title": "Get Food Product by Barcode",
"description": "Fetch a packaged food product by barcode (4–40 digits: EAN-13, EAN-8, UPC, and the shorter and longer codes Open Food Facts also holds) from Open Food Facts. Returns the product name and generic name, brand, quantity, ingredients (raw text and parsed list), declared allergens, trace allergens the label warns about, additives, the product-level vegan/vegetarian/palm-oil analysis, computed scores (Nutri-Score a–e, NOVA 1–4, Green-Score), the low/moderate/high levels of fat, saturated fat, sugars, and salt Open Food Facts computes, nutrition per serving and per 100 g, or per 100 ml for liquids, categories, labels, packaging, origins, countries of sale, image URL, and data completeness. Open Food Facts is a crowd-sourced database — a missing field means \"not yet entered by contributors,\" not that the attribute is absent from the actual product. Nutrition is the exception: Open Food Facts returns one preparation state per read, so a read of prepared figures (_prepared keys under nutriments) omits as-sold figures the record can still hold; when that happens, one more product read fetches the as-sold set the record stores into the as-sold fields, and nutriments.stored_as_sold says whether it was read, the record stores none, or it could not be read. Computed scores carry regional formula caveats and are indicators, not absolute rankings. Data is under ODbL 1.0 — cite Open Food Facts in downstream use.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"barcode"
],
"properties": {
"fields": {
"type": "array",
"items": {
"enum": [
"product_name",
"generic_name",
"brands",
"quantity",
"ingredients_text",
"ingredients",
"allergens_tags",
"traces_tags",
"additives_tags",
"ingredients_analysis_tags",
"nutriscore_grade",
"nova_group",
"ecoscore_grade",
"nutrient_levels",
"nutriments",
"serving_size",
"serving_quantity",
"serving_quantity_unit",
"categories_tags",
"labels_tags",
"packaging_tags",
"origins_tags",
"countries_tags",
"image_url",
"completeness",
"data_quality_tags"
],
"type": "string",
"description": "A specific product field to include in the response."
},
"description": "Subset of fields to return. Omitting returns all standard fields. Use to reduce payload when only scores or ingredients are needed. A field that cannot be read on its own arrives with what it depends on: nutriments brings serving_size, serving_quantity, and serving_quantity_unit so per-serving figures carry their denominator, serving_quantity and serving_quantity_unit each bring the other plus serving_size, since a quantity reads only with its unit, and nutrient_levels brings nutriments and the same serving fields, since the figures nutriments holds decide its basis. requested_fields echoes the full set that was fetched."
},
"barcode": {
"type": "string",
"pattern": "^0*[1-9]\\d{3,39}$",
"description": "Product barcode, digits only: 4–40 digits after any leading zeros. The primary key for Open Food Facts — the barcode of an off_search_products row works as is. Example: \"3017620422003\" (Nutella FR)."
}
},
"additionalProperties": false
},
"outputSchema": {
"truncated": true,
"chars": 21822
},
"annotations": {
"readOnlyHint": true,
"openWorldHint": true,
"idempotentHint": true
}
}Search Open Food Facts by full-text query, structured tag filters, or both at once. Returns a summary list with barcodes, product names, brands, Nutri-Score, NOVA group, Green-Score, and categories — enough for triage and selection, not full label data. Use off_get_product on the returned barcodes for complete details. A text query and tag filters combine: every word of the query must match the product name, generic name, categories, labels, or brand, and every filter provided must hold (e.g. query "dark chocolate" with labels_tag "en:organic" and countries_tag "en:france" returns organic chocolate sold in France); numeric nutrient_filters express thresholds per 100 g, or per 100 ml for liquids, such as sugars below 8 g, and combine the same way, and each row then carries the indexed values the thresholds were checked against; ingredients_tag takes canonical ingredient IDs (e.g. "en:inulin") that must all appear among the ingredients Open Food Facts parsed from the label, and combines the same way; additives_tag is the one exception, filtering only on searches carrying none of query, nutrient_filters, or ingredients_tag. nutrition_grade, nova_group, and ecoscore_grade (Green-Score) each take one grade or an array matching any of them. Tag filter values are canonical tag IDs (e.g. "en:organic", "en:no-gluten") — use off_browse_taxonomy to resolve human terms to tag IDs. A case variant, synonym, or singular of a tag is resolved to its canonical ID where Open Food Facts recognizes it; anything else is matched exactly. exclude_allergens and exclude_traces drop products that declare an allergen or a "may contain" trace, but a product with no allergen or trace data entered passes them, so confirm a candidate with off_get_product before relying on it. At least one search parameter is required. The two paths read different indexes: a search carrying query, nutrient_filters, or ingredients_tag is answered by the text index, a snapshot that lags the live database, while a tag-only search reads the live database and is current, or, where this server keeps a local copy of the Open Food Facts export, can be served from that copy, which source and mirror_as_of then report and whose default order and popularity_key or unique_scans_n sort follow the values stored with each record, so they can differ from a live search, which ranks by its current scan counts — so a recently contributed product can be missing from a text search and present in the same search without query. Data is crowd-sourced; result count reflects contributed products, not all products in the market. Data under ODbL 1.0 — cite Open Food Facts in downstream use.
| Parameter | Type | Description |
|---|---|---|
| page | integer | Page number (1-based). Use with page_size to paginate results. Pages are counted at the page_size served, which is at most 100, so repeating one larger page_size pages contiguously (page 2 at page_size 200 is results 101–200). A search by tag filters alone that reads the live database is served thro… |
| query | string | Words to find. Every word must match the product name, generic name, categories, labels, or brand — ingredients and quantity are not searched — so put only words the product itself would carry. Punctuation separates words — except an underscore, an apostrophe or period inside a word, and a decimal c… |
| sort_by | string | Sort order, applied on every search. Each value orders newest or highest first: "unique_scans_n" surfaces the most-scanned products, "last_modified_t" and "created_t" the most recently updated and newest records, "popularity_key" the most popular. Omitting it leaves text searches relevance-ranked an… |
| page_size | number | Results per page (default 20). One call returns at most 100: a larger value is served at 100, reported in page_size and page_size_capped, and page then counts pages of 100. Keep low for initial exploration; increase for comparison workflows. |
| brands_tag | string | Brand slug (lowercased, hyphenated). Example: "nutella", "kelloggs". A brand name is slugged the way Open Food Facts slugs it ("Ben & Jerry's" → "ben-jerry-s") and then matched exactly — a partial or misspelled slug matches nothing rather than falling back to a near match, so put open-ended brand wo… |
| labels_tag | any | Canonical label/certification tag ID, or an array of up to 10 that must all apply. Example: "en:organic", or ["en:organic", "en:fair-trade"] for products carrying both. Use off_browse_taxonomy with facet="labels". |
| nova_group | any | Filter by NOVA food processing class, or an array of classes matching any of them. "1"=unprocessed/minimally processed, "4"=ultra-processed. Example: "1", or ["1", "2"]. A product is in one class, so an array matches products in any of its classes, unlike labels_tag, whose values must all apply. Pro… |
{
"name": "off_search_products",
"title": "Search Food Products",
"description": "Search Open Food Facts by full-text query, structured tag filters, or both at once. Returns a summary list with barcodes, product names, brands, Nutri-Score, NOVA group, Green-Score, and categories — enough for triage and selection, not full label data. Use off_get_product on the returned barcodes for complete details. A text query and tag filters combine: every word of the query must match the product name, generic name, categories, labels, or brand, and every filter provided must hold (e.g. query \"dark chocolate\" with labels_tag \"en:organic\" and countries_tag \"en:france\" returns organic chocolate sold in France); numeric nutrient_filters express thresholds per 100 g, or per 100 ml for liquids, such as sugars below 8 g, and combine the same way, and each row then carries the indexed values the thresholds were checked against; ingredients_tag takes canonical ingredient IDs (e.g. \"en:inulin\") that must all appear among the ingredients Open Food Facts parsed from the label, and combines the same way; additives_tag is the one exception, filtering only on searches carrying none of query, nutrient_filters, or ingredients_tag. nutrition_grade, nova_group, and ecoscore_grade (Green-Score) each take one grade or an array matching any of them. Tag filter values are canonical tag IDs (e.g. \"en:organic\", \"en:no-gluten\") — use off_browse_taxonomy to resolve human terms to tag IDs. A case variant, synonym, or singular of a tag is resolved to its canonical ID where Open Food Facts recognizes it; anything else is matched exactly. exclude_allergens and exclude_traces drop products that declare an allergen or a \"may contain\" trace, but a product with no allergen or trace data entered passes them, so confirm a candidate with off_get_product before relying on it. At least one search parameter is required. The two paths read different indexes: a search carrying query, nutrient_filters, or ingredients_tag is answered by the text index, a snapshot that lags the live database, while a tag-only search reads the live database and is current, or, where this server keeps a local copy of the Open Food Facts export, can be served from that copy, which source and mirror_as_of then report and whose default order and popularity_key or unique_scans_n sort follow the values stored with each record, so they can differ from a live search, which ranks by its current scan counts — so a recently contributed product can be missing from a text search and present in the same search without query. Data is crowd-sourced; result count reflects contributed products, not all products in the market. Data under ODbL 1.0 — cite Open Food Facts in downstream use.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"page": {
"type": "integer",
"default": 1,
"maximum": 9007199254740991,
"minimum": 1,
"description": "Page number (1-based). Use with page_size to paginate results. Pages are counted at the page_size served, which is at most 100, so repeating one larger page_size pages contiguously (page 2 at page_size 200 is results 101–200). A search by tag filters alone that reads the live database is served through page 10 only, so at page_size 100 it reaches the first 1000 matches; where this server keeps a local copy of the export, a tag-only search whose every value it confirms (canonical IDs from off_browse_taxonomy, or a brand slug) is served from that copy through its first 10000 results, so page * page_size (as served) must stay at or below 10000 there. One carrying ecoscore_grade is served from that copy only once a full reload of it has indexed Green-Score. A search carrying query, nutrient_filters, or ingredients_tag serves only the first 10000 results, so page * page_size (as served) must stay at or below 10000. A request past any of these bounds is rejected rather than sent; narrow the filters or change sort_by to bring other products forward."
},
"query": {
"type": "string",
"description": "Words to find. Every word must match the product name, generic name, categories, labels, or brand — ingredients and quantity are not searched — so put only words the product itself would carry. Punctuation separates words — except an underscore, an apostrophe or period inside a word, and a decimal comma inside a number — so each part of \"milk-chocolate\" or \"salt/pepper\" must match, while \"l'eau\" and \"1,5\" stay one word. Stop words of English, French, Spanish, German, and Italian (\"with\", \"the\", \"de\", \"mit\", …) are not required, and neither is a content word that is a stop word in one of them (such as Spanish \"soy\"), though it still ranks the results. Names are matched in the 31 languages the text index analyzes, so a product named only in French is found by its French name. At most 24 words, counted as runs of letters and digits, so each part of a hyphenated or apostrophe-joined word counts. Example: \"dark chocolate 70%\". Supplying it routes the search to the text index, a snapshot that lags the live Open Food Facts database; drop it, and nutrient_filters and ingredients_tag, which route there too, to run the same tag filters against the live database or, where this server keeps one, its local copy of the export."
},
"sort_by": {
"enum": [
"last_modified_t",
"unique_scans_n",
"created_t",
"popularity_key"
],
"type": "string",
"description": "Sort order, applied on every search. Each value orders newest or highest first: \"unique_scans_n\" surfaces the most-scanned products, \"last_modified_t\" and \"created_t\" the most recently updated and newest records, \"popularity_key\" the most popular. Omitting it leaves text searches relevance-ranked and tag-only searches in the default order. Where this server serves a tag-only search from its local copy of the export (source \"off_mirror\"), the default order and \"popularity_key\" and \"unique_scans_n\" follow the values stored with each record, so they can differ from a live search, which ranks by its current scan counts; \"last_modified_t\" and \"created_t\" sort alike."
},
"page_size": {
"type": "number",
"default": 20,
"minimum": 1,
"multipleOf": 1,
"description": "Results per page (default 20). One call returns at most 100: a larger value is served at 100, reported in page_size and page_size_capped, and page then counts pages of 100. Keep low for initial exploration; increase for comparison workflows."
},
"brands_tag": {
"type": "string",
"description": "Brand slug (lowercased, hyphenated). Example: \"nutella\", \"kelloggs\". A brand name is slugged the way Open Food Facts slugs it (\"Ben & Jerry's\" → \"ben-jerry-s\") and then matched exactly — a partial or misspelled slug matches nothing rather than falling back to a near match, so put open-ended brand wording in query instead."
},
"labels_tag": {
"anyOf": [
{
"type": "string",
"description": "One canonical label tag ID."
},
{
"type": "array",
"items": {
"type": "string",
"description": "One canonical label tag ID."
},
"maxItems": 10,
"description": "Up to 10 canonical label tag IDs, all of which must apply."
}
],
"description": "Canonical label/certification tag ID, or an array of up to 10 that must all apply. Example: \"en:organic\", or [\"en:organic\", \"en:fair-trade\"] for products carrying both. Use off_browse_taxonomy with facet=\"labels\"."
},
"nova_group": {
"anyOf": [
{
"enum": [
"1",
"2",
"3",
"4"
],
"type": "string",
"description": "One NOVA group."
},
{
"type": "array",
"items": {
"enum": [
"1",
"2",
"3",
"4"
],
"type": "string",
"description": "One NOVA group."
},
"maxItems": 4,
"description": "NOVA groups, any of which a product may be in."
}
],
"description": "Filter by NOVA food processing class, or an array of classes matching any of them. \"1\"=unprocessed/minimally processed, \"4\"=ultra-processed. Example: \"1\", or [\"1\", \"2\"]. A product is in one class, so an array matches products in any of its classes, unlike labels_tag, whose values must all apply. Products without a NOVA score are excluded."
},
"traces_tag": {
"type": "string",
"description": "Canonical allergen tag ID the label warns the product may contain as a trace (\"may contain nuts\"). Example: \"en:nuts\". Trace tags are allergen tags, so off_browse_taxonomy with facet=\"allergens\" resolves them. Selects products carrying the warning; to leave them out, use exclude_traces."
},
"additives_tag": {
"type": "string",
"description": "Canonical additive (E-number) tag ID. Example: \"en:e322\", \"en:e330\". Use off_browse_taxonomy with facet=\"additives\". Available only on searches carrying none of query, nutrient_filters, or ingredients_tag — each routes to a backend with no additives field, so combining them is rejected instead of silently returning nothing."
},
"allergens_tag": {
"type": "string",
"description": "Canonical allergen tag ID. Example: \"en:milk\", \"en:gluten\". Use off_browse_taxonomy with facet=\"allergens\". Selects products that declare this allergen; it cannot select allergen-free products, because a product with no allergen tags may simply have none entered yet. To leave an allergen out, use exclude_allergens."
},
"countries_tag": {
"type": "string",
"description": "Canonical country tag ID. Example: \"en:france\", \"en:united-states\". Filters to products sold in that country."
},
"categories_tag": {
"type": "string",
"description": "Canonical category tag ID. Example: \"en:breakfast-cereals\", \"en:cheeses\". Use off_browse_taxonomy with facet=\"categories\" to discover valid values."
},
"ecoscore_grade": {
"anyOf": [
{
"enum": [
"a-plus",
"a",
"b",
"c",
"d",
"e",
"f"
],
"type": "string",
"description": "One Green-Score grade."
},
{
"type": "array",
"items": {
"enum": [
"a-plus",
"a",
"b",
"c",
"d",
"e",
"f"
],
"type": "string",
"description": "One Green-Score grade."
},
"maxItems": 7,
"description": "Green-Score grades, any of which a product may carry."
}
],
"description": "Filter by Green-Score (environmental impact) grade, or an array of grades matching any of them: \"a-plus\" is the lowest impact, then \"a\" through \"f\". \"a\" does not include \"a-plus\", so ask for [\"a-plus\", \"a\"] for A or better. A product carries one grade, so an array matches products graded any of its values, unlike labels_tag, whose values must all apply. A search by tag filters alone, without ingredients_tag, matches the grade Open Food Facts files for France, while each row shows the world grade, so a row can show a different letter than the one it matched. Products without a Green-Score are excluded."
},
"exclude_traces": {
"type": "array",
"items": {
"type": "string",
"description": "One canonical allergen tag ID to exclude as a trace, e.g. \"en:nuts\"."
},
"maxItems": 14,
"description": "Allergen tag IDs a product's label must not warn it may contain as traces, all applied. Example: [\"en:nuts\"]. Values are validated like exclude_allergens. A product with no trace data entered passes, so check a candidate with off_get_product before relying on it."
},
"ingredients_tag": {
"anyOf": [
{
"type": "string",
"description": "One canonical ingredient tag ID."
},
{
"type": "array",
"items": {
"type": "string",
"description": "One canonical ingredient tag ID."
},
"maxItems": 10,
"description": "Up to 10 canonical ingredient tag IDs, all of which must appear."
}
],
"description": "Canonical ingredient tag ID, or an array of up to 10 that must all appear among the ingredients Open Food Facts parsed from the label. Example: \"en:inulin\", or [\"en:inulin\", \"en:oat\"] for products listing both. IDs are singular (\"en:oat\", not \"en:oats\"); use off_browse_taxonomy with facet=\"ingredients\" to resolve them, and use ingredients_analysis_tag instead for a vegan, vegetarian, or palm-oil verdict. Each parsed ingredient also carries its taxonomy parents, so \"en:vegetable\" matches a product listing carrot. Served only by the text index, so supplying one routes the search there even without query — it then reads the lagging text index and is subject to the 10000-result page window, and additives_tag cannot be combined with it."
},
"nutrition_grade": {
"anyOf": [
{
"enum": [
"a",
"b",
"c",
"d",
"e"
],
"type": "string",
"description": "One Nutri-Score grade."
},
{
"type": "array",
"items": {
"enum": [
"a",
"b",
"c",
"d",
"e"
],
"type": "string",
"description": "One Nutri-Score grade."
},
"maxItems": 5,
"description": "Nutri-Score grades, any of which a product may carry."
}
],
"description": "Filter by Nutri-Score grade, or an array of grades matching any of them. \"a\" is highest nutritional quality, \"e\" is lowest. Example: \"a\", or [\"a\", \"b\"] for B or better. A product carries one grade, so an array matches products graded any of its values, unlike labels_tag, whose values must all apply. Products without a score are excluded."
},
"nutrient_filters": {
"type": "array",
"items": {
"type": "object",
"required": [
"nutrient",
"operator",
"value"
],
"properties": {
"value": {
"type": "number",
"minimum": 0,
"description": "Threshold to compare against: kilocalories for energy, grams for every other nutrient, per 100 g, or per 100 ml for liquids."
},
"nutrient": {
"enum": [
"energy-kcal",
"fat",
"saturated-fat",
"carbohydrates",
"sugars",
"fiber",
"proteins",
"salt",
"sodium"
],
"type": "string",
"description": "Nutrient to constrain, measured per 100 g, or per 100 ml for liquids. Energy is kilocalories; every other value is grams."
},
"operator": {
"enum": [
"lt",
"lte",
"gt",
"gte"
],
"type": "string",
"description": "Comparison against value: \"lt\" below, \"lte\" at or below, \"gt\" above, \"gte\" at or above."
}
},
"description": "One numeric constraint on a nutrient value per 100 g, or per 100 ml for liquids."
},
"maxItems": 18,
"description": "Numeric constraints on nutrient values per 100 g, or per 100 ml for liquids, combined as AND with each other and with every other filter. Pair two entries on the same nutrient to express a range (e.g. sugars gte 2 and sugars lte 8). Served only by the text backend, so supplying one routes the search there even without query — it then reads the lagging text index and is subject to the 10,000-result page window, and additives_tag cannot be combined with it. The text index compares energy-kcal, fat, saturated-fat, carbohydrates, sugars as whole numbers, so every returned row is checked against these constraints: a row outside them leaves the page and counts in outside_constraints, and a nutrient the index holds no value for does not count against a row. A page can come back short or empty while later pages hold matches, and a range inside one whole number (sugars gt 3.9 and lt 4) can pass few rows of the 10,000 reachable, so add query or tag filters to narrow it. Per-serving and prepared-product values are not searchable."
},
"exclude_allergens": {
"type": "array",
"items": {
"type": "string",
"description": "One canonical allergen tag ID to exclude, e.g. \"en:nuts\"."
},
"maxItems": 14,
"description": "Allergen tag IDs a product must not declare, all applied. Example: [\"en:nuts\", \"en:peanuts\"]. Each value must be an allergen tag Open Food Facts recognizes — resolve it with off_browse_taxonomy facet=\"allergens\" — and one it does not recognize is rejected rather than sent, because it would exclude nothing. A product with no allergen data entered passes an exclusion, so check a candidate with off_get_product before relying on it."
},
"ingredients_analysis_tag": {
"enum": [
"en:palm-oil",
"en:palm-oil-free",
"en:may-contain-palm-oil",
"en:palm-oil-content-unknown",
"en:vegan",
"en:maybe-vegan",
"en:non-vegan",
"en:vegan-status-unknown",
"en:vegetarian",
"en:maybe-vegetarian",
"en:non-vegetarian",
"en:vegetarian-status-unknown"
],
"type": "string",
"description": "Vegan, vegetarian, or palm-oil verdict Open Food Facts computes from the parsed ingredients. Example: \"en:vegan\", \"en:palm-oil-free\". \"en:maybe-vegan\" and \"en:may-contain-palm-oil\" mean the ingredients could not settle it, and the \"-unknown\" values mean no verdict could be computed."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"total",
"total_is_lower_bound",
"page",
"page_size",
"page_count",
"source",
"products"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"cap": {
"type": "number",
"description": "The page_size that was applied."
},
"page": {
"type": "number",
"description": "Current page number (1-based)."
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"no_filters",
"unrecognized_exclusion",
"additives_filter_needs_tag_search",
"query_too_long",
"page_out_of_range",
"upstream_error",
"upstream_timeout",
"upstream_rejected",
"rate_limited"
],
"description": "Machine-readable failure mode. Declared by this tool: `no_filters`: No search query or filter was provided. `unrecognized_exclusion`: An exclude_allergens or exclude_traces value is not an allergen tag the Open Food Facts vocabulary confirms, or could not be checked because the vocabulary could not be reached or gave no usable answer, Open Food Facts rate-limited the lookup, or this server's own taxonomy budget was spent — an unrecognized exclusion would exclude nothing. `additives_filter_needs_tag_search`: additives_tag was combined with a query, nutrient_filters, or ingredients_tag, which route to a backend that cannot filter by additive. `query_too_long`: query carries more than 24 words, more than the text backend can require at once. `page_out_of_range`: A search by tag filters alone asks for a page past 10 and would read the live database — this server keeps no ready local copy of the export, a tag value is one it cannot confirm, or the search carries ecoscore_grade before a full reload of that copy has indexed Green-Score — or a search the text backend serves asks for page * page_size beyond its 10000-result window, or one the local copy serves beyond its 10000-result window, counting page_size at the 100 served when a larger one was requested. `upstream_error`: Open Food Facts returns a 5xx other than 501 or 504, serves an HTML error page with a 2xx or 5xx status, reports a search-engine failure inside an HTTP 200, answers 2xx with a malformed envelope, closes the connection before finishing its answer, or is unreachable. `upstream_timeout`: Open Food Facts did not answer within the request or retry deadline, flagged its text search as timed out, or answered 408, 425, or 504. `upstream_rejected`: Open Food Facts refuses the request with a 4xx other than 408, 425, or 429, or with 501 Not Implemented — the request as formed will be refused again. `rate_limited`: This server's own per-minute search budget is spent, or Open Food Facts answers 429. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"shown": {
"type": "number",
"description": "Number of products returned on this page."
},
"total": {
"type": "number",
"description": "Matching products in the database for this search. Exact unless total_is_lower_bound is true, in which case at least this many match and the real figure is unknown. On a search constraining a nutrient the text index compares as a whole number (see nutrient_filters) this is its whole-number answer, which can include rows those constraints rule out."
},
"notice": {
"type": "string",
"description": "Guidance about this result set — echoes the filters and suggests how to broaden when nothing matched, names the current page and how far the backend will actually paginate when more results exist, or, on a page that returned no rows because it lies past the last match or every row was left off, says which page to request instead. When rows outside nutrient_filters emptied the page and more rows can be reached or lie past the window, it also suggests adding query or tag filters."
},
"source": {
"enum": [
"off_api",
"off_mirror"
],
"type": "string",
"description": "Where this answer was read: \"off_api\", Open Food Facts itself, or \"off_mirror\", this server's local copy of the Open Food Facts export, which serves a search by tag filters alone on a deployment that keeps one."
},
"omitted": {
"type": "number",
"description": "Matches on this page left off because Open Food Facts stores them under a code it cannot serve (not 4–40 digits once leading zeros are stripped), so off_get_product could not look them up either. Absent when none was. total still counts them."
},
"products": {
"type": "array",
"items": {
"type": "object",
"required": [
"barcode"
],
"properties": {
"brands": {
"type": "string",
"description": "Brand name(s), comma-separated. Absent when not yet entered."
},
"barcode": {
"type": "string",
"description": "Product barcode, 4–40 digits after any leading zeros — a code off_get_product accepts as is, so pass it there for full details. A match stored under a code Open Food Facts cannot serve is left off the page."
},
"nova_group": {
"type": "number",
"description": "NOVA processing class (1–4). Absent when not assigned."
},
"product_name": {
"type": "string",
"description": "Product name. May be absent for incompletely entered products."
},
"ecoscore_grade": {
"type": "string",
"description": "Green-Score environmental impact grade: \"a-plus\" (lowest impact), then \"a\" through \"f\"; \"unknown\" when the data it needs is missing, or \"not-applicable\" for product categories the score does not cover. Absent when Open Food Facts sent none."
},
"categories_tags": {
"type": "array",
"items": {
"type": "string",
"description": "Canonical category tag ID (e.g. \"en:cheeses\")."
},
"description": "Category tag IDs in canonical form. Use as filter values for off_search_products."
},
"nutriscore_grade": {
"type": "string",
"description": "Nutri-Score grade: \"a\" through \"e\", \"unknown\" when the nutrition data entered is not enough to compute it, or \"not-applicable\" for product categories the score does not cover. Absent when Open Food Facts sent none."
},
"indexed_nutriments": {
"type": "object",
"properties": {
"fat_100g": {
"type": "number",
"description": "Fat in g per 100 g, or per 100 ml for liquids, as the text index holds it. Absent when this nutrient was not constrained or the index holds no value for it."
},
"salt_100g": {
"type": "number",
"description": "Salt in g per 100 g, or per 100 ml for liquids, as the text index holds it. Absent when this nutrient was not constrained or the index holds no value for it."
},
"fiber_100g": {
"type": "number",
"description": "Fiber in g per 100 g, or per 100 ml for liquids, as the text index holds it. Absent when this nutrient was not constrained or the index holds no value for it."
},
"sodium_100g": {
"type": "number",
"description": "Sodium in g per 100 g, or per 100 ml for liquids, as the text index holds it. Absent when this nutrient was not constrained or the index holds no value for it."
},
"sugars_100g": {
"type": "number",
"description": "Sugars in g per 100 g, or per 100 ml for liquids, as the text index holds it. Absent when this nutrient was not constrained or the index holds no value for it."
},
"proteins_100g": {
"type": "number",
"description": "Proteins in g per 100 g, or per 100 ml for liquids, as the text index holds it. Absent when this nutrient was not constrained or the index holds no value for it."
},
"energy_kcal_100g": {
"type": "number",
"description": "Energy in kcal per 100 g, or per 100 ml for liquids, as the text index holds it. Absent when this nutrient was not constrained or the index holds no value for it."
},
"carbohydrates_100g": {
"type": "number",
"description": "Carbohydrates in g per 100 g, or per 100 ml for liquids, as the text index holds it. Absent when this nutrient was not constrained or the index holds no value for it."
},
"saturated_fat_100g": {
"type": "number",
"description": "Saturated fat in g per 100 g, or per 100 ml for liquids, as the text index holds it. Absent when this nutrient was not constrained or the index holds no value for it."
}
},
"description": "Present on every row of a search carrying nutrient_filters, and only there: the values the text index holds for the constrained nutrients, per 100 g, or per 100 ml for liquids — the values the filters were checked against. Keyed as off_get_product keys them (sugars_100g, energy_kcal_100g). A nutrient the index holds no value for is left out, never zero-filled, so the object can be empty, and it does not count against the row. off_get_product returns the current record, whose values can differ.",
"additionalProperties": false
}
},
"description": "A single matching product summary row.",
"additionalProperties": false
},
"description": "Matching products. Use barcodes with off_get_product for full label data."
},
"last_page": {
"type": "number",
"description": "Deepest page of this result set that holds products and can be requested, at the page_size served — capped at page 10 on a search by tag filters alone that read the live database, by the 10000-result window on a search the text index answers, and by the local copy's 10000-result window when source is \"off_mirror\". Absent when total_is_lower_bound is true — the total it would divide is the ceiling the backend stopped counting at, so no exact last page exists — and when nothing matched at all. On a search constraining a whole-number nutrient it counts pages of the whole-number answer, so a page up to it can list few products or none."
},
"page_size": {
"type": "number",
"description": "The page_size served: the one requested, or 100 when a larger one was requested. page and last_page count pages of this size."
},
"truncated": {
"type": "boolean",
"description": "True when more results exist beyond this page. Absent on the final page of a result set."
},
"page_count": {
"type": "number",
"description": "Products returned on this page — page_size except on the last page, or when a match stored under a code Open Food Facts cannot serve or a row outside nutrient_filters was left off. Not the total number of pages."
},
"mirror_as_of": {
"type": "string",
"description": "ISO 8601 time up to which the local copy reflects every product contributed or edited on Open Food Facts. Present only when source is \"off_mirror\"."
},
"mirror_snapshot": {
"type": "string",
"description": "Present only when source is \"off_mirror\". States that the results come from the local copy as of mirror_as_of, so a product contributed or edited since is missing or shown as it was, and, under the default order or a popularity_key or unique_scans_n sort, that the order follows the values stored with each record and can differ from a live search."
},
"page_size_capped": {
"type": "string",
"description": "Present only when page_size was above 100: names the page_size requested and the 100 served, and, when a further page holds matches and can be requested, the page to request next and the results it holds."
},
"exclusion_coverage": {
"type": "string",
"description": "Present only on searches carrying exclude_allergens or exclude_traces. States that products with no allergen or trace data entered pass an exclusion, so a result is not confirmed free of the excluded allergens, and names the off_get_product fields to check."
},
"outside_constraints": {
"type": "number",
"description": "Rows the text index returned on this page that fail nutrient_filters on their indexed values, compared at the 32-bit precision the index uses, and so left off. The index returns them because it compares some nutrients as whole numbers. Separate from omitted, whose rows are matches; a row both unservable and outside counts only in omitted. total, total_is_lower_bound, and last_page still count these rows, and each page keeps its place in the result set. Absent when none was."
},
"text_index_snapshot": {
"type": "string",
"description": "Present only on searches the text backend answered. States that those results come from an index snapshot that lags the live Open Food Facts database, so a recently contributed product can be missing from them while the tag-only path still returns it. On a search carrying nutrition_grade, nova_group, or ecoscore_grade it also says those filters were matched against the grades the index holds, which each row shows and which can differ from what off_get_product returns. On a search carrying nutrient_filters it also echoes the constraints and says they were checked against the index values each row carries as indexed_nutriments, which can differ from what off_get_product returns. When a constraint falls on a whole-number nutrient (see nutrient_filters) it also says that total, total_is_lower_bound, and last_page describe the whole-number answer and that rows outside the constraints count in outside_constraints. Absent on tag-only searches, which read the live database or, when source is \"off_mirror\", the local copy mirror_snapshot describes."
},
"total_is_lower_bound": {
"type": "boolean",
"description": "True when the backend stopped counting at its ceiling and total is a floor, not the match total. Only text searches can hit it; add filters to bring the result set under the ceiling and get an exact count. On a search constraining a whole-number nutrient the floor is on the whole-number answer, not on the products that meet the constraints."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"openWorldHint": true,
"idempotentHint": true
}
}Side-by-side nutrition and scoring comparison for 2–10 products per call by barcode; a repeated barcode is compared once, so two identical barcodes yield one row, and barcodes past the 10th distinct one are listed in unprocessed rather than fetched. Returns a normalized table of energy (kcal), fat, saturated fat, carbohydrates, sugars, salt, protein, and fiber per 100 g, or per 100 ml for liquids, plus Nutri-Score, NOVA group, and Green-Score. Open Food Facts returns one preparation state per read, so figures for the prepared product arrive in a prepared object on the row, with the same columns and basis, and never fill an as-sold field; a row whose read returned only prepared figures gets one more product read, of the as-sold set its record stores, once the read of every barcode has settled, with stored_as_sold saying how it went. Designed for "which of these cereals is healthiest?" or "compare these pasta brands" workflows. Missing nutrition data for any product is preserved as absent — comparisons are not imputed. A batch is not all-or-nothing: barcodes that resolve are returned even when others fail, with confirmed-missing barcodes listed in not_found and failed fetches listed separately in failed. Scores carry regional formula caveats. Data under ODbL 1.0 — cite Open Food Facts in downstream use.
| Parameter | Type | Description |
|---|---|---|
| barcodes * | array | Barcodes to compare, returned as one row each in input order; a repeated barcode is compared once, so two identical barcodes yield one row. One call compares at most 10 distinct barcodes: up to 100 are accepted, and those past the 10th distinct one are returned in unprocessed without being fetched. … |
{
"name": "off_compare_products",
"title": "Compare Food Products Side-by-Side",
"description": "Side-by-side nutrition and scoring comparison for 2–10 products per call by barcode; a repeated barcode is compared once, so two identical barcodes yield one row, and barcodes past the 10th distinct one are listed in unprocessed rather than fetched. Returns a normalized table of energy (kcal), fat, saturated fat, carbohydrates, sugars, salt, protein, and fiber per 100 g, or per 100 ml for liquids, plus Nutri-Score, NOVA group, and Green-Score. Open Food Facts returns one preparation state per read, so figures for the prepared product arrive in a prepared object on the row, with the same columns and basis, and never fill an as-sold field; a row whose read returned only prepared figures gets one more product read, of the as-sold set its record stores, once the read of every barcode has settled, with stored_as_sold saying how it went. Designed for \"which of these cereals is healthiest?\" or \"compare these pasta brands\" workflows. Missing nutrition data for any product is preserved as absent — comparisons are not imputed. A batch is not all-or-nothing: barcodes that resolve are returned even when others fail, with confirmed-missing barcodes listed in not_found and failed fetches listed separately in failed. Scores carry regional formula caveats. Data under ODbL 1.0 — cite Open Food Facts in downstream use.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"barcodes"
],
"properties": {
"barcodes": {
"type": "array",
"items": {
"type": "string",
"pattern": "^0*[1-9]\\d{3,39}$",
"description": "Product barcode, digits only: 4–40 digits after any leading zeros."
},
"maxItems": 100,
"minItems": 2,
"description": "Barcodes to compare, returned as one row each in input order; a repeated barcode is compared once, so two identical barcodes yield one row. One call compares at most 10 distinct barcodes: up to 100 are accepted, and those past the 10th distinct one are returned in unprocessed without being fetched. Example: [\"3017620422003\", \"7622210100146\"]."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"products",
"succeeded",
"not_found"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"upstream_error",
"upstream_timeout",
"upstream_rejected",
"rate_limited"
],
"description": "Machine-readable failure mode. Declared by this tool: `upstream_error`: Open Food Facts returns a 5xx other than 501 or 504, serves an HTML error page with a 2xx or 5xx status, answers 2xx with a malformed envelope, closes the connection before finishing its answer, or is unreachable for a barcode — reported in that barcode's failed entry rather than failing the call. `upstream_timeout`: Open Food Facts did not answer a barcode within the request or retry deadline, or answered 408, 425, or 504 — reported in that barcode's failed entry rather than failing the call. `upstream_rejected`: Open Food Facts refuses a barcode with a 4xx other than 404, 408, 425, or 429, or with 501 Not Implemented — reported in that barcode's failed entry rather than failing the call. `rate_limited`: This server's own per-minute product budget is spent, or Open Food Facts answers 429 — reported in that barcode's failed entry rather than failing the call. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"failed": {
"type": "array",
"items": {
"type": "object",
"required": [
"barcode",
"reason",
"error"
],
"properties": {
"error": {
"type": "string",
"description": "What went wrong for this barcode and what to do about it."
},
"reason": {
"type": "string",
"description": "Declared failure reason — one of upstream_error, upstream_timeout, upstream_rejected, rate_limited."
},
"barcode": {
"type": "string",
"description": "Barcode whose fetch failed, as provided in input."
},
"retryAfter": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "Whole seconds to wait before retrying this barcode: the time until this server's own product budget frees a slot, or the Retry-After Open Food Facts sent with a 429. Absent when the failure named no wait."
}
},
"description": "A single barcode whose fetch failed.",
"additionalProperties": false
},
"description": "Barcodes whose fetch failed, with the per-barcode reason. Absent when every fetch completed. A barcode listed here is unknown, not absent from Open Food Facts — retry it with off_get_product before concluding anything about the product. A stored as-sold set that could not be read is not a failed fetch: it stays on its row as stored_as_sold."
},
"products": {
"type": "array",
"items": {
"type": "object",
"required": [
"barcode",
"found"
],
"properties": {
"found": {
"type": "boolean",
"description": "False if the barcode has no contributor record."
},
"brands": {
"type": "string",
"description": "Brand name(s), comma-separated. Absent when not yet entered."
},
"source": {
"enum": [
"off_api",
"off_mirror"
],
"type": "string",
"description": "Where this row was read: \"off_api\", Open Food Facts itself, or \"off_mirror\", this server's local copy of the Open Food Facts export, which serves a barcode it holds on a deployment that keeps one, so one comparison can mix the two. The stored as-sold read behind stored_as_sold, when one runs, reads the same source. Present on every row whose found is true."
},
"barcode": {
"type": "string",
"description": "Barcode, echoed exactly as provided in input."
},
"fat_100g": {
"type": "number",
"description": "Total fat in grams per 100 g, or per 100 ml for liquids, as sold. When the product read returned only prepared figures, read from the record's stored as-sold set instead (see stored_as_sold). Absent when not entered, or when that stored set was not read."
},
"prepared": {
"type": "object",
"properties": {
"fat_100g": {
"type": "number",
"description": "Total fat in grams per 100 g, or per 100 ml for liquids, as prepared. Absent when this read returned no such figure."
},
"salt_100g": {
"type": "number",
"description": "Salt in grams per 100 g, or per 100 ml for liquids, as prepared. Absent when this read returned no such figure."
},
"fiber_100g": {
"type": "number",
"description": "Dietary fiber in grams per 100 g, or per 100 ml for liquids, as prepared. Absent when this read returned no such figure."
},
"sugars_100g": {
"type": "number",
"description": "Total sugars in grams per 100 g, or per 100 ml for liquids, as prepared. Absent when this read returned no such figure."
},
"proteins_100g": {
"type": "number",
"description": "Protein in grams per 100 g, or per 100 ml for liquids, as prepared. Absent when this read returned no such figure."
},
"energy_kcal_100g": {
"type": "number",
"description": "Energy in kcal per 100 g, or per 100 ml for liquids, as prepared. Absent when this read returned no such figure."
},
"carbohydrates_100g": {
"type": "number",
"description": "Total carbohydrates in grams per 100 g, or per 100 ml for liquids, as prepared. Absent when this read returned no such figure."
},
"saturated_fat_100g": {
"type": "number",
"description": "Saturated fat in grams per 100 g, or per 100 ml for liquids, as prepared. Absent when this read returned no such figure."
}
},
"description": "Figures for the prepared product, on the same columns and basis as the as-sold fields, read from Open Food Facts' *_prepared_100g keys and never derived or substituted for an as-sold figure. Open Food Facts returns one preparation state per read, so when the product read returned only prepared figures the record's stored as-sold set is read for the as-sold fields, and stored_as_sold says how that went. Absent when the read carried none of these figures.",
"additionalProperties": false
},
"salt_100g": {
"type": "number",
"description": "Salt in grams per 100 g, or per 100 ml for liquids, as sold. When the product read returned only prepared figures, read from the record's stored as-sold set instead (see stored_as_sold). Absent when not entered, or when that stored set was not read."
},
"fiber_100g": {
"type": "number",
"description": "Dietary fiber in grams per 100 g, or per 100 ml for liquids, as sold. When the product read returned only prepared figures, read from the record's stored as-sold set instead (see stored_as_sold). Absent when not entered, or when that stored set was not read."
},
"nova_group": {
"type": "number",
"description": "NOVA processing class (1–4). Absent when not assigned."
},
"sugars_100g": {
"type": "number",
"description": "Total sugars in grams per 100 g, or per 100 ml for liquids, as sold. When the product read returned only prepared figures, read from the record's stored as-sold set instead (see stored_as_sold). Absent when not entered, or when that stored set was not read."
},
"completeness": {
"type": "number",
"description": "Data completeness 0–1. Low values mean many fields are missing."
},
"mirror_as_of": {
"type": "string",
"description": "ISO 8601 time up to which the local copy reflects every product contributed or edited on Open Food Facts. Present only when source is \"off_mirror\"."
},
"product_name": {
"type": "string",
"description": "Product name. Absent when not yet entered by contributors."
},
"proteins_100g": {
"type": "number",
"description": "Protein in grams per 100 g, or per 100 ml for liquids, as sold. When the product read returned only prepared figures, read from the record's stored as-sold set instead (see stored_as_sold). Absent when not entered, or when that stored set was not read."
},
"ecoscore_grade": {
"type": "string",
"description": "Green-Score (formerly Eco-Score) environmental impact grade: \"a-plus\" (lowest impact), then \"a\" through \"f\"; \"unknown\" when the data it needs is missing, or \"not-applicable\" for product categories the score does not cover. Often absent."
},
"stored_as_sold": {
"oneOf": [
{
"type": "object",
"required": [
"status"
],
"properties": {
"status": {
"type": "string",
"const": "read",
"description": "One stored as-sold set was read into the as-sold fields."
}
},
"description": "The as-sold fields hold one stored set, never merged: per 100 g, or per 100 ml for liquids, when the record stores it so, else a serving of at least 5 g or ml scaled to 100 as Open Food Facts scales it, from the manufacturer, packaging, USDA, or another non-estimate source, in that order. Each nutrient is the entered value, or the one Open Food Facts computed when none was entered; IU and % DV figures are left out.",
"additionalProperties": false
},
{
"type": "object",
"required": [
"status"
],
"properties": {
"status": {
"type": "string",
"const": "none",
"description": "The record stores no as-sold set the as-sold fields can be read from."
}
},
"description": "Open Food Facts stores no entered as-sold figures for it that can be given per 100 g, or per 100 ml for liquids: the record stores no sets, or only prepared ones, ones estimated from the ingredients, servings under 5 g or ml, or figures in units that do not convert. The as-sold fields stay absent because nothing is entered.",
"additionalProperties": false
},
{
"type": "object",
"required": [
"status",
"reason",
"error"
],
"properties": {
"error": {
"type": "string",
"description": "What went wrong reading the stored sets and what to do about it."
},
"reason": {
"type": "string",
"description": "Declared failure reason — one of upstream_error, upstream_timeout, upstream_rejected, rate_limited."
},
"status": {
"type": "string",
"const": "unread",
"description": "The stored sets could not be read; the call itself succeeded."
},
"retryAfter": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "Whole seconds to wait before reading again: the time until this server's own product budget frees a slot, or the Retry-After Open Food Facts sent with a 429. Absent when the failure named no wait."
}
},
"description": "The as-sold figures the record can still hold were not read, so the prepared figures are all this call holds. Never a failed call.",
"additionalProperties": false
}
],
"description": "How the read of the record's stored as-sold figures went for this row. Present only when its product read returned prepared figures and no as-sold one, which is when that second read of the record's stored nutrition sets runs (Open Food Facts serves one preparation state per product read, and prepared wins)."
},
"energy_kcal_100g": {
"type": "number",
"description": "Energy in kcal per 100 g, or per 100 ml for liquids, as sold. When the product read returned only prepared figures, read from the record's stored as-sold set instead (see stored_as_sold). Absent when not entered, or when that stored set was not read."
},
"nutriscore_grade": {
"type": "string",
"description": "Nutri-Score grade: \"a\" through \"e\", \"unknown\" when the nutrition data entered is not enough to compute it, or \"not-applicable\" for product categories the score does not cover. Absent when Open Food Facts sent none."
},
"carbohydrates_100g": {
"type": "number",
"description": "Total carbohydrates in grams per 100 g, or per 100 ml for liquids, as sold. When the product read returned only prepared figures, read from the record's stored as-sold set instead (see stored_as_sold). Absent when not entered, or when that stored set was not read."
},
"saturated_fat_100g": {
"type": "number",
"description": "Saturated fat in grams per 100 g, or per 100 ml for liquids, as sold. When the product read returned only prepared figures, read from the record's stored as-sold set instead (see stored_as_sold). Absent when not entered, or when that stored set was not read."
}
},
"description": "A single product comparison row.",
"additionalProperties": false
},
"description": "Comparison rows in input order — one per distinct barcode whose fetch completed, whether or not a record exists. Barcodes whose fetch failed have no row here; they appear in failed. Barcodes past the cap appear in unprocessed."
},
"not_found": {
"type": "array",
"items": {
"type": "string",
"description": "Barcode with no contributor record, as provided in input."
},
"description": "Barcodes Open Food Facts answered for, confirming no contributor record exists. Not an error — the product may exist but not yet be entered. Never used for a fetch that failed."
},
"succeeded": {
"type": "number",
"description": "Number of barcodes that resolved to a found product."
},
"unprocessed": {
"type": "array",
"items": {
"type": "string",
"description": "Barcode left unprocessed, as provided in input."
},
"description": "Distinct barcodes past the 10th, in input order — never fetched, so nothing is known about them. Absent when the batch held 10 or fewer distinct barcodes. Compare them in another off_compare_products call (2–10 barcodes), or look a single one up with off_get_product."
},
"mirror_snapshot": {
"type": "string",
"description": "Present only when a row's source is \"off_mirror\". States that those rows come from the local copy as of their mirror_as_of, so an edit made to them since then is not reflected."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"openWorldHint": true,
"idempotentHint": true
}
}Resolve a human term to the canonical Open Food Facts tag ID that off_search_products filters on. Covers categories, labels/certifications, allergens, additives, countries, ingredients, NOVA groups, and Nutri-Score grades. Pass a search term to resolve against the Open Food Facts vocabulary, which holds tens of thousands of tags; omitting it returns only a small reference list for each facet except NOVA groups and Nutri-Score grades, which are complete, and ingredients, which has no reference list and returns nothing. Most tag IDs use the "en:" prefix (e.g. "en:organic", "en:no-gluten", "en:crustaceans"); NOVA groups return bare digits "1"-"4" and Nutri-Score grades bare letters "a"-"e". Pass the id through to off_search_products exactly as returned. Category tags are frequently plural ("kombucha" resolves to "en:kombuchas") and ingredient tags singular ("oat" resolves to "en:oat", "oats" to nothing), so use the returned id rather than constructing one.
| Parameter | Type | Description |
|---|---|---|
| facet * | string | "categories" covers food categories (en:cheeses, en:breakfast-cereals). "labels" covers certifications (en:organic, en:fair-trade). "allergens" covers declared allergens (en:milk, en:gluten). "additives" covers E-numbers (en:e322). "countries" covers country-of-sale tags (en:france). "ingredients" c… |
| limit | number | Maximum entries to return (default 20). One call returns at most 200: a larger value returns the first 200 and, when more matched, says how many did. There is no offset or page input: Open Food Facts offers no cursor for this lookup, so narrow the search term rather than paging. The tag the term its… |
| search | string | Term to resolve. Matched case-insensitively as a substring of the tag ID, the display name, or a common synonym of either ("shellfish" resolves to en:crustaceans, "gluten free" to en:no-gluten); the tag the term itself names leads the list even when neither its ID nor its name contains the term as t… |
{
"name": "off_browse_taxonomy",
"title": "Browse Food Facts Taxonomy",
"description": "Resolve a human term to the canonical Open Food Facts tag ID that off_search_products filters on. Covers categories, labels/certifications, allergens, additives, countries, ingredients, NOVA groups, and Nutri-Score grades. Pass a search term to resolve against the Open Food Facts vocabulary, which holds tens of thousands of tags; omitting it returns only a small reference list for each facet except NOVA groups and Nutri-Score grades, which are complete, and ingredients, which has no reference list and returns nothing. Most tag IDs use the \"en:\" prefix (e.g. \"en:organic\", \"en:no-gluten\", \"en:crustaceans\"); NOVA groups return bare digits \"1\"-\"4\" and Nutri-Score grades bare letters \"a\"-\"e\". Pass the id through to off_search_products exactly as returned. Category tags are frequently plural (\"kombucha\" resolves to \"en:kombuchas\") and ingredient tags singular (\"oat\" resolves to \"en:oat\", \"oats\" to nothing), so use the returned id rather than constructing one.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"facet"
],
"properties": {
"facet": {
"enum": [
"categories",
"labels",
"allergens",
"additives",
"countries",
"ingredients",
"nova_groups",
"nutrition_grades"
],
"type": "string",
"description": "\"categories\" covers food categories (en:cheeses, en:breakfast-cereals). \"labels\" covers certifications (en:organic, en:fair-trade). \"allergens\" covers declared allergens (en:milk, en:gluten). \"additives\" covers E-numbers (en:e322). \"countries\" covers country-of-sale tags (en:france). \"ingredients\" covers the ingredients Open Food Facts parses from ingredient lists (en:inulin, en:oat); it has no reference list, so pass a search term. \"nova_groups\" and \"nutrition_grades\" are closed vocabularies returned complete; the other six are resolved against the Open Food Facts taxonomy."
},
"limit": {
"type": "number",
"default": 20,
"minimum": 1,
"multipleOf": 1,
"description": "Maximum entries to return (default 20). One call returns at most 200: a larger value returns the first 200 and, when more matched, says how many did. There is no offset or page input: Open Food Facts offers no cursor for this lookup, so narrow the search term rather than paging. The tag the term itself names (e.g. \"lentil\" → en:lentils, \"US\" → en:united-states) is listed first, so it is not the one a small limit cuts."
},
"search": {
"type": "string",
"description": "Term to resolve. Matched case-insensitively as a substring of the tag ID, the display name, or a common synonym of either (\"shellfish\" resolves to en:crustaceans, \"gluten free\" to en:no-gluten); the tag the term itself names leads the list even when neither its ID nor its name contains the term as typed (\"plant based milk alternatives\" → en:plant-based-milk-alternatives). A single word works best (\"hummus\", not \"hummus dip\"). Omit only to see a small reference list (none for ingredients) — Open Food Facts cannot list the full vocabulary without a term, so an unfiltered call is not a view of the full facet."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"facet",
"tags"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"cap": {
"type": "number",
"description": "The limit that was applied — at most 200."
},
"tags": {
"type": "array",
"items": {
"type": "object",
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "string",
"description": "Canonical tag ID (e.g. \"en:organic\"; bare \"1\"–\"4\" for NOVA groups, bare \"a\"–\"e\" for Nutri-Score grades). Pass this value through to the matching off_search_products filter parameter unchanged."
},
"name": {
"type": "string",
"description": "Human-readable display name (e.g. \"Organic\")."
}
},
"description": "A single taxonomy tag entry with its canonical ID and display name.",
"additionalProperties": false
},
"description": "Matching tag entries."
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"description": "Machine-readable failure mode."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"facet": {
"type": "string",
"description": "The facet name that was queried (echoes the input)."
},
"shown": {
"type": "number",
"description": "Number of tags returned."
},
"notice": {
"type": "string",
"description": "Caveat about the answer — that the listing is a limited reference list rather than the full vocabulary, or that ingredients, which has none, needs a search term, that the live vocabulary went unchecked and why (unreachable or no usable answer, Open Food Facts rate-limiting this server, or this server's own taxonomy budget spent, with the wait in seconds when one is known), that nothing matched and why, or that the limit cut matches, naming how many matched and the next call: a larger limit while one would list more, otherwise a narrower term, which is the only route past the first 200 (a limit above 200 is named too)."
},
"truncated": {
"type": "boolean",
"description": "True when more tags exist beyond the limit."
},
"total_in_facet": {
"type": "number",
"description": "Total entries in this facet. Present only for nova_groups and nutrition_grades, whose vocabularies are closed and complete. Absent for the other facets: Open Food Facts reports no match total and cannot enumerate them, so no figure would be a real one."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"openWorldHint": true,
"idempotentHint": true
}
}Query Open Food Facts, a free crowd-sourced database of 3M+ packaged foods: off_get_product looks up one product by barcode (4–40 digits), off_search_products finds products by text or tag filters, off_compare_products puts several side by side on nutrition, and off_browse_taxonomy resolves a human term to the canonical tag ID the other tools filter on — so start there when you have a category or label rather than a barcode. Every field is contributor-entered, so a missing one means "not yet recorded" rather than absent, except that a product read returning only prepared-product nutrition is followed by a read of the as-sold figures the record stores, reported as stored_as_sold, and the computed Nutri-Score, NOVA, and Green-Score grades carry regional caveats. No API key is required; the data is ODbL 1.0, so cite Open Food Facts wherever you pass it on.
Names, descriptions and schemas were written by the server and are shown as data.
Shared addresses on big platforms (Cloudflare, Vercel and the like) put unrelated servers together; those are marked shared_infrastructure. A match is a pivot, not a link between operators.
| traces_tag | string | Canonical allergen tag ID the label warns the product may contain as a trace ("may contain nuts"). Example: "en:nuts". Trace tags are allergen tags, so off_browse_taxonomy with facet="allergens" resolves them. Selects products carrying the warning; to leave them out, use exclude_traces. |
| additives_tag | string | Canonical additive (E-number) tag ID. Example: "en:e322", "en:e330". Use off_browse_taxonomy with facet="additives". Available only on searches carrying none of query, nutrient_filters, or ingredients_tag — each routes to a backend with no additives field, so combining them is rejected instead of si… |
| allergens_tag | string | Canonical allergen tag ID. Example: "en:milk", "en:gluten". Use off_browse_taxonomy with facet="allergens". Selects products that declare this allergen; it cannot select allergen-free products, because a product with no allergen tags may simply have none entered yet. To leave an allergen out, use ex… |
| countries_tag | string | Canonical country tag ID. Example: "en:france", "en:united-states". Filters to products sold in that country. |
| categories_tag | string | Canonical category tag ID. Example: "en:breakfast-cereals", "en:cheeses". Use off_browse_taxonomy with facet="categories" to discover valid values. |
| ecoscore_grade | any | Filter by Green-Score (environmental impact) grade, or an array of grades matching any of them: "a-plus" is the lowest impact, then "a" through "f". "a" does not include "a-plus", so ask for ["a-plus", "a"] for A or better. A product carries one grade, so an array matches products graded any of its … |
| exclude_traces | array | Allergen tag IDs a product's label must not warn it may contain as traces, all applied. Example: ["en:nuts"]. Values are validated like exclude_allergens. A product with no trace data entered passes, so check a candidate with off_get_product before relying on it. |
| ingredients_tag | any | Canonical ingredient tag ID, or an array of up to 10 that must all appear among the ingredients Open Food Facts parsed from the label. Example: "en:inulin", or ["en:inulin", "en:oat"] for products listing both. IDs are singular ("en:oat", not "en:oats"); use off_browse_taxonomy with facet="ingredien… |
| nutrition_grade | any | Filter by Nutri-Score grade, or an array of grades matching any of them. "a" is highest nutritional quality, "e" is lowest. Example: "a", or ["a", "b"] for B or better. A product carries one grade, so an array matches products graded any of its values, unlike labels_tag, whose values must all apply.… |
| nutrient_filters | array | Numeric constraints on nutrient values per 100 g, or per 100 ml for liquids, combined as AND with each other and with every other filter. Pair two entries on the same nutrient to express a range (e.g. sugars gte 2 and sugars lte 8). Served only by the text backend, so supplying one routes the search… |
| exclude_allergens | array | Allergen tag IDs a product must not declare, all applied. Example: ["en:nuts", "en:peanuts"]. Each value must be an allergen tag Open Food Facts recognizes — resolve it with off_browse_taxonomy facet="allergens" — and one it does not recognize is rejected rather than sent, because it would exclude n… |
| ingredients_analysis_tag | string | Vegan, vegetarian, or palm-oil verdict Open Food Facts computes from the parsed ingredients. Example: "en:vegan", "en:palm-oil-free". "en:maybe-vegan" and "en:may-contain-palm-oil" mean the ingredients could not settle it, and the "-unknown" values mean no verdict could be computed. |