@openfoodfacts/openfoodfacts-nodejs
    Preparing search index...

    Class OpenFoodFacts

    Wrapper of OFF API

    Index

    Constructors

    • Create OFF object

      Parameters

      • fetch: {
            (input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
            (input: string | Request | URL, init?: RequestInit): Promise<Response>;
        }

        Fetch implementation to use

          • (input: RequestInfo | URL, init?: RequestInit): Promise<Response>
          • Parameters

            • input: RequestInfo | URL
            • Optionalinit: RequestInit

            Returns Promise<Response>

          • (input: string | Request | URL, init?: RequestInit): Promise<Response>
          • Parameters

            • input: string | Request | URL
            • Optionalinit: RequestInit

            Returns Promise<Response>

      • options: OpenFoodFactsOptions = ...

        Options for the OFF Object

      Returns OpenFoodFacts

    Properties

    rawV2: Client<paths>
    rawV3: Client<paths>
    robotoff: Robotoff

    Robotoff API

    Methods

    • Adds or edits a product using the V2 API

      Parameters

      • product: ProductDataSection & {
            _id: string;
            _keywords: string[];
            additives_n: number;
            additives_tags: string[];
            brands: string;
            brands_tags: string[];
            categories: string;
            categories_hierarchy: object[];
            categories_tags: string[];
            code: string;
            countries: string;
            countries_tags: string[];
            ecoscore_grade: string;
            emb_codes: string;
            emb_codes_tags: string[];
            image_front_small_url: string;
            image_front_url: string;
            image_ingredients_small_url: string;
            image_ingredients_thumb_url: string;
            image_ingredients_url: string;
            image_nutrition_small_url: string;
            image_nutrition_thumb_url: string;
            image_nutrition_url: string;
            images: Record<string, SelectedImage | RawImage>;
            ingredients: {
                id: string;
                percent: number;
                percent_estimate: number;
                percent_max: number;
                percent_min: number;
                text: string;
                vegan: string;
                vegetarian: string;
            }[];
            ingredients_text: string;
            knowledge_panels: Record<string, any>;
            labels: string;
            labels_tags: string[];
            lang: string;
            languages_codes: { [lang: string]: number };
            link: string;
            manufacturing_places: string;
            no_nutrition_data?: boolean;
            nova_group: number;
            nutriments: any;
            nutriscore_grade: string;
            origins: string;
            origins_tags: string[];
            packaging: string;
            product_name: string;
            product_type: string;
            quantity: string;
            serving_size: string;
            source: {
                fields: string[];
                id: string;
                images: object[];
                import_t: number;
                manufacturer: string | number;
                name: string;
                source_licence: string;
                source_licence_url: string;
                url?: string;
            };
            stores: string;
            stores_tags: string[];
            [lang: `product_name_${string}`]: string;
            [lang: `ingredients_text_${string}`]: string;
        } & { comment?: string }

        The product data to add or edit

      • Optionalcredentials: { password: string; username: string }

        Optional credentials for authentication

      Returns Promise<boolean>

      A promise that resolves to true if successful, false otherwise

    • Crops and selects an image for a product

      Parameters

      • barcode: string

        The barcode of the product

      • imgid: number

        Identifier of the image to select (should be a number)

      • id: string

        Identifier of the selected image field (format: {IMAGE_TYPE}_{LANG})

      • cropData: {
            angle?: number;
            app_name?: string;
            app_uuid?: string;
            app_version?: string;
            comment?: string;
            normalize?: boolean;
            user_agent?: string;
            white_magic?: boolean;
            x1: number;
            x2: number;
            y1: number;
            y2: number;
        }

        Crop coordinates and options

      Returns Promise<{ imagefield?: string; imgid?: number; status?: string }>

      A promise that resolves to the crop response

    • Deletes an uploaded image for a product

      Parameters

      • barcode: string

        The barcode of the product corresponding to the image

      • imgid: number

        The id of the image to be deleted

      Returns Promise<
          {
              errors?: {
                  field?: { id?: string; value?: string };
                  impact?: {
                      description?: string;
                      id?: string;
                      lc_description?: string;
                      lc_name?: string;
                      name?: string;
                  };
                  message?: {
                      description?: string;
                      id?: string;
                      lc_description?: string;
                      lc_name?: string;
                      name?: string;
                  };
              }[];
              result?: { id?: string; lc_name?: string; name?: string };
              status_id?:
                  | "success"
                  | "success_with_warnings"
                  | "success_with_errors"
                  | "failure";
              warnings?: {
                  field?: { id?: string; value?: string };
                  impact?: {
                      description?: string;
                      id?: string;
                      lc_description?: string;
                      lc_name?: string;
                      name?: string;
                  };
                  message?: {
                      description?: string;
                      id?: string;
                      lc_description?: string;
                      lc_name?: string;
                      name?: string;
                  };
              }[];
          },
      >

      A promise that resolves to the deletion response

    • Returns all available attribute groups

      Returns Promise<
          {
              attributes?: {
                  default?: | "mandatory"
                  | "very_important"
                  | "important"
                  | "not_important";
                  icon_url?: string;
                  id?: string;
                  name?: string;
                  panel_id?: string;
                  setting_name?: string;
                  setting_note?: string;
              }[];
              id?: string;
              name?: string;
          }[],
      >

      A promise that resolves to an array of attribute groups

    • Returns product attributes for a given barcode

      Parameters

      • barcode: string

        The barcode of the product

      Returns Promise<ProductAttribute[]>

      A promise that resolves to an array of product attributes

    • Returns an array of image names for the product

      Parameters

      • barcode: string

        The barcode of the product

      Returns Promise<null | string[]>

      A promise that resolves to an array of image names or null if not found

    • Returns only the product name for a given barcode

      Parameters

      • barcode: string

        The barcode of the product

      • Optionallang: string

        Optional language code for localization

      Returns Promise<null | Pick<ProductDataType, "product_name">>

      A promise that resolves to the product name or null if not found

    • Returns reduced product data suitable for displaying on cards

      Parameters

      • barcode: string

        The barcode of the product

      • Optionallang: string

        Optional language code for localization

      Returns Promise<ProductState<ProductReduced>>

      A promise that resolves to reduced product data

    • Returns product data using the V2 API

      Parameters

      • barcode: string

        The barcode of the product

      Returns Promise<
          | undefined
          | {
              abbreviated_product_name?: string;
              code?: string;
              codes_tags?: string[];
              generic_name?: string;
              id?: string;
              lang?: string;
              lc?: string;
              nova_group?: number;
              nova_groups?: string;
              obsolete?: string;
              obsolete_since_date?: string;
              product_name?: string;
              product_name_en?: string;
              product_quantity?: string;
              product_quantity_unit?: string;
              product_type?: "product"
              | "beauty"
              | "food"
              | "petfood";
              quantity?: string;
              schema_version?: number;
          } & {
              additives_n?: number;
              checked?: string;
              complete?: number;
              completeness?: number;
              ecoscore_grade?: string;
              ecoscore_score?: number;
              food_groups?: string;
              food_groups_tags?: string[];
              nutrient_levels?: {
                  fat?: "high"
                  | "low"
                  | "moderate";
                  salt?: "high" | "low" | "moderate";
                  "saturated-fat"?: "high" | "low" | "moderate";
                  sugars?: "high" | "low" | "moderate";
              };
              packaging_text?: string;
              packagings?: {
                  material?: { id?: string; lc_name?: string };
                  number_of_units?: number;
                  quantity_per_unit?: string;
                  quantity_per_unit_unit?: string;
                  quantity_per_unit_value?: number;
                  recycling?: { id?: string; lc_name?: string };
                  shape?: { id?: string; lc_name?: string };
                  weight?: number;
                  weight_estimated?: number;
                  weight_measured?: number;
                  weight_source_id?: string;
                  weight_specified?: number;
              }[];
              packagings_complete?: number;
              pnns_groups_1?: string;
              pnns_groups_1_tags?: string[];
              pnns_groups_2?: string;
              pnns_groups_2_tags?: string[];
              popularity_key?: number;
              popularity_tags?: string[];
              scans_n?: number;
              serving_quantity?: string;
              serving_quantity_unit?: string;
              serving_size?: string;
              unique_scans_n?: number;
          } & {
              brands?: string;
              brands_hierarchy?: string[];
              brands_lc?: string;
              brands_tags?: string[];
              categories?: string;
              categories_hierarchy?: string[];
              categories_lc?: string;
              categories_tags?: string[];
              checkers_tags?: string[];
              cities?: string;
              cities_tags?: Record<string, never>[];
              correctors_tags?: string[];
              countries?: string;
              countries_hierarchy?: string[];
              countries_lc?: string;
              countries_tags?: string[];
              ecoscore_tags?: string[];
              emb_codes?: string;
              emb_codes_orig?: string;
              emb_codes_tags?: Record<string, never>[];
              entry_dates_tags?: string[];
              labels?: string;
              labels_hierarchy?: string[];
              labels_lc?: string;
              labels_tags?: string[];
              manufacturing_places?: string;
              manufacturing_places_tags?: string[];
              nova_groups_tags?: string[];
              nutrient_levels_tags?: string[];
          } & {
              image_small_url?: string;
              image_thumb_url?: string;
              image_url?: string;
              images?: {
                  front?: {
                      angle?: number;
                      coordinates_image_size?: string;
                      geometry?: string;
                      imgid?: string;
                      normalize?: null
                      | string
                      | boolean;
                      rev?: string;
                      sizes?: { "100"?: ...; "200"?: ...; "400"?: ...; full?: ... };
                      white_magic?: null | string | boolean;
                      x1?: string;
                      x2?: string;
                      y1?: string;
                      y2?: string;
                  };
              } & {
                  [key: string]: {
                      sizes?: { full?: (...)
                      | (...) };
                      uploaded_t?: string;
                      uploader?: string;
                  };
              };
              last_image_dates_tags?: string[];
              last_image_t?: number;
              selected_images?: {
                  front?: {
                      display?: Record<string, never>;
                      small?: Record<string, never>;
                      thumb?: Record<string, never>;
                  };
              };
          } & {
              ecoscore_data?: {
                  adjustments?: {
                      origins_of_ingredients?: {
                          aggregated_origins?: (...)
                          | (...);
                          epi_score?: (...) | (...);
                          epi_value?: (...) | (...);
                          origins_from_categories?: (...) | (...);
                          origins_from_origins_field?: (...) | (...);
                          transportation_score?: (...) | (...);
                          transportation_scores?: (...) | (...);
                          transportation_value?: (...) | (...);
                          transportation_values?: (...) | (...);
                          value?: (...) | (...);
                          values?: (...) | (...);
                          warning?: (...) | (...);
                      };
                      packaging?: {
                          non_recyclable_and_non_biodegradable_materials?: (...)
                          | (...);
                          packagings?: (...) | (...);
                          score?: (...) | (...);
                          value?: (...) | (...);
                          warning?: (...) | (...);
                      };
                      production_system?: {
                          labels?: (...)
                          | (...);
                          value?: (...) | (...);
                          warning?: (...) | (...);
                      };
                      threatened_species?: {
                          ingredient?: (...)
                          | (...);
                          value?: (...) | (...);
                      };
                  };
                  agribalyse?: {
                      agribalyse_food_code?: string;
                      agribalyse_proxy_food_code?: string;
                      co2_agriculture?: number;
                      co2_consumption?: number;
                      co2_distribution?: number;
                      co2_packaging?: number;
                      co2_processing?: number;
                      co2_total?: number;
                      co2_transportation?: number;
                      code?: string;
                      dqr?: string;
                      ef_agriculture?: number;
                      ef_consumption?: number;
                      ef_distribution?: number;
                      ef_packaging?: number;
                      ef_processing?: number;
                      ef_total?: number;
                      ef_transportation?: number;
                      is_beverage?: number;
                      name_en?: string;
                      score?: number;
                      version?: string;
                  };
                  grade?: string;
                  grades?: Record<string, never>;
                  missing?: { labels?: number; origins?: number; packagings?: number };
                  missing_data_warning?: number;
                  previous_data?: {
                      agribalyse?: {
                          agribalyse_food_code?: (...) | (...);
                          agribalyse_proxy_food_code?: (...) | (...);
                          co2_agriculture?: (...) | (...);
                          co2_consumption?: (...) | (...);
                          co2_distribution?: (...) | (...);
                          co2_packaging?: (...) | (...);
                          co2_processing?: (...) | (...);
                          co2_total?: (...) | (...);
                          co2_transportation?: (...) | (...);
                          code?: (...) | (...);
                          dqr?: (...) | (...);
                          ef_agriculture?: (...) | (...);
                          ef_consumption?: (...) | (...);
                          ef_distribution?: (...) | (...);
                          ef_packaging?: (...) | (...);
                          ef_processing?: (...) | (...);
                          ef_total?: (...) | (...);
                          ef_transportation?: (...) | (...);
                          is_beverage?: (...) | (...);
                          name_en?: (...) | (...);
                          score?: (...) | (...);
                          version?: (...) | (...);
                      };
                      grade?: null
                      | string;
                      score?: null | number;
                  };
                  score?: number;
                  scores?: Record<string, never>;
                  status?: string;
              };
              ecoscore_extended_data_version?: string;
              environment_impact_level?: string;
              environment_impact_level_tags?: Record<string, never>[];
          } & {
              additives_tags?: string[];
              allergens?: string;
              allergens_hierarchy?: string[];
              allergens_lc?: string;
              allergens_tags?: string[];
              ingredients?: {
                  id?: string;
                  ingredients?: { id?: string | undefined; ingredients?: ...[] | undefined; percent?: number | undefined; percent_estimate?: number | undefined; percent_max?: string | number | undefined; percent_min?: number | undefined; text?: string | undefined; vegan?: string | undefined; vegetarian?: string | undefined; }[] | undefined;
                  percent?: number;
                  percent_estimate?: number;
                  percent_max?: string
                  | number;
                  percent_min?: number;
                  text?: string;
                  vegan?: string;
                  vegetarian?: string;
              }[];
              ingredients_analysis?: {
                  "en:palm-oil"?: string[];
                  "en:vegan-status-unknown"?: string[];
                  "en:vegetarian-status-unknown"?: string[];
              };
              ingredients_analysis_tags?: string[];
              ingredients_from_or_that_may_be_from_palm_oil_n?: number;
              ingredients_from_palm_oil_n?: number;
              ingredients_from_palm_oil_tags?: Record<string, never>[];
              ingredients_hierarchy?: string[];
              ingredients_lc?: string;
              ingredients_n?: number;
              ingredients_n_tags?: string[];
              ingredients_non_nutritive_sweeteners_n?: number;
              ingredients_original_tags?: string[];
              ingredients_percent_analysis?: number;
              ingredients_sweeteners_n?: number;
              ingredients_tags?: string[];
              ingredients_text?: string;
              ingredients_text_with_allergens?: string;
              ingredients_that_may_be_from_palm_oil_n?: number;
              ingredients_that_may_be_from_palm_oil_tags?: Record<string, never>[];
              ingredients_with_specified_percent_n?: number;
              ingredients_with_specified_percent_sum?: number;
              ingredients_with_unspecified_percent_n?: number;
              ingredients_with_unspecified_percent_sum?: number;
              known_ingredients_n?: number;
              origins?: string;
              origins_hierarchy?: Record<string, never>[];
              origins_lc?: string;
              origins_tags?: Record<string, never>[];
              traces?: string;
              traces_hierarchy?: (string | Record<string, never>)[];
              traces_lc?: string;
              traces_tags?: (string | Record<string, never>)[];
              unknown_ingredients_n?: number;
          } & {
              no_nutrition_data?: string;
              nutriments?: {
                  alcohol?: number;
                  carbohydrates?: number;
                  "carbohydrates-total"?: number;
                  "carbon-footprint-from-known-ingredients_product"?: number;
                  "carbon-footprint-from-known-ingredients_serving"?: number;
                  energy?: number;
                  energy_unit?: "kcal"
                  | "kJ";
                  energy_value?: number;
                  "energy-kcal"?: number;
                  "energy-kj"?: number;
                  erythritol?: number;
                  fat?: number;
                  "fruits-vegetables-legumes-estimate-from-ingredients"?: number;
                  "fruits-vegetables-nuts-estimate-from-ingredients"?: number;
                  "nova-group"?: number;
                  "nutrition-score-fr"?: unknown;
                  proteins?: number;
                  salt?: number;
                  "saturated-fat"?: number;
                  sodium?: number;
                  sugars?: number;
              };
              nutriscore_data?: {
                  saturated_fat_ratio?: number;
                  saturated_fat_ratio_points?: number;
                  saturated_fat_ratio_value?: number;
              };
              nutrition_data_per?: "serving"
              | "100g";
              nutrition_data_prepared_per?: "serving" | "100g";
              nutrition_grade_fr?: string;
              nutrition_grades?: string;
              nutrition_grades_tags?: string[];
              nutrition_score_beverage?: number;
              nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients?: number;
              nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value?: number;
              nutrition_score_warning_no_fiber?: number;
              other_nutritional_substances_tags?: Record<string, never>[];
              unknown_nutrients_tags?: Record<string, never>[];
              vitamins_tags?: Record<string, never>[];
          } & {
              nutriscore?: {
                  "2021"?: {
                      category_available?: 0
                      | 1;
                      grade?: "d" | "a" | "b" | "c" | "e";
                      nutrients_available?: 0 | 1;
                      nutriscore_applicable?: 0 | 1;
                      nutriscore_computed?: 0 | 1;
                      score?: number;
                  } & { data?: (...) & (...) & (...) };
                  "2023"?: {
                      category_available?: 0 | 1;
                      grade?: "d" | "a" | "b" | "c" | "e";
                      nutrients_available?: 0 | 1;
                      nutriscore_applicable?: 0 | 1;
                      nutriscore_computed?: 0 | 1;
                      score?: number;
                  } & { data?: (...) & (...) };
              };
              nutriscore_2021_tags?: ("d" | "a" | "b" | "c" | "e")[];
              nutriscore_2023_tags?: ("d" | "a" | "b" | "c" | "e")[];
              nutriscore_data?: {
                  is_beverage?: 0 | 1;
                  is_cheese?: 0 | 1;
                  is_water?: 0 | 1;
              } & {
                  energy?: number;
                  energy_points?: number;
                  energy_value?: number;
                  fiber?: number;
                  fiber_points?: number;
                  fiber_value?: number;
                  fruits_vegetables_nuts_colza_walnut_olive_oils?: number;
                  fruits_vegetables_nuts_colza_walnut_olive_oils_points?: number;
                  fruits_vegetables_nuts_colza_walnut_olive_oils_value?: number;
                  is_fat?: 0
                  | 1;
                  negative_points?: number;
                  positive_points?: number;
                  proteins?: number;
                  proteins_points?: number;
                  proteins_value?: number;
                  saturated_fat?: number;
                  saturated_fat_points?: number;
                  saturated_fat_value?: number;
                  sodium?: number;
                  sodium_points?: number;
                  sodium_value?: number;
                  sugars?: number;
                  sugars_points?: number;
                  sugars_value?: number;
              } & { grade?: "d"
              | "a"
              | "b"
              | "c"
              | "e"; score?: number };
              nutriscore_grade?: "d" | "a" | "b" | "c" | "e";
              nutriscore_score?: number;
              nutriscore_score_opposite?: number;
              nutriscore_tags?: ("d" | "a" | "b" | "c" | "e")[];
              nutriscore_version?: string;
          } & {
              data_quality_bugs_tags?: string[];
              data_quality_errors_tags?: string[];
              data_quality_info_tags?: string[];
              data_quality_tags?: string[];
              data_quality_warnings_tags?: string[];
              data_sources?: string;
              data_sources_tags?: string[];
              last_check_dates_tags?: string[];
              last_checked_t?: number;
              last_checker?: string;
              misc_tags?: string[];
              states?: string;
              states_hierarchy?: string[];
              states_tags?: string[];
          } & {
              added_countries_tags?: Record<string, never>[];
              additives_original_tags?: string[];
              additives_prev_original_tags?: string[];
              allergens_from_ingredients?: string;
              allergens_from_user?: string;
              amino_acids_prev_tags?: Record<string, never>[];
              amino_acids_tags?: Record<string, never>[];
              carbon_footprint_percent_of_known_ingredients?: number;
              categories_properties?: {
                  "agribalyse_food_code:en"?: string;
                  "agribalyse_proxy_food_code:en"?: string;
                  "ciqual_food_code:en"?: string;
              };
              categories_properties_tags?: string[];
              category_properties?: { [key: string]: string };
              ciqual_food_name_tags?: string[];
              compared_to_category?: string;
              conservation_conditions?: string;
              customer_service?: string;
              expiration_date?: string;
              link?: string;
              main_countries_tags?: Record<string, never>[];
              minerals_prev_tags?: Record<string, never>[];
              minerals_tags?: Record<string, never>[];
              nova_groups_markers?: { [key: string]: string[][] };
              nucleotides_tags?: Record<string, never>[];
              origin?: string;
              owner_fields?: {
                  additionalProperties?: string | number | Record<string, never>;
              };
              purchase_places?: string;
              purchase_places_tags?: string[];
              stores?: string;
              stores_tags?: string[];
              traces_from_ingredients?: string;
              traces_from_user?: string;
          } & {
              created_t?: number;
              creator?: string;
              editors_tags?: string[];
              informers_tags?: string[];
              interface_version_created?: string;
              interface_version_modified?: string;
              languages?: Record<string, never>;
              languages_codes?: Record<string, never>;
              languages_hierarchy?: string[];
              languages_tags?: string[];
              last_edit_dates_tags?: string[];
              last_editor?: string;
              last_modified_by?: string;
              last_modified_t?: number;
              last_updated_t?: number;
              owner?: string;
              owners_tags?: string;
              photographers_tags?: string[];
              rev?: number;
              sources?: {
                  fields?: string[];
                  id?: string;
                  images?: Record<string, never>[];
                  import_t?: number;
                  manufacturer?: string | number;
                  name?: string;
                  source_licence?: string;
                  source_licence_url?: string;
                  url?: null | string;
              }[];
              sources_fields?: {
                  "org-gs1"?: {
                      gln?: string;
                      gpcCategoryCode?: string;
                      gpcCategoryName?: string;
                      isAllergenRelevantDataProvided?: string;
                      lastChangeDateTime?: string;
                      partyName?: string;
                      productionVariantDescription?: string;
                      publicationDateTime?: string;
                  };
              };
              teams?: string;
              teams_tags?: string[];
              update_key?: string;
          } & {
              knowledge_panels?: {
                  additionalProperties?: {
                      elements?: {
                          action_element?: ...;
                          image_element?: ...;
                          panel_element?: ...;
                          panel_group_element?: ...;
                          table_element?: ...;
                          text_element?: ...;
                          type: ...;
                      }[];
                      evaluation?: "unknown"
                      | "good"
                      | "average"
                      | "neutral"
                      | "bad";
                      expand_for?: string;
                      expanded?: boolean;
                      half_width_on_mobile?: boolean;
                      level?: string;
                      size?: "small";
                      title_element?: {
                          grade?:
                              | (...)
                              | (...)
                              | (...)
                              | (...)
                              | (...)
                              | (...)
                              | (...)
                              | (...)
                              | (...);
                          icon_color_from_evaluation?: (...) | (...);
                          icon_size?: (...) | (...);
                          icon_url?: (...) | (...);
                          name?: (...) | (...);
                          title?: (...) | (...);
                          type?: (...) | (...) | (...);
                          value?: (...) | (...);
                      };
                      topics?: string[];
                      type?: string;
                  };
              };
          } & {
              attribute_groups?: {
                  description?: string;
                  description_short?: string;
                  grade?: "unknown"
                  | "d"
                  | "a"
                  | "b"
                  | "c"
                  | "e";
                  icon_url?: string;
                  id?: string;
                  match?: number;
                  name?: string;
                  status?: "unknown" | "known";
                  title?: string;
              }[];
          },
      >

      A promise that resolves to the product data or undefined if not found

    • Returns product details by barcode with optional fields

      Type Parameters

      • T extends (
            | "link"
            | "code"
            | "id"
            | "origin"
            | "complete"
            | "lang"
            | "labels"
            | "countries"
            | "brands"
            | "lc"
            | "packagings"
            | "packagings_complete"
            | "product_name"
            | "last_modified_t"
            | "scans_n"
            | "unique_scans_n"
            | "created_t"
            | "completeness"
            | "popularity_key"
            | "nutriscore_score"
            | "ecoscore_score"
            | "additives_tags"
            | "allergens_tags"
            | "brands_tags"
            | "categories_tags"
            | "countries_tags"
            | "emb_codes_tags"
            | "labels_tags"
            | "manufacturing_places_tags"
            | "origins_tags"
            | "purchase_places_tags"
            | "states_tags"
            | "stores_tags"
            | "traces_tags"
            | "languages"
            | "allergens"
            | "categories"
            | "ingredients"
            | "states"
            | "stores"
            | "abbreviated_product_name"
            | "product_type"
            | "codes_tags"
            | "generic_name"
            | "nova_group"
            | "nova_groups"
            | "obsolete"
            | "obsolete_since_date"
            | "product_name_en"
            | "product_quantity"
            | "product_quantity_unit"
            | "quantity"
            | "schema_version"
            | "additives_n"
            | "checked"
            | "ecoscore_grade"
            | "food_groups"
            | "food_groups_tags"
            | "nutrient_levels"
            | "packaging_text"
            | "pnns_groups_1"
            | "pnns_groups_1_tags"
            | "pnns_groups_2"
            | "pnns_groups_2_tags"
            | "popularity_tags"
            | "serving_quantity"
            | "serving_quantity_unit"
            | "serving_size"
            | "brands_hierarchy"
            | "brands_lc"
            | "categories_hierarchy"
            | "categories_lc"
            | "checkers_tags"
            | "cities"
            | "cities_tags"
            | "correctors_tags"
            | "countries_hierarchy"
            | "countries_lc"
            | "ecoscore_tags"
            | "emb_codes"
            | "emb_codes_orig"
            | "labels_hierarchy"
            | "labels_lc"
            | "entry_dates_tags"
            | "manufacturing_places"
            | "nova_groups_tags"
            | "nutrient_levels_tags"
            | "images"
            | "selected_images"
            | "last_image_dates_tags"
            | "last_image_t"
            | "ecoscore_data"
            | "ecoscore_extended_data_version"
            | "environment_impact_level"
            | "environment_impact_level_tags"
            | "allergens_lc"
            | "allergens_hierarchy"
            | "ingredients_analysis"
            | "ingredients_analysis_tags"
            | "ingredients_from_or_that_may_be_from_palm_oil_n"
            | "ingredients_from_palm_oil_n"
            | "ingredients_from_palm_oil_tags"
            | "ingredients_hierarchy"
            | "ingredients_n"
            | "ingredients_n_tags"
            | "ingredients_original_tags"
            | "ingredients_percent_analysis"
            | "ingredients_sweeteners_n"
            | "ingredients_non_nutritive_sweeteners_n"
            | "ingredients_tags"
            | "ingredients_lc"
            | "ingredients_text"
            | "ingredients_text_with_allergens"
            | "ingredients_that_may_be_from_palm_oil_n"
            | "ingredients_that_may_be_from_palm_oil_tags"
            | "ingredients_with_specified_percent_n"
            | "ingredients_with_specified_percent_sum"
            | "ingredients_with_unspecified_percent_n"
            | "ingredients_with_unspecified_percent_sum"
            | "known_ingredients_n"
            | "origins"
            | "origins_hierarchy"
            | "origins_lc"
            | "traces"
            | "traces_hierarchy"
            | "traces_lc"
            | "unknown_ingredients_n"
            | "nutrition"
            | "nutriscore"
            | "nutriscore_2021_tags"
            | "nutriscore_2023_tags"
            | "nutriscore_data"
            | "nutriscore_grade"
            | "nutriscore_score_opposite"
            | "nutriscore_tags"
            | "nutriscore_version"
            | "data_quality_bugs_tags"
            | "data_quality_errors_tags"
            | "data_quality_info_tags"
            | "data_quality_tags"
            | "data_quality_warnings_tags"
            | "data_sources"
            | "data_sources_tags"
            | "last_check_dates_tags"
            | "last_checked_t"
            | "last_checker"
            | "states_hierarchy"
            | "misc_tags"
            | "additives_original_tags"
            | "additives_prev_original_tags"
            | "added_countries_tags"
            | "allergens_from_ingredients"
            | "allergens_from_user"
            | "amino_acids_prev_tags"
            | "amino_acids_tags"
            | "carbon_footprint_percent_of_known_ingredients"
            | "categories_properties"
            | "categories_properties_tags"
            | "category_properties"
            | "ciqual_food_name_tags"
            | "compared_to_category"
            | "conservation_conditions"
            | "customer_service"
            | "expiration_date"
            | "main_countries_tags"
            | "minerals_prev_tags"
            | "minerals_tags"
            | "owner_fields"
            | "nova_groups_markers"
            | "nucleotides_tags"
            | "purchase_places"
            | "traces_from_ingredients"
            | "traces_from_user"
            | "creator"
            | "editors_tags"
            | "informers_tags"
            | "interface_version_created"
            | "interface_version_modified"
            | "languages_codes"
            | "languages_hierarchy"
            | "languages_tags"
            | "last_edit_dates_tags"
            | "last_editor"
            | "last_modified_by"
            | "last_updated_t"
            | "owner"
            | "owners_tags"
            | "photographers_tags"
            | "rev"
            | "sources"
            | "sources_fields"
            | "teams"
            | "teams_tags"
            | "update_key"
            | "knowledge_panels"
            | "attribute_groups"
        )[]

        An array of keys from ProductV3 to return

      Parameters

      • barcode: string

        The barcode of the product

      • Optionalquery: Omit<
            | undefined
            | {
                cc?: string;
                fields?: string;
                knowledge_panels_excluded?: string;
                knowledge_panels_included?: string;
                lc?: string;
                product_type?: "all"
                | "product"
                | "beauty"
                | "food"
                | "petfood";
                tags_lc?: string;
            },
            "fields",
        > & { fields?: T }

        An optional query object to filter the returned fields

      Returns Promise<
          | undefined
          | {
              errors?: {
                  field?: { id?: string; value?: string };
                  impact?: {
                      description?: string;
                      id?: string;
                      lc_description?: string;
                      lc_name?: string;
                      name?: string;
                  };
                  message?: {
                      description?: string;
                      id?: string;
                      lc_description?: string;
                      lc_name?: string;
                      name?: string;
                  };
              }[];
              result?: { id?: string; lc_name?: string; name?: string };
              status_id?:
                  | "success"
                  | "success_with_warnings"
                  | "success_with_errors"
                  | "failure";
              warnings?: {
                  field?: { id?: string; value?: string };
                  impact?: {
                      description?: string;
                      id?: string;
                      lc_description?: string;
                      lc_name?: string;
                      name?: string;
                  };
                  message?: {
                      description?: string;
                      id?: string;
                      lc_description?: string;
                      lc_name?: string;
                      name?: string;
                  };
              }[];
          } & { product: Pick<ProductV3, T[number]> },
      >

      A promise that resolves to a product object with the specified fields or undefined if not found

      const result = await api.getProductV3("1234567890123", { fields: ["product_name", "brands"] });
      console.log(result.product.product_name, result.product.brands);
    • Parameters

      • barcode: string
      • photoId: string
      • ocrEngine: "google_cloud_vision" = "google_cloud_vision"

      Returns Promise<undefined | { status?: number }>

    • Rotates an image for a product

      Parameters

      • barcode: string

        The barcode of the product

      • id: string

        Identifier of the selected image field (format: {IMAGE_TYPE}_{LANG})

      • imgid: string

        Identifier of the image to rotate (should be a number as string)

      • angle: string

        Angle of rotation in degrees (90, 180, or 270 clockwise)

      Returns Promise<
          {
              image?: { display_url?: string };
              imagefield?: string;
              status?: string;
          },
      >

      A promise that resolves to the rotation response

    • Parameters

      • query:
            | undefined
            | {
                "<nutrient>_eq_<value>"?: Record<string, never>;
                "<nutrient>_gt_<value>"?: Record<string, never>;
                "<nutrient>_lt_<value>"?: Record<string, never>;
                "<tag_name>_tags_<language_code>"?: Record<string, never>;
                additives_tags?: string;
                allergens_tags?: string;
                brands_tags?: string;
                categories_tags?: string;
                countries_tags_en?: string;
                emb_codes_tags?: string;
                fields?: string;
                labels_tags?: string;
                manufacturing_places_tags?: string;
                nutrition_grades_tags?: string;
                origins_tags?: string;
                packaging_tags_de?: string;
                page?: number;
                page_size?: number;
                purchase_places_tags?: string;
                sort_by?:
                    | "product_name"
                    | "last_modified_t"
                    | "scans_n"
                    | "unique_scans_n"
                    | "created_t"
                    | "completeness"
                    | "popularity_key"
                    | "nutriscore_score"
                    | "nova_score"
                    | "nothing"
                    | "ecoscore_score";
                states_tags?: string;
                stores_tags?: string;
                traces_tags?: string;
            }
        • undefined
        • {
              "<nutrient>_eq_<value>"?: Record<string, never>;
              "<nutrient>_gt_<value>"?: Record<string, never>;
              "<nutrient>_lt_<value>"?: Record<string, never>;
              "<tag_name>_tags_<language_code>"?: Record<string, never>;
              additives_tags?: string;
              allergens_tags?: string;
              brands_tags?: string;
              categories_tags?: string;
              countries_tags_en?: string;
              emb_codes_tags?: string;
              fields?: string;
              labels_tags?: string;
              manufacturing_places_tags?: string;
              nutrition_grades_tags?: string;
              origins_tags?: string;
              packaging_tags_de?: string;
              page?: number;
              page_size?: number;
              purchase_places_tags?: string;
              sort_by?:
                  | "product_name"
                  | "last_modified_t"
                  | "scans_n"
                  | "unique_scans_n"
                  | "created_t"
                  | "completeness"
                  | "popularity_key"
                  | "nutriscore_score"
                  | "nova_score"
                  | "nothing"
                  | "ecoscore_score";
              states_tags?: string;
              stores_tags?: string;
              traces_tags?: string;
          }
          • Optional<nutrient>_eq_<value>?: Record<string, never>

            Search on nutrient for an exact quantity

          • Optional<nutrient>_gt_<value>?: Record<string, never>

            Search on nutrient greater than a value

          • Optional<nutrient>_lt_<value>?: Record<string, never>

            Search on nutrient lower than a value

          • Optional<tag_name>_tags_<language_code>?: Record<string, never>

            You can add a language code to a specific tag to query it in a specific language

          • Optionaladditives_tags?: string

            The additives_tags in english of product(s) you are searching for. The Open Food Facts Web App has a list of possible values for additives. Translated values are available at https://static.openfoodfacts.org/data/taxonomies/additives.json

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalallergens_tags?: string

            The allergens_tags in english of product(s) you are searching for. The Open Food Facts Web App has a list of possible values for allergens. Translated values are available at https://static.openfoodfacts.org/data/taxonomies/allergens.json

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalbrands_tags?: string

            The brands_tags of product(s) you are searching for. The Open Food Facts Web App has a list of possible values for brands. Taxonomized values are available at https://static.openfoodfacts.org/data/taxonomies/brands.json

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalcategories_tags?: string

            The category of product(s) you are searching for. The Open Food Facts Web App has a list of possible values for categories. Translated values are available at https://static.openfoodfacts.org/data/taxonomies/categories.json

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalcountries_tags_en?: string

            The countries_tags_en of product(s) you are searching for. The Open Food Facts Web App shows a list of possible values for countries. Translated values are available at https://static.openfoodfacts.org/data/taxonomies/countries.json

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalemb_codes_tags?: string

            The emb_codes_tags of product(s) you are searching for.

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalfields?: string

            Specific fields to return. Use 'knowledge_panels' for Knowledge Panels only.

          • Optionallabels_tags?: string

            The labels_tags in english of product(s) you are searching for. The Open Food Facts Web App has a list of possible values for labels.

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalmanufacturing_places_tags?: string

            The manufacturing_places_tags of product(s) you are searching for. The Open Food Facts Web App has a list of possible values for manufacturing-places.

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalnutrition_grades_tags?: string

            The nutrition_grades_tags of product(s) you are searching for. The Open Food Facts Web App has a list of possible values for nutrition-grades.

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalorigins_tags?: string

            The origins_tags of product(s) you are searching for. The Open Food Facts Web App has a list of possible values for origins.

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalpackaging_tags_de?: string

            The packaging_tag in german of product(s) you are searching for. The Open Food Facts Web App has a list of possible values for packaging.

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalpage?: number

            The page number you request to view (eg. in search results spanning multiple pages)

          • Optionalpage_size?: number

            The number of elements should be sent per page

          • Optionalpurchase_places_tags?: string

            The purchase_places_tags of product(s) you are searching for.

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionalsort_by?:
                | "product_name"
                | "last_modified_t"
                | "scans_n"
                | "unique_scans_n"
                | "created_t"
                | "completeness"
                | "popularity_key"
                | "nutriscore_score"
                | "nova_score"
                | "nothing"
                | "ecoscore_score"

            The allowed values used to sort/order the search results.

            * `product_name` sorts on name
            * `ecoscore_score`, `nova_score`, `nutriscore_score` rank on the [Eco-Score](https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products), [Nova](https://world.openfoodfacts.org/nova), or [Nutri-Score](https://world.openfoodfacts.org/nutriscore)
            * `scans_n`, `unique_scans_n` and `popularity_key` are about product popularity: number of scans on unique scans, rank of product
            * `created_t`, `last_modified_t`, are about creation and modification dates
            * `nothing`, tells not to sort at all (because if you do not provide the sort_by argument we default to sorting on popularity (for food) or last modification date)
            
          • Optionalstates_tags?: string

            The states_tags in english of product(s) you are searching for. The Open Food Facts Web App has a list of possible values for states. Translated values are available at https://static.openfoodfacts.org/data/taxonomies/states.json You can use multiple values by using a comma separated list. You can add a "-" before values to avoid matching a tag.

          • Optionalstores_tags?: string

            The stores_tags of product(s) you are searching for.

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            
          • Optionaltraces_tags?: string

            The traces_tags of product(s) you are searching for. The Open Food Facts Web App shows a list of possible values for traces.

            You can use multiple values by using a comma separated list.
            You can add a "-" before values to avoid matching a tag.
            

      Returns Promise<
          | undefined
          | {
              count?: number;
              page?: number;
              page_count?: number;
              page_size?: number;
              products?: (
                  {
                      abbreviated_product_name?: string;
                      code?: string;
                      codes_tags?: string[];
                      generic_name?: string;
                      id?: string;
                      lang?: string;
                      lc?: string;
                      nova_group?: number;
                      nova_groups?: string;
                      obsolete?: string;
                      obsolete_since_date?: string;
                      product_name?: string;
                      product_name_en?: string;
                      product_quantity?: string;
                      product_quantity_unit?: string;
                      product_type?: "product"
                      | "beauty"
                      | "food"
                      | "petfood";
                      quantity?: string;
                      schema_version?: number;
                  } & {
                      additives_n?: number;
                      checked?: string;
                      complete?: number;
                      completeness?: number;
                      ecoscore_grade?: string;
                      ecoscore_score?: number;
                      food_groups?: string;
                      food_groups_tags?: string[];
                      nutrient_levels?: {
                          fat?: "high"
                          | "low"
                          | "moderate";
                          salt?: "high" | "low" | "moderate";
                          "saturated-fat"?: "high" | "low" | "moderate";
                          sugars?: "high" | "low" | "moderate";
                      };
                      packaging_text?: string;
                      packagings?: {
                          material?: (...)
                          | (...);
                          number_of_units?: (...) | (...);
                          quantity_per_unit?: (...) | (...);
                          quantity_per_unit_unit?: (...) | (...);
                          quantity_per_unit_value?: (...) | (...);
                          recycling?: (...) | (...);
                          shape?: (...) | (...);
                          weight?: (...) | (...);
                          weight_estimated?: (...) | (...);
                          weight_measured?: (...) | (...);
                          weight_source_id?: (...) | (...);
                          weight_specified?: (...) | (...);
                      }[];
                      packagings_complete?: number;
                      pnns_groups_1?: string;
                      pnns_groups_1_tags?: string[];
                      pnns_groups_2?: string;
                      pnns_groups_2_tags?: string[];
                      popularity_key?: number;
                      popularity_tags?: string[];
                      scans_n?: number;
                      serving_quantity?: string;
                      serving_quantity_unit?: string;
                      serving_size?: string;
                      unique_scans_n?: number;
                  } & {
                      brands?: string;
                      brands_hierarchy?: string[];
                      brands_lc?: string;
                      brands_tags?: string[];
                      categories?: string;
                      categories_hierarchy?: string[];
                      categories_lc?: string;
                      categories_tags?: string[];
                      checkers_tags?: string[];
                      cities?: string;
                      cities_tags?: Record<string, never>[];
                      correctors_tags?: string[];
                      countries?: string;
                      countries_hierarchy?: string[];
                      countries_lc?: string;
                      countries_tags?: string[];
                      ecoscore_tags?: string[];
                      emb_codes?: string;
                      emb_codes_orig?: string;
                      emb_codes_tags?: Record<string, never>[];
                      entry_dates_tags?: string[];
                      labels?: string;
                      labels_hierarchy?: string[];
                      labels_lc?: string;
                      labels_tags?: string[];
                      manufacturing_places?: string;
                      manufacturing_places_tags?: string[];
                      nova_groups_tags?: string[];
                      nutrient_levels_tags?: string[];
                  } & {
                      image_small_url?: string;
                      image_thumb_url?: string;
                      image_url?: string;
                      images?: { front?: (...)
                      | (...) } & {
                          [key: string]: { sizes?: ...; uploaded_t?: ...; uploader?: ... };
                      };
                      last_image_dates_tags?: string[];
                      last_image_t?: number;
                      selected_images?: {
                          front?: { display?: ...; small?: ...; thumb?: ... };
                      };
                  } & {
                      ecoscore_data?: {
                          adjustments?: {
                              origins_of_ingredients?: ...;
                              packaging?: ...;
                              production_system?: ...;
                              threatened_species?: ...;
                          };
                          agribalyse?: {
                              agribalyse_food_code?: ...;
                              agribalyse_proxy_food_code?: ...;
                              co2_agriculture?: ...;
                              co2_consumption?: ...;
                              co2_distribution?: ...;
                              co2_packaging?: ...;
                              co2_processing?: ...;
                              co2_total?: ...;
                              co2_transportation?: ...;
                              code?: ...;
                              dqr?: ...;
                              ef_agriculture?: ...;
                              ef_consumption?: ...;
                              ef_distribution?: ...;
                              ef_packaging?: ...;
                              ef_processing?: ...;
                              ef_total?: ...;
                              ef_transportation?: ...;
                              is_beverage?: ...;
                              name_en?: ...;
                              score?: ...;
                              version?: ...;
                          };
                          grade?: string;
                          grades?: Record<(...), (...)>;
                          missing?: { labels?: ...; origins?: ...; packagings?: ... };
                          missing_data_warning?: number;
                          previous_data?: { agribalyse?: ...; grade?: ...; score?: ... };
                          score?: number;
                          scores?: Record<(...), (...)>;
                          status?: string;
                      };
                      ecoscore_extended_data_version?: string;
                      environment_impact_level?: string;
                      environment_impact_level_tags?: Record<string, never>[];
                  } & {
                      additives_tags?: string[];
                      allergens?: string;
                      allergens_hierarchy?: string[];
                      allergens_lc?: string;
                      allergens_tags?: string[];
                      ingredients?: {
                          id?: (...)
                          | (...);
                          ingredients?: { id?: string | undefined; ingredients?: ...[] | undefined; percent?: number | undefined; percent_estimate?: number | undefined; percent_max?: string | number | undefined; percent_min?: number | undefined; text?: string | undefined; vegan?: string | undefined; vegetarian?: string | undefined; }[] | undefined;
                          percent?: (...) | (...);
                          percent_estimate?: (...) | (...);
                          percent_max?: (...) | (...) | (...);
                          percent_min?: (...) | (...);
                          text?: (...) | (...);
                          vegan?: (...) | (...);
                          vegetarian?: (...) | (...);
                      }[];
                      ingredients_analysis?: {
                          "en:palm-oil"?: (...)[];
                          "en:vegan-status-unknown"?: (...)[];
                          "en:vegetarian-status-unknown"?: (...)[];
                      };
                      ingredients_analysis_tags?: string[];
                      ingredients_from_or_that_may_be_from_palm_oil_n?: number;
                      ingredients_from_palm_oil_n?: number;
                      ingredients_from_palm_oil_tags?: Record<string, never>[];
                      ingredients_hierarchy?: string[];
                      ingredients_lc?: string;
                      ingredients_n?: number;
                      ingredients_n_tags?: string[];
                      ingredients_non_nutritive_sweeteners_n?: number;
                      ingredients_original_tags?: string[];
                      ingredients_percent_analysis?: number;
                      ingredients_sweeteners_n?: number;
                      ingredients_tags?: string[];
                      ingredients_text?: string;
                      ingredients_text_with_allergens?: string;
                      ingredients_that_may_be_from_palm_oil_n?: number;
                      ingredients_that_may_be_from_palm_oil_tags?: Record<string, never>[];
                      ingredients_with_specified_percent_n?: number;
                      ingredients_with_specified_percent_sum?: number;
                      ingredients_with_unspecified_percent_n?: number;
                      ingredients_with_unspecified_percent_sum?: number;
                      known_ingredients_n?: number;
                      origins?: string;
                      origins_hierarchy?: Record<string, never>[];
                      origins_lc?: string;
                      origins_tags?: Record<string, never>[];
                      traces?: string;
                      traces_hierarchy?: (string | Record<(...), (...)>)[];
                      traces_lc?: string;
                      traces_tags?: (string | Record<(...), (...)>)[];
                      unknown_ingredients_n?: number;
                  } & {
                      no_nutrition_data?: string;
                      nutriments?: {
                          alcohol?: number;
                          carbohydrates?: number;
                          "carbohydrates-total"?: number;
                          "carbon-footprint-from-known-ingredients_product"?: number;
                          "carbon-footprint-from-known-ingredients_serving"?: number;
                          energy?: number;
                          energy_unit?: "kcal"
                          | "kJ";
                          energy_value?: number;
                          "energy-kcal"?: number;
                          "energy-kj"?: number;
                          erythritol?: number;
                          fat?: number;
                          "fruits-vegetables-legumes-estimate-from-ingredients"?: number;
                          "fruits-vegetables-nuts-estimate-from-ingredients"?: number;
                          "nova-group"?: number;
                          "nutrition-score-fr"?: unknown;
                          proteins?: number;
                          salt?: number;
                          "saturated-fat"?: number;
                          sodium?: number;
                          sugars?: number;
                      };
                      nutriscore_data?: {
                          saturated_fat_ratio?: number;
                          saturated_fat_ratio_points?: number;
                          saturated_fat_ratio_value?: number;
                      };
                      nutrition_data_per?: "serving"
                      | "100g";
                      nutrition_data_prepared_per?: "serving" | "100g";
                      nutrition_grade_fr?: string;
                      nutrition_grades?: string;
                      nutrition_grades_tags?: string[];
                      nutrition_score_beverage?: number;
                      nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients?: number;
                      nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value?: number;
                      nutrition_score_warning_no_fiber?: number;
                      other_nutritional_substances_tags?: Record<string, never>[];
                      unknown_nutrients_tags?: Record<string, never>[];
                      vitamins_tags?: Record<string, never>[];
                  } & {
                      nutriscore?: { "2021"?: (...) & (...); "2023"?: (...) & (...) };
                      nutriscore_2021_tags?: ("d" | "a" | "b" | "c" | "e")[];
                      nutriscore_2023_tags?: ("d" | "a" | "b" | "c" | "e")[];
                      nutriscore_data?: {
                          is_beverage?: (...) | (...) | (...);
                          is_cheese?: (...) | (...) | (...);
                          is_water?: (...) | (...) | (...);
                      } & {
                          energy?: (...)
                          | (...);
                          energy_points?: (...) | (...);
                          energy_value?: (...) | (...);
                          fiber?: (...) | (...);
                          fiber_points?: (...) | (...);
                          fiber_value?: (...) | (...);
                          fruits_vegetables_nuts_colza_walnut_olive_oils?: (...) | (...);
                          fruits_vegetables_nuts_colza_walnut_olive_oils_points?: (...) | (...);
                          fruits_vegetables_nuts_colza_walnut_olive_oils_value?: (...) | (...);
                          is_fat?: (...) | (...) | (...);
                          negative_points?: (...) | (...);
                          positive_points?: (...) | (...);
                          proteins?: (...) | (...);
                          proteins_points?: (...) | (...);
                          proteins_value?: (...) | (...);
                          saturated_fat?: (...) | (...);
                          saturated_fat_points?: (...) | (...);
                          saturated_fat_value?: (...) | (...);
                          sodium?: (...) | (...);
                          sodium_points?: (...) | (...);
                          sodium_value?: (...) | (...);
                          sugars?: (...) | (...);
                          sugars_points?: (...) | (...);
                          sugars_value?: (...) | (...);
                      } & {
                          grade?: (...)
                          | (...)
                          | (...)
                          | (...)
                          | (...)
                          | (...);
                          score?: (...) | (...);
                      };
                      nutriscore_grade?: "d"
                      | "a"
                      | "b"
                      | "c"
                      | "e";
                      nutriscore_score?: number;
                      nutriscore_score_opposite?: number;
                      nutriscore_tags?: ("d" | "a" | "b" | "c" | "e")[];
                      nutriscore_version?: string;
                  } & {
                      data_quality_bugs_tags?: string[];
                      data_quality_errors_tags?: string[];
                      data_quality_info_tags?: string[];
                      data_quality_tags?: string[];
                      data_quality_warnings_tags?: string[];
                      data_sources?: string;
                      data_sources_tags?: string[];
                      last_check_dates_tags?: string[];
                      last_checked_t?: number;
                      last_checker?: string;
                      misc_tags?: string[];
                      states?: string;
                      states_hierarchy?: string[];
                      states_tags?: string[];
                  } & {
                      added_countries_tags?: Record<string, never>[];
                      additives_original_tags?: string[];
                      additives_prev_original_tags?: string[];
                      allergens_from_ingredients?: string;
                      allergens_from_user?: string;
                      amino_acids_prev_tags?: Record<string, never>[];
                      amino_acids_tags?: Record<string, never>[];
                      carbon_footprint_percent_of_known_ingredients?: number;
                      categories_properties?: {
                          "agribalyse_food_code:en"?: string;
                          "agribalyse_proxy_food_code:en"?: string;
                          "ciqual_food_code:en"?: string;
                      };
                      categories_properties_tags?: string[];
                      category_properties?: { [key: string]: string };
                      ciqual_food_name_tags?: string[];
                      compared_to_category?: string;
                      conservation_conditions?: string;
                      customer_service?: string;
                      expiration_date?: string;
                      link?: string;
                      main_countries_tags?: Record<string, never>[];
                      minerals_prev_tags?: Record<string, never>[];
                      minerals_tags?: Record<string, never>[];
                      nova_groups_markers?: { [key: string]: (...)[][] };
                      nucleotides_tags?: Record<string, never>[];
                      origin?: string;
                      owner_fields?: {
                          additionalProperties?: string | number | Record<(...), (...)>;
                      };
                      purchase_places?: string;
                      purchase_places_tags?: string[];
                      stores?: string;
                      stores_tags?: string[];
                      traces_from_ingredients?: string;
                      traces_from_user?: string;
                  } & {
                      created_t?: number;
                      creator?: string;
                      editors_tags?: string[];
                      informers_tags?: string[];
                      interface_version_created?: string;
                      interface_version_modified?: string;
                      languages?: Record<string, never>;
                      languages_codes?: Record<string, never>;
                      languages_hierarchy?: string[];
                      languages_tags?: string[];
                      last_edit_dates_tags?: string[];
                      last_editor?: string;
                      last_modified_by?: string;
                      last_modified_t?: number;
                      last_updated_t?: number;
                      owner?: string;
                      owners_tags?: string;
                      photographers_tags?: string[];
                      rev?: number;
                      sources?: {
                          fields?: (...) | (...);
                          id?: (...) | (...);
                          images?: (...) | (...);
                          import_t?: (...) | (...);
                          manufacturer?: (...) | (...) | (...);
                          name?: (...) | (...);
                          source_licence?: (...) | (...);
                          source_licence_url?: (...) | (...);
                          url?: (...) | (...) | (...);
                      }[];
                      sources_fields?: {
                          "org-gs1"?: {
                              gln?: ...;
                              gpcCategoryCode?: ...;
                              gpcCategoryName?: ...;
                              isAllergenRelevantDataProvided?: ...;
                              lastChangeDateTime?: ...;
                              partyName?: ...;
                              productionVariantDescription?: ...;
                              publicationDateTime?: ...;
                          };
                      };
                      teams?: string;
                      teams_tags?: string[];
                      update_key?: string;
                  } & {
                      knowledge_panels?: {
                          additionalProperties?: {
                              elements?: ...;
                              evaluation?: ...;
                              expand_for?: ...;
                              expanded?: ...;
                              half_width_on_mobile?: ...;
                              level?: ...;
                              size?: ...;
                              title_element?: ...;
                              topics?: ...;
                              type?: ...;
                          };
                      };
                  } & {
                      attribute_groups?: {
                          description?: (...)
                          | (...);
                          description_short?: (...) | (...);
                          grade?: (...) | (...) | (...) | (...) | (...) | (...) | (...);
                          icon_url?: (...) | (...);
                          id?: (...) | (...);
                          match?: (...) | (...);
                          name?: (...) | (...);
                          status?: (...) | (...) | (...);
                          title?: (...) | (...);
                      }[];
                  }
              )[];
              skip?: number;
          },
      >

    • Unselects an image for a product

      Parameters

      • barcode: string

        The barcode of the product

      • id: string

        Image field (image id) of the photo to unselect (e.g., "front_fr")

      Returns Promise<{ imagefield?: string; status?: string; status_code?: number }>

      A promise that resolves to the unselect response

    • Uploads an image to OpenFoodFacts for a product.

      Parameters

      • barcode: string

        The barcode of the product

      • imageFile: File

        The image file to upload

      • imagefield: string

        The field name for the image (e.g., "front", "ingredients", "nutrition")

      Returns Promise<
          {
              code?: string;
              files?: {
                  code?: string;
                  filename?: string;
                  name?: string;
                  thumbnailUrl?: string;
                  url?: string;
              }[];
              image?: { crop_url?: string; imgid?: number; thumb_url?: string };
              imagefield?: string;
              imgid?: number;
              status?: string;
          },
      >

      A promise that resolves to the upload response

    • Gets URL for a product image based on its barcode and image name

      Parameters

      • barcode: string

        Product barcode

      • imageName: string

        Name of the image (e.g., "front", "ingredients", "nutrition")

      • images: Record<string, SelectedImage | RawImage>

        Image metadata from product data

      • size: "full" | "200" | "100" | "400" = "400"

        Image size (100, 200, 400, or full) - defaults to 400

      Returns null | string

      Complete URL to the specific image or null if not found