@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

    apiv2: ProductOpenerApiV2

    The V2 ProductOpener API class. Do not use directly unless you know what you're doing.

    apiv3: ProductOpenerApiV3

    The V3 ProductOpener API class. Do not use directly unless you know what you're doing.

    robotoff: Robotoff

    The Robotoff API class.

    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, KnowledgePanel>;
            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<
          FetchResponse<
              {
                  parameters: {
                      cookie?: never;
                      header?: never;
                      path?: never;
                      query?: never;
                  };
                  requestBody: {
                      content: {
                          "multipart/form-data": {
                              angle?: number;
                              code: string;
                              id: string;
                              imgid: number;
                              normalize?: "false"
                              | "true";
                              white_magic: "false" | "true";
                              x1?: number;
                              x2?: number;
                              y1?: number;
                              y2?: number;
                          } & {
                              app_name?: string;
                              app_uuid?: string;
                              app_version?: string;
                              comment?: string;
                              "User-Agent"?: string;
                          };
                      };
                  };
                  responses: {
                      "200": {
                          content: {
                              "application/json": {
                                  imagefield?: string;
                                  imgid?: number;
                                  status?: string;
                              };
                          };
                          headers: { [name: string]: unknown };
                      };
                  };
              },
              FetchOptions<
                  {
                      parameters: {
                          cookie?: never;
                          header?: never;
                          path?: never;
                          query?: never;
                      };
                      requestBody: {
                          content: {
                              "multipart/form-data": {
                                  angle?: number;
                                  code: string;
                                  id: string;
                                  imgid: number;
                                  normalize?: "false"
                                  | "true";
                                  white_magic: "false" | "true";
                                  x1?: number;
                                  x2?: number;
                                  y1?: number;
                                  y2?: number;
                              } & {
                                  app_name?: string;
                                  app_uuid?: string;
                                  app_version?: string;
                                  comment?: string;
                                  "User-Agent"?: string;
                              };
                          };
                      };
                      responses: {
                          "200": {
                              content: {
                                  "application/json": {
                                      imagefield?: string;
                                      imgid?: number;
                                      status?: string;
                                  };
                              };
                              headers: { [name: string]: unknown };
                          };
                      };
                  },
              >,
              `${string}/${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<
          FetchResponse<
              {
                  parameters: {
                      cookie?: never;
                      header?: never;
                      path: { code: string; imgid: number };
                      query?: never;
                  };
                  requestBody?: never;
                  responses: {
                      "200": {
                          content: {
                              "application/json": {
                                  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?:
                                      | "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;
                                      };
                                  }[];
                              };
                          };
                          headers: { [name: string]: unknown };
                      };
                      "403": { content?: never; headers: { [name: string]: unknown } };
                      "404": { content?: never; headers: { [name: string]: unknown } };
                  };
              },
              { params: { path: { code: string; imgid: number } } },
              `${string}/${string}`,
          >,
      >

      A promise that resolves to the deletion response

    • Returns all available attribute groups

      Returns Promise<
          FetchResponse<
              {
                  parameters: {
                      cookie?: never;
                      header?: never;
                      path?: never;
                      query?: { lc?: string };
                  };
                  requestBody?: never;
                  responses: {
                      "200": {
                          content: {
                              "application/json": {
                                  attributes?: {
                                      default?: (...)
                                      | (...)
                                      | (...)
                                      | (...);
                                      icon_url?: string;
                                      id?: string;
                                      name?: string;
                                      panel_id?: string;
                                      setting_name?: string;
                                      setting_note?: string;
                                  }[];
                                  id?: string;
                                  name?: string;
                              }[];
                          };
                          headers: { [name: string]: unknown };
                      };
                  };
              },
              FetchOptions<
                  {
                      parameters: {
                          cookie?: never;
                          header?: never;
                          path?: never;
                          query?: { lc?: string };
                      };
                      requestBody?: never;
                      responses: {
                          "200": {
                              content: {
                                  "application/json": {
                                      attributes?: {
                                          default?: ...;
                                          icon_url?: ...;
                                          id?: ...;
                                          name?: ...;
                                          panel_id?: ...;
                                          setting_name?: ...;
                                          setting_note?: ...;
                                      }[];
                                      id?: string;
                                      name?: string;
                                  }[];
                              };
                              headers: { [name: string]: unknown };
                          };
                      };
                  },
              >,
              `${string}/${string}`,
          >,
      >

      A promise that resolves to an array of attribute groups

    • Parameters

      • facet: string
      • Optionalopts: {
            page?: number;
            pageSize?: number;
            sortBy?:
                | "popularity"
                | "last_modified_t"
                | "environmental_score_score"
                | "created_t";
        }

      Returns Promise<FacetResponse>

    • Parameters

      • facet: string
      • value: string
      • opts: {
            page?: number;
            pageSize?: number;
            sortBy?:
                | "popularity"
                | "last_modified_t"
                | "environmental_score_score"
                | "created_t";
        }

      Returns Promise<FacetValueResponse>

    • Returns product attributes for a given barcode

      Parameters

      • barcode: string

        The barcode of the product

      Returns Promise<ProductAttributeV2[]>

      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<string[]>

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

    • Returns product data using the V2 API

      Parameters

      • barcode: string

        The barcode of the product

      Returns Promise<
          FetchResponse<
              {
                  parameters: {
                      cookie?: never;
                      header?: never;
                      path: { code: string };
                      query?: {
                          activate_knowledge_panel_physical_activities?: boolean;
                          activate_knowledge_panels_simplified?: boolean;
                          blame?: string;
                          cc?: string;
                          fields?: string;
                          knowledge_panel_client?: string;
                          knowledge_panels_excluded?: string;
                          knowledge_panels_included?: string;
                          lc?: string;
                          product_type?: "all" | "product" | "beauty" | "food" | "petfood";
                      };
                  };
                  requestBody?: never;
                  responses: {
                      "200": {
                          content: {
                              "application/json": | {
                                  code?: string;
                                  status?: 0
                                  | 1;
                                  status_verbose?: string;
                              } & {
                                  product?: {
                                      abbreviated_product_name?: ...;
                                      code: ...;
                                      codes_tags?: ...;
                                      generic_name?: ...;
                                      id?: ...;
                                      lang?: ...;
                                      lc?: ...;
                                      nova_group?: ...;
                                      nova_groups?: ...;
                                      obsolete?: ...;
                                      obsolete_since_date?: ...;
                                      product_name?: ...;
                                      product_quantity?: ...;
                                      product_quantity_unit?: ...;
                                      quantity?: ...;
                                      schema_version: ...;
                                  } & { [key: ...]: ... } & { product_type?: ... } & {
                                      additives_n?: ...;
                                      checked?: ...;
                                      complete?: ...;
                                      completeness?: ...;
                                      ecoscore_grade?: ...;
                                      ecoscore_score?: ...;
                                      food_groups?: ...;
                                      food_groups_tags?: ...;
                                      nutrient_levels?: ...;
                                      packaging_text?: ...;
                                      packagings?: ...;
                                      packagings_complete?: ...;
                                      pnns_groups_1?: ...;
                                      pnns_groups_1_tags?: ...;
                                      pnns_groups_2?: ...;
                                      pnns_groups_2_tags?: ...;
                                      popularity_key?: ...;
                                      popularity_tags?: ...;
                                      scans_n?: ...;
                                      serving_quantity?: ...;
                                      serving_quantity_unit?: ...;
                                      serving_size?: ...;
                                      unique_scans_n?: ...;
                                  } & { [key: ...]: ... } & {
                                      brands?: ...;
                                      brands_hierarchy?: ...;
                                      brands_lc?: ...;
                                      brands_tags?: ...;
                                      categories?: ...;
                                      categories_hierarchy?: ...;
                                      categories_lc?: ...;
                                      categories_tags?: ...;
                                      checkers_tags?: ...;
                                      cities?: ...;
                                      cities_tags?: ...;
                                      correctors_tags?: ...;
                                      countries?: ...;
                                      countries_hierarchy?: ...;
                                      countries_lc?: ...;
                                      countries_tags?: ...;
                                      ecoscore_tags?: ...;
                                      emb_codes?: ...;
                                      emb_codes_orig?: ...;
                                      emb_codes_tags?: ...;
                                      entry_dates_tags?: ...;
                                      labels?: ...;
                                      labels_hierarchy?: ...;
                                      labels_lc?: ...;
                                      labels_tags?: ...;
                                      manufacturing_places?: ...;
                                      manufacturing_places_tags?: ...;
                                      nova_groups_tags?: ...;
                                      nutrient_levels_tags?: ...;
                                  } & {
                                      image_small_url?: ...;
                                      image_thumb_url?: ...;
                                      image_url?: ...;
                                      images?: ...;
                                      last_image_dates_tags?: ...;
                                      last_image_t?: ...;
                                      selected_images?: ...;
                                  } & { [key: ...]: ... } & {
                                      ecoscore_data?: ...;
                                      ecoscore_extended_data_version?: ...;
                                      environment_impact_level?: ...;
                                      environment_impact_level_tags?: ...;
                                  } & {
                                      additives_tags?: ...;
                                      allergens?: ...;
                                      allergens_hierarchy?: ...;
                                      allergens_lc?: ...;
                                      allergens_tags?: ...;
                                      ingredients?: ...;
                                      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_lc?: ...;
                                      ingredients_n?: ...;
                                      ingredients_n_tags?: ...;
                                      ingredients_non_nutritive_sweeteners_n?: ...;
                                      ingredients_original_tags?: ...;
                                      ingredients_percent_analysis?: ...;
                                      ingredients_sweeteners_n?: ...;
                                      ingredients_tags?: ...;
                                      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?: ...;
                                      origins_tags?: ...;
                                      traces?: ...;
                                      traces_hierarchy?: ...;
                                      traces_lc?: ...;
                                      traces_tags?: ...;
                                      unknown_ingredients_n?: ...;
                                  } & { [key: ...]: ... } & {
                                      no_nutrition_data?: ...;
                                      nutriments?: ...;
                                      nutriscore_data?: ...;
                                      nutrition_data_per?: ...;
                                      nutrition_data_prepared_per?: ...;
                                      nutrition_grade_fr?: ...;
                                      nutrition_grades?: ...;
                                      nutrition_grades_tags?: ...;
                                      nutrition_score_beverage?: ...;
                                      nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients?: ...;
                                      nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value?: ...;
                                      nutrition_score_warning_no_fiber?: ...;
                                      other_nutritional_substances_tags?: ...;
                                      unknown_nutrients_tags?: ...;
                                      vitamins_tags?: ...;
                                  } & {
                                      nutriscore?: ...;
                                      nutriscore_2021_tags?: ...;
                                      nutriscore_2023_tags?: ...;
                                      nutriscore_data?: ...;
                                      nutriscore_grade?: ...;
                                      nutriscore_score?: ...;
                                      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?: ...;
                                      misc_tags?: ...;
                                      states?: ...;
                                      states_hierarchy?: ...;
                                      states_tags?: ...;
                                  } & {
                                      added_countries_tags?: ...;
                                      additives_original_tags?: ...;
                                      additives_prev_original_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?: ...;
                                      link?: ...;
                                      main_countries_tags?: ...;
                                      minerals_prev_tags?: ...;
                                      minerals_tags?: ...;
                                      nova_groups_markers?: ...;
                                      nucleotides_tags?: ...;
                                      origin?: ...;
                                      owner_fields?: ...;
                                      purchase_places?: ...;
                                      purchase_places_tags?: ...;
                                      stores?: ...;
                                      stores_tags?: ...;
                                      traces_from_ingredients?: ...;
                                      traces_from_user?: ...;
                                  } & { [key: ...]: ... } & {
                                      created_t?: ...;
                                      creator?: ...;
                                      editors_tags?: ...;
                                      informers_tags?: ...;
                                      interface_version_created?: ...;
                                      interface_version_modified?: ...;
                                      languages?: ...;
                                      languages_codes?: ...;
                                      languages_hierarchy?: ...;
                                      languages_tags?: ...;
                                      last_edit_dates_tags?: ...;
                                      last_editor?: ...;
                                      last_modified_by?: ...;
                                      last_modified_t?: ...;
                                      last_updated_t?: ...;
                                      owner?: ...;
                                      owners_tags?: ...;
                                      photographers_tags?: ...;
                                      rev?: ...;
                                      sources?: ...;
                                      sources_fields?: ...;
                                      teams?: ...;
                                      teams_tags?: ...;
                                      update_key?: ...;
                                  } & { knowledge_panels?: ... } & { attribute_groups?: ... };
                              }
                              | { code?: string; status?: 0
                              | 1; status_verbose?: string } & {
                                  blame?: {
                                      fields?: { [key: ...]: ... };
                                      nutriments?: { [key: ...]: ... };
                                      packagings?: { [key: ...]: ... };
                                      selected_images?: { [key: ...]: ... };
                                      uploaded_images?: { [key: ...]: ... };
                                  };
                                  product?: {
                                      abbreviated_product_name?: ...;
                                      code: ...;
                                      codes_tags?: ...;
                                      generic_name?: ...;
                                      id?: ...;
                                      lang?: ...;
                                      lc?: ...;
                                      nova_group?: ...;
                                      nova_groups?: ...;
                                      obsolete?: ...;
                                      obsolete_since_date?: ...;
                                      product_name?: ...;
                                      product_quantity?: ...;
                                      product_quantity_unit?: ...;
                                      quantity?: ...;
                                      schema_version: ...;
                                  } & { [key: ...]: ... } & { product_type?: ... } & {
                                      additives_n?: ...;
                                      checked?: ...;
                                      complete?: ...;
                                      completeness?: ...;
                                      ecoscore_grade?: ...;
                                      ecoscore_score?: ...;
                                      food_groups?: ...;
                                      food_groups_tags?: ...;
                                      nutrient_levels?: ...;
                                      packaging_text?: ...;
                                      packagings?: ...;
                                      packagings_complete?: ...;
                                      pnns_groups_1?: ...;
                                      pnns_groups_1_tags?: ...;
                                      pnns_groups_2?: ...;
                                      pnns_groups_2_tags?: ...;
                                      popularity_key?: ...;
                                      popularity_tags?: ...;
                                      scans_n?: ...;
                                      serving_quantity?: ...;
                                      serving_quantity_unit?: ...;
                                      serving_size?: ...;
                                      unique_scans_n?: ...;
                                  } & { [key: ...]: ... } & {
                                      brands?: ...;
                                      brands_hierarchy?: ...;
                                      brands_lc?: ...;
                                      brands_tags?: ...;
                                      categories?: ...;
                                      categories_hierarchy?: ...;
                                      categories_lc?: ...;
                                      categories_tags?: ...;
                                      checkers_tags?: ...;
                                      cities?: ...;
                                      cities_tags?: ...;
                                      correctors_tags?: ...;
                                      countries?: ...;
                                      countries_hierarchy?: ...;
                                      countries_lc?: ...;
                                      countries_tags?: ...;
                                      ecoscore_tags?: ...;
                                      emb_codes?: ...;
                                      emb_codes_orig?: ...;
                                      emb_codes_tags?: ...;
                                      entry_dates_tags?: ...;
                                      labels?: ...;
                                      labels_hierarchy?: ...;
                                      labels_lc?: ...;
                                      labels_tags?: ...;
                                      manufacturing_places?: ...;
                                      manufacturing_places_tags?: ...;
                                      nova_groups_tags?: ...;
                                      nutrient_levels_tags?: ...;
                                  } & {
                                      image_small_url?: ...;
                                      image_thumb_url?: ...;
                                      image_url?: ...;
                                      images?: ...;
                                      last_image_dates_tags?: ...;
                                      last_image_t?: ...;
                                      selected_images?: ...;
                                  } & { [key: ...]: ... } & {
                                      ecoscore_data?: ...;
                                      ecoscore_extended_data_version?: ...;
                                      environment_impact_level?: ...;
                                      environment_impact_level_tags?: ...;
                                  } & {
                                      additives_tags?: ...;
                                      allergens?: ...;
                                      allergens_hierarchy?: ...;
                                      allergens_lc?: ...;
                                      allergens_tags?: ...;
                                      ingredients?: ...;
                                      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_lc?: ...;
                                      ingredients_n?: ...;
                                      ingredients_n_tags?: ...;
                                      ingredients_non_nutritive_sweeteners_n?: ...;
                                      ingredients_original_tags?: ...;
                                      ingredients_percent_analysis?: ...;
                                      ingredients_sweeteners_n?: ...;
                                      ingredients_tags?: ...;
                                      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?: ...;
                                      origins_tags?: ...;
                                      traces?: ...;
                                      traces_hierarchy?: ...;
                                      traces_lc?: ...;
                                      traces_tags?: ...;
                                      unknown_ingredients_n?: ...;
                                  } & { [key: ...]: ... } & {
                                      no_nutrition_data?: ...;
                                      nutriments?: ...;
                                      nutriscore_data?: ...;
                                      nutrition_data_per?: ...;
                                      nutrition_data_prepared_per?: ...;
                                      nutrition_grade_fr?: ...;
                                      nutrition_grades?: ...;
                                      nutrition_grades_tags?: ...;
                                      nutrition_score_beverage?: ...;
                                      nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients?: ...;
                                      nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients_value?: ...;
                                      nutrition_score_warning_no_fiber?: ...;
                                      other_nutritional_substances_tags?: ...;
                                      unknown_nutrients_tags?: ...;
                                      vitamins_tags?: ...;
                                  } & {
                                      nutriscore?: ...;
                                      nutriscore_2021_tags?: ...;
                                      nutriscore_2023_tags?: ...;
                                      nutriscore_data?: ...;
                                      nutriscore_grade?: ...;
                                      nutriscore_score?: ...;
                                      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?: ...;
                                      misc_tags?: ...;
                                      states?: ...;
                                      states_hierarchy?: ...;
                                      states_tags?: ...;
                                  } & {
                                      added_countries_tags?: ...;
                                      additives_original_tags?: ...;
                                      additives_prev_original_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?: ...;
                                      link?: ...;
                                      main_countries_tags?: ...;
                                      minerals_prev_tags?: ...;
                                      minerals_tags?: ...;
                                      nova_groups_markers?: ...;
                                      nucleotides_tags?: ...;
                                      origin?: ...;
                                      owner_fields?: ...;
                                      purchase_places?: ...;
                                      purchase_places_tags?: ...;
                                      stores?: ...;
                                      stores_tags?: ...;
                                      traces_from_ingredients?: ...;
                                      traces_from_user?: ...;
                                  } & { [key: ...]: ... } & {
                                      created_t?: ...;
                                      creator?: ...;
                                      editors_tags?: ...;
                                      informers_tags?: ...;
                                      interface_version_created?: ...;
                                      interface_version_modified?: ...;
                                      languages?: ...;
                                      languages_codes?: ...;
                                      languages_hierarchy?: ...;
                                      languages_tags?: ...;
                                      last_edit_dates_tags?: ...;
                                      last_editor?: ...;
                                      last_modified_by?: ...;
                                      last_modified_t?: ...;
                                      last_updated_t?: ...;
                                      owner?: ...;
                                      owners_tags?: ...;
                                      photographers_tags?: ...;
                                      rev?: ...;
                                      sources?: ...;
                                      sources_fields?: ...;
                                      teams?: ...;
                                      teams_tags?: ...;
                                      update_key?: ...;
                                  } & { knowledge_panels?: ... } & { attribute_groups?: ... };
                              }
                              | { code?: string; status?: 0
                              | 1; status_verbose?: string } & {
                                  product?: { knowledge_panels?: { [key: ...]: ... } };
                              };
                          };
                          headers: { [name: string]: unknown };
                      };
                      "302": {
                          content?: never;
                          headers: { Location?: string; [name: string]: unknown };
                      };
                      "404": { content?: never; headers: { [name: string]: unknown } };
                  };
              },
              { params: { path: { code: string } } },
              `${string}/${string}`,
          >,
      >

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

    • Returns product details by barcode with optional fields

      Type Parameters

      • Key extends string[]

      Parameters

      • barcode: string

        The barcode of the product

      • Optionalquery: Omit<
            {
                activate_knowledge_panel_physical_activities?: boolean;
                activate_knowledge_panels_simplified?: boolean;
                cc?: string;
                fields?: string;
                knowledge_panel_client?: string;
                knowledge_panels_excluded?: string;
                knowledge_panels_included?: string;
                lc?: string;
                product_type?: "all"
                | "product"
                | "beauty"
                | "food"
                | "petfood";
                tags_lc?: string;
            },
            "fields",
        > & { fields?: Key }

        An optional query object to filter the returned fields

      Returns Promise<{ data: ProductStateV3<ProductStateType<Key>>; error: any }>

      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
      • OptionalocrEngine: "google_cloud_vision"

      Returns Promise<
          FetchResponse<
              {
                  parameters: {
                      cookie?: never;
                      header?: never;
                      path?: never;
                      query: {
                          code: string;
                          id: string;
                          ocr_engine: string;
                          process_image: string;
                      };
                  };
                  requestBody?: never;
                  responses: {
                      "200": {
                          content: { "application/json": { status?: number } };
                          headers: { [name: string]: unknown };
                      };
                  };
              },
              {
                  params: {
                      query: {
                          code: string;
                          id: string;
                          ocr_engine: "google_cloud_vision";
                          process_image: string;
                      };
                  };
              },
              `${string}/${string}`,
          >,
      >

    • 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<
          FetchResponse<
              {
                  parameters: {
                      cookie?: never;
                      header?: never;
                      path?: never;
                      query: { angle: string; code: string; id: string; imgid: string };
                  };
                  requestBody?: never;
                  responses: {
                      "200": {
                          content: {
                              "application/json": {
                                  image?: { display_url?: string };
                                  imagefield?: string;
                                  status?: string;
                              };
                          };
                          headers: { [name: string]: unknown };
                      };
                  };
              },
              {
                  params: {
                      query: { angle: string; code: string; id: string; imgid: string };
                  };
              },
              `${string}/${string}`,
          >,
      >

      A promise that resolves to the rotation response

    • Parameters

      • query: {
            "<nutrient>_eq_<value>"?: { [key: string]: string };
            "<nutrient>_gt_<value>"?: { [key: string]: string };
            "<nutrient>_lt_<value>"?: { [key: string]: string };
            "<tag_name>_tags_<language_code>"?: { [key: string]: string };
            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?:
                | "last_modified_t"
                | "created_t"
                | "product_name"
                | "scans_n"
                | "unique_scans_n"
                | "completeness"
                | "popularity_key"
                | "nutriscore_score"
                | "nova_score"
                | "nothing"
                | "ecoscore_score";
            states_tags?: string;
            stores_tags?: string;
            traces_tags?: string;
        }
        • Optional<nutrient>_eq_<value>?: { [key: string]: string }

          Search on nutrient for an exact quantity

        • Optional<nutrient>_gt_<value>?: { [key: string]: string }

          Search on nutrient greater than a value

        • Optional<nutrient>_lt_<value>?: { [key: string]: string }

          Search on nutrient lower than a value

        • Optional<tag_name>_tags_<language_code>?: { [key: string]: string }

          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?:
              | "last_modified_t"
              | "created_t"
              | "product_name"
              | "scans_n"
              | "unique_scans_n"
              | "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<
          FetchResponse<
              {
                  parameters: {
                      cookie?: never;
                      header?: never;
                      path?: never;
                      query?: {
                          "<nutrient>_eq_<value>"?: { [key: string]: string };
                          "<nutrient>_gt_<value>"?: { [key: string]: string };
                          "<nutrient>_lt_<value>"?: { [key: string]: string };
                          "<tag_name>_tags_<language_code>"?: { [key: string]: string };
                          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?:
                              | "last_modified_t"
                              | "created_t"
                              | "product_name"
                              | "scans_n"
                              | "unique_scans_n"
                              | "completeness"
                              | "popularity_key"
                              | "nutriscore_score"
                              | "nova_score"
                              | "nothing"
                              | "ecoscore_score";
                          states_tags?: string;
                          stores_tags?: string;
                          traces_tags?: string;
                      };
                  };
                  requestBody?: never;
                  responses: {
                      "200": {
                          content: {
                              "application/json": {
                                  count?: number;
                                  page?: number;
                                  page_count?: number;
                                  page_size?: number;
                                  products?: (
                                      {
                                          abbreviated_product_name?: string;
                                          code: string;
                                          codes_tags?: (...)[];
                                          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_quantity?: string;
                                          product_quantity_unit?: string;
                                          quantity?: string;
                                          schema_version: number;
                                      } & { [key: string]: string } & {
                                          product_type?: (...) | (...) | (...) | (...);
                                      } & {
                                          additives_n?: number;
                                          checked?: string;
                                          complete?: number;
                                          completeness?: number;
                                          ecoscore_grade?: string;
                                          ecoscore_score?: number;
                                          food_groups?: string;
                                          food_groups_tags?: (...)[];
                                          nutrient_levels?: {
                                              fat?: ...;
                                              salt?: ...;
                                              "saturated-fat"?: ...;
                                              sugars?: ...;
                                          };
                                          packaging_text?: string;
                                          packagings?: (...)[];
                                          packagings_complete?: number;
                                          pnns_groups_1?: string;
                                          pnns_groups_1_tags?: (...)[];
                                          pnns_groups_2?: string;
                                          pnns_groups_2_tags?: (...)[];
                                          popularity_key?: number;
                                          popularity_tags?: (...)[];
                                          scans_n?: number;
                                          serving_quantity?: string;
                                          serving_quantity_unit?: string;
                                          serving_size?: string;
                                          unique_scans_n?: number;
                                      } & { [key: string]: string } & {
                                          brands?: string;
                                          brands_hierarchy?: (...)[];
                                          brands_lc?: string;
                                          brands_tags?: (...)[];
                                          categories?: string;
                                          categories_hierarchy?: (...)[];
                                          categories_lc?: string;
                                          categories_tags?: (...)[];
                                          checkers_tags?: (...)[];
                                          cities?: string;
                                          cities_tags?: (...)[];
                                          correctors_tags?: (...)[];
                                          countries?: string;
                                          countries_hierarchy?: (...)[];
                                          countries_lc?: string;
                                          countries_tags?: (...)[];
                                          ecoscore_tags?: (...)[];
                                          emb_codes?: string;
                                          emb_codes_orig?: string;
                                          emb_codes_tags?: (...)[];
                                          entry_dates_tags?: (...)[];
                                          labels?: string;
                                          labels_hierarchy?: (...)[];
                                          labels_lc?: string;
                                          labels_tags?: (...)[];
                                          manufacturing_places?: string;
                                          manufacturing_places_tags?: (...)[];
                                          nova_groups_tags?: (...)[];
                                          nutrient_levels_tags?: (...)[];
                                      } & {
                                          image_small_url?: string;
                                          image_thumb_url?: string;
                                          image_url?: string;
                                          images?: (...) & (...);
                                          last_image_dates_tags?: (...)[];
                                          last_image_t?: number;
                                          selected_images?: (...) & (...);
                                      } & { [key: string]: string } & {
                                          ecoscore_data?: {
                                              adjustments?: ...;
                                              agribalyse?: ...;
                                              grade?: ...;
                                              grades?: ...;
                                              missing?: ...;
                                              missing_data_warning?: ...;
                                              previous_data?: ...;
                                              score?: ...;
                                              scores?: ...;
                                              status?: ...;
                                          };
                                          ecoscore_extended_data_version?: string;
                                          environment_impact_level?: string;
                                          environment_impact_level_tags?: (...)[];
                                      } & {
                                          additives_tags?: (...)[];
                                          allergens?: string;
                                          allergens_hierarchy?: (...)[];
                                          allergens_lc?: string;
                                          allergens_tags?: (...)[];
                                          ingredients?: (...)[];
                                          ingredients_analysis?: {
                                              "en:palm-oil"?: ...;
                                              "en:vegan-status-unknown"?: ...;
                                              "en:vegetarian-status-unknown"?: ...;
                                          };
                                          ingredients_analysis_tags?: (...)[];
                                          ingredients_from_or_that_may_be_from_palm_oil_n?: number;
                                          ingredients_from_palm_oil_n?: number;
                                          ingredients_from_palm_oil_tags?: (...)[];
                                          ingredients_hierarchy?: (...)[];
                                          ingredients_lc?: string;
                                          ingredients_n?: number;
                                          ingredients_n_tags?: (...)[];
                                          ingredients_non_nutritive_sweeteners_n?: number;
                                          ingredients_original_tags?: (...)[];
                                          ingredients_percent_analysis?: number;
                                          ingredients_sweeteners_n?: number;
                                          ingredients_tags?: (...)[];
                                          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?: (...)[];
                                          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?: (...)[];
                                          origins_lc?: string;
                                          origins_tags?: (...)[];
                                          traces?: string;
                                          traces_hierarchy?: (...)[];
                                          traces_lc?: string;
                                          traces_tags?: (...)[];
                                          unknown_ingredients_n?: number;
                                      } & { [key: string]: string } & {
                                          no_nutrition_data?: string;
                                          nutriments?: (...) & (...);
                                          nutriscore_data?: {
                                              saturated_fat_ratio?: ...;
                                              saturated_fat_ratio_points?: ...;
                                              saturated_fat_ratio_value?: ...;
                                          };
                                          nutrition_data_per?: (...)
                                          | (...);
                                          nutrition_data_prepared_per?: (...) | (...);
                                          nutrition_grade_fr?: string;
                                          nutrition_grades?: string;
                                          nutrition_grades_tags?: (...)[];
                                          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?: (...)[];
                                          unknown_nutrients_tags?: (...)[];
                                          vitamins_tags?: (...)[];
                                      } & {
                                          nutriscore?: { "2021"?: ...; "2023"?: ... };
                                          nutriscore_2021_tags?: (...)[];
                                          nutriscore_2023_tags?: (...)[];
                                          nutriscore_data?: (...) & (...) & (...);
                                          nutriscore_grade?: (...) | (...) | (...) | (...) | (...);
                                          nutriscore_score?: number;
                                          nutriscore_score_opposite?: number;
                                          nutriscore_tags?: (...)[];
                                          nutriscore_version?: string;
                                      } & {
                                          data_quality_bugs_tags?: (...)[];
                                          data_quality_errors_tags?: (...)[];
                                          data_quality_info_tags?: (...)[];
                                          data_quality_tags?: (...)[];
                                          data_quality_warnings_tags?: (...)[];
                                          data_sources?: string;
                                          data_sources_tags?: (...)[];
                                          last_check_dates_tags?: (...)[];
                                          last_checked_t?: number;
                                          last_checker?: string;
                                          misc_tags?: (...)[];
                                          states?: string;
                                          states_hierarchy?: (...)[];
                                          states_tags?: (...)[];
                                      } & {
                                          added_countries_tags?: (...)[];
                                          additives_original_tags?: (...)[];
                                          additives_prev_original_tags?: (...)[];
                                          allergens_from_ingredients?: string;
                                          allergens_from_user?: string;
                                          amino_acids_prev_tags?: (...)[];
                                          amino_acids_tags?: (...)[];
                                          carbon_footprint_percent_of_known_ingredients?: number;
                                          categories_properties?: {
                                              "agribalyse_food_code:en"?: ...;
                                              "agribalyse_proxy_food_code:en"?: ...;
                                              "ciqual_food_code:en"?: ...;
                                          };
                                          categories_properties_tags?: (...)[];
                                          category_properties?: { [key: ...]: ... };
                                          ciqual_food_name_tags?: (...)[];
                                          compared_to_category?: string;
                                          conservation_conditions?: string;
                                          customer_service?: string;
                                          expiration_date?: string;
                                          link?: string;
                                          main_countries_tags?: (...)[];
                                          minerals_prev_tags?: (...)[];
                                          minerals_tags?: (...)[];
                                          nova_groups_markers?: { [key: ...]: ... };
                                          nucleotides_tags?: (...)[];
                                          origin?: string;
                                          owner_fields?: { additionalProperties?: ... };
                                          purchase_places?: string;
                                          purchase_places_tags?: (...)[];
                                          stores?: string;
                                          stores_tags?: (...)[];
                                          traces_from_ingredients?: string;
                                          traces_from_user?: string;
                                      } & { [key: string]: string } & {
                                          created_t?: number;
                                          creator?: string;
                                          editors_tags?: (...)[];
                                          informers_tags?: (...)[];
                                          interface_version_created?: string;
                                          interface_version_modified?: string;
                                          languages?: { [key: ...]: ... };
                                          languages_codes?: { [key: ...]: ... };
                                          languages_hierarchy?: (...)[];
                                          languages_tags?: (...)[];
                                          last_edit_dates_tags?: (...)[];
                                          last_editor?: string;
                                          last_modified_by?: string;
                                          last_modified_t?: number;
                                          last_updated_t?: number;
                                          owner?: string;
                                          owners_tags?: string;
                                          photographers_tags?: (...)[];
                                          rev?: number;
                                          sources?: (...)[];
                                          sources_fields?: { "org-gs1"?: ... };
                                          teams?: string;
                                          teams_tags?: (...)[];
                                          update_key?: string;
                                      } & { knowledge_panels?: { [key: ...]: ... } } & {
                                          attribute_groups?: (...)[];
                                      }
                                  )[];
                                  skip?: number;
                              };
                          };
                          headers: { [name: string]: unknown };
                      };
                  };
              },
              {
                  params: {
                      query: {
                          "<nutrient>_eq_<value>"?: { [key: string]: string };
                          "<nutrient>_gt_<value>"?: { [key: string]: string };
                          "<nutrient>_lt_<value>"?: { [key: string]: string };
                          "<tag_name>_tags_<language_code>"?: { [key: string]: string };
                          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?:
                              | "last_modified_t"
                              | "created_t"
                              | "product_name"
                              | "scans_n"
                              | "unique_scans_n"
                              | "completeness"
                              | "popularity_key"
                              | "nutriscore_score"
                              | "nova_score"
                              | "nothing"
                              | "ecoscore_score";
                          states_tags?: string;
                          stores_tags?: string;
                          traces_tags?: string;
                      };
                  };
              },
              `${string}/${string}`,
          >,
      >

    • 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<
          FetchResponse<
              {
                  parameters: {
                      cookie?: never;
                      header?: never;
                      path?: never;
                      query?: never;
                  };
                  requestBody?: {
                      content: { "multipart/form-data": { code?: string; id?: string } };
                  };
                  responses: {
                      "200": {
                          content: {
                              "application/json": {
                                  imagefield?: string;
                                  status?: string;
                                  status_code?: number;
                              };
                          };
                          headers: { [name: string]: unknown };
                      };
                  };
              },
              { body: { code: string; id: string } },
              `${string}/${string}`,
          >,
      >

      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<
          FetchResponse<
              {
                  parameters: {
                      cookie?: never;
                      header?: never;
                      path?: never;
                      query?: never;
                  };
                  requestBody?: {
                      content: {
                          "multipart/form-data": {
                              code: string;
                              imagefield: string;
                              imgupload_front_en: string;
                          } & {
                              app_name?: string;
                              app_uuid?: string;
                              app_version?: string;
                              comment?: string;
                              "User-Agent"?: string;
                          };
                      };
                  };
                  responses: {
                      "200": {
                          content: {
                              "application/json": {
                                  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;
                              };
                          };
                          headers: { [name: string]: unknown };
                      };
                  };
              },
              FetchOptions<
                  {
                      parameters: {
                          cookie?: never;
                          header?: never;
                          path?: never;
                          query?: never;
                      };
                      requestBody?: {
                          content: {
                              "multipart/form-data": {
                                  code: string;
                                  imagefield: string;
                                  imgupload_front_en: string;
                              } & {
                                  app_name?: string;
                                  app_uuid?: string;
                                  app_version?: string;
                                  comment?: string;
                                  "User-Agent"?: string;
                              };
                          };
                      };
                      responses: {
                          "200": {
                              content: {
                                  "application/json": {
                                      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;
                                  };
                              };
                              headers: { [name: string]: unknown };
                          };
                      };
                  },
              >,
              `${string}/${string}`,
          >,
      >

      A promise that resolves to the upload response

    • Parameters

      • barcode: string
      • params: { cc?: string; lc?: string } & {
            image_data_base64?: string;
            password?: string;
            selected?: {
                front?: {
                    [key: string]: {
                        generation?: {
                            angle?: number;
                            coordinates_image_size?: string;
                            normalize?: boolean;
                            white_magic?: boolean;
                            x1?: number;
                            x2?: string;
                            y1?: string;
                            y2?: string;
                        };
                        imgid?: number;
                        rev?: number;
                        sizes?: {
                            "100"?: { h?: number; url?: string; w?: number };
                            "200"?: { h?: number; url?: string; w?: number };
                            "400"?: { h?: number; url?: string; w?: number };
                            full?: { h?: number; url?: string; w?: number };
                        };
                    };
                };
                ingredients?: {
                    [key: string]: {
                        generation?: {
                            angle?: number;
                            coordinates_image_size?: string;
                            normalize?: boolean;
                            white_magic?: boolean;
                            x1?: number;
                            x2?: string;
                            y1?: string;
                            y2?: string;
                        };
                        imgid?: number;
                        rev?: number;
                        sizes?: {
                            "100"?: { h?: number; url?: string; w?: number };
                            "200"?: { h?: number; url?: string; w?: number };
                            "400"?: { h?: number; url?: string; w?: number };
                            full?: { h?: number; url?: string; w?: number };
                        };
                    };
                };
                nutrition?: {
                    [key: string]: {
                        generation?: {
                            angle?: number;
                            coordinates_image_size?: string;
                            normalize?: boolean;
                            white_magic?: boolean;
                            x1?: number;
                            x2?: string;
                            y1?: string;
                            y2?: string;
                        };
                        imgid?: number;
                        rev?: number;
                        sizes?: {
                            "100"?: { h?: number; url?: string; w?: number };
                            "200"?: { h?: number; url?: string; w?: number };
                            "400"?: { h?: number; url?: string; w?: number };
                            full?: { h?: number; url?: string; w?: number };
                        };
                    };
                };
                packaging?: {
                    [key: string]: {
                        generation?: {
                            angle?: number;
                            coordinates_image_size?: string;
                            normalize?: boolean;
                            white_magic?: boolean;
                            x1?: number;
                            x2?: string;
                            y1?: string;
                            y2?: string;
                        };
                        imgid?: number;
                        rev?: number;
                        sizes?: {
                            "100"?: { h?: number; url?: string; w?: number };
                            "200"?: { h?: number; url?: string; w?: number };
                            "400"?: { h?: number; url?: string; w?: number };
                            full?: { h?: number; url?: string; w?: number };
                        };
                    };
                };
            };
            user_id?: string;
        }
        • Optionalcc?: string

          2 letter code of the country of the user. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the country may be inferred by the IP address of the request. Full list at https://static.openfoodfacts.org/data/taxonomies/countries.json

        • Optionallc?: string

          2 letter code of the language of the interface. Used for localizing some fields in returned values (e.g. knowledge panels). If not passed, the language may be inferred by the country of the user (passed through the cc field or inferred by the IP address). Full list at https://static.openfoodfacts.org/data/taxonomies/languages.json

        • Optionalimage_data_base64?: string

          Base64 encoded image data (supported formats: JPEG, PNG, GIF, HEIC)

        • Optionalpassword?: string

          Format: password

          Password for login

        • Optionalselected?: {
              front?: {
                  [key: string]: {
                      generation?: {
                          angle?: number;
                          coordinates_image_size?: string;
                          normalize?: boolean;
                          white_magic?: boolean;
                          x1?: number;
                          x2?: string;
                          y1?: string;
                          y2?: string;
                      };
                      imgid?: number;
                      rev?: number;
                      sizes?: {
                          "100"?: { h?: number; url?: string; w?: number };
                          "200"?: { h?: number; url?: string; w?: number };
                          "400"?: { h?: number; url?: string; w?: number };
                          full?: { h?: number; url?: string; w?: number };
                      };
                  };
              };
              ingredients?: {
                  [key: string]: {
                      generation?: {
                          angle?: number;
                          coordinates_image_size?: string;
                          normalize?: boolean;
                          white_magic?: boolean;
                          x1?: number;
                          x2?: string;
                          y1?: string;
                          y2?: string;
                      };
                      imgid?: number;
                      rev?: number;
                      sizes?: {
                          "100"?: { h?: number; url?: string; w?: number };
                          "200"?: { h?: number; url?: string; w?: number };
                          "400"?: { h?: number; url?: string; w?: number };
                          full?: { h?: number; url?: string; w?: number };
                      };
                  };
              };
              nutrition?: {
                  [key: string]: {
                      generation?: {
                          angle?: number;
                          coordinates_image_size?: string;
                          normalize?: boolean;
                          white_magic?: boolean;
                          x1?: number;
                          x2?: string;
                          y1?: string;
                          y2?: string;
                      };
                      imgid?: number;
                      rev?: number;
                      sizes?: {
                          "100"?: { h?: number; url?: string; w?: number };
                          "200"?: { h?: number; url?: string; w?: number };
                          "400"?: { h?: number; url?: string; w?: number };
                          full?: { h?: number; url?: string; w?: number };
                      };
                  };
              };
              packaging?: {
                  [key: string]: {
                      generation?: {
                          angle?: number;
                          coordinates_image_size?: string;
                          normalize?: boolean;
                          white_magic?: boolean;
                          x1?: number;
                          x2?: string;
                          y1?: string;
                          y2?: string;
                      };
                      imgid?: number;
                      rev?: number;
                      sizes?: {
                          "100"?: { h?: number; url?: string; w?: number };
                          "200"?: { h?: number; url?: string; w?: number };
                          "400"?: { h?: number; url?: string; w?: number };
                          full?: { h?: number; url?: string; w?: number };
                      };
                  };
              };
          }

          Optional instructions to select (and possibly crop) the uploaded image for specific information (e.g. front, ingredients, nutrition, packaging) for specific languages.

          • Optionalfront?: {
                [key: string]: {
                    generation?: {
                        angle?: number;
                        coordinates_image_size?: string;
                        normalize?: boolean;
                        white_magic?: boolean;
                        x1?: number;
                        x2?: string;
                        y1?: string;
                        y2?: string;
                    };
                    imgid?: number;
                    rev?: number;
                    sizes?: {
                        "100"?: { h?: number; url?: string; w?: number };
                        "200"?: { h?: number; url?: string; w?: number };
                        "400"?: { h?: number; url?: string; w?: number };
                        full?: { h?: number; url?: string; w?: number };
                    };
                };
            }

            Front images of the full product in languages shown on the packaging. In most cases we have a front image selected for only one language, unless the product has different packagings for different countries with the same barcode, or if the product has two front sides (e.g. in bilingual countries).

          • Optionalingredients?: {
                [key: string]: {
                    generation?: {
                        angle?: number;
                        coordinates_image_size?: string;
                        normalize?: boolean;
                        white_magic?: boolean;
                        x1?: number;
                        x2?: string;
                        y1?: string;
                        y2?: string;
                    };
                    imgid?: number;
                    rev?: number;
                    sizes?: {
                        "100"?: { h?: number; url?: string; w?: number };
                        "200"?: { h?: number; url?: string; w?: number };
                        "400"?: { h?: number; url?: string; w?: number };
                        full?: { h?: number; url?: string; w?: number };
                    };
                };
            }

            Cropped images of the ingredients list in languages shown on the packaging.

          • Optionalnutrition?: {
                [key: string]: {
                    generation?: {
                        angle?: number;
                        coordinates_image_size?: string;
                        normalize?: boolean;
                        white_magic?: boolean;
                        x1?: number;
                        x2?: string;
                        y1?: string;
                        y2?: string;
                    };
                    imgid?: number;
                    rev?: number;
                    sizes?: {
                        "100"?: { h?: number; url?: string; w?: number };
                        "200"?: { h?: number; url?: string; w?: number };
                        "400"?: { h?: number; url?: string; w?: number };
                        full?: { h?: number; url?: string; w?: number };
                    };
                };
            }

            Cropped images of the nutrition facts table / list in languages shown on the packaging.

          • Optionalpackaging?: {
                [key: string]: {
                    generation?: {
                        angle?: number;
                        coordinates_image_size?: string;
                        normalize?: boolean;
                        white_magic?: boolean;
                        x1?: number;
                        x2?: string;
                        y1?: string;
                        y2?: string;
                    };
                    imgid?: number;
                    rev?: number;
                    sizes?: {
                        "100"?: { h?: number; url?: string; w?: number };
                        "200"?: { h?: number; url?: string; w?: number };
                        "400"?: { h?: number; url?: string; w?: number };
                        full?: { h?: number; url?: string; w?: number };
                    };
                };
            }

            Cropped images of the packaging / recycling information in languages shown on the packaging.

        • Optionaluser_id?: string

          Username for login

          Note: you must always use the username (and not the email)
          as it is far less brittle.
          

      Returns Promise<
          FetchResponse<
              {
                  parameters: {
                      cookie?: never;
                      header?: never;
                      path: { code: string };
                      query?: never;
                  };
                  requestBody?: {
                      content: {
                          "application/json": { cc?: string; lc?: string } & {
                              image_data_base64?: string;
                              password?: string;
                              selected?: {
                                  front?: {
                                      [key: string]: {
                                          generation?: {
                                              angle?: ...;
                                              coordinates_image_size?: ...;
                                              normalize?: ...;
                                              white_magic?: ...;
                                              x1?: ...;
                                              x2?: ...;
                                              y1?: ...;
                                              y2?: ...;
                                          };
                                          imgid?: number;
                                          rev?: number;
                                          sizes?: { "100"?: ...; "200"?: ...; "400"?: ...; full?: ... };
                                      };
                                  };
                                  ingredients?: {
                                      [key: string]: {
                                          generation?: {
                                              angle?: ...;
                                              coordinates_image_size?: ...;
                                              normalize?: ...;
                                              white_magic?: ...;
                                              x1?: ...;
                                              x2?: ...;
                                              y1?: ...;
                                              y2?: ...;
                                          };
                                          imgid?: number;
                                          rev?: number;
                                          sizes?: { "100"?: ...; "200"?: ...; "400"?: ...; full?: ... };
                                      };
                                  };
                                  nutrition?: {
                                      [key: string]: {
                                          generation?: {
                                              angle?: ...;
                                              coordinates_image_size?: ...;
                                              normalize?: ...;
                                              white_magic?: ...;
                                              x1?: ...;
                                              x2?: ...;
                                              y1?: ...;
                                              y2?: ...;
                                          };
                                          imgid?: number;
                                          rev?: number;
                                          sizes?: { "100"?: ...; "200"?: ...; "400"?: ...; full?: ... };
                                      };
                                  };
                                  packaging?: {
                                      [key: string]: {
                                          generation?: {
                                              angle?: ...;
                                              coordinates_image_size?: ...;
                                              normalize?: ...;
                                              white_magic?: ...;
                                              x1?: ...;
                                              x2?: ...;
                                              y1?: ...;
                                              y2?: ...;
                                          };
                                          imgid?: number;
                                          rev?: number;
                                          sizes?: { "100"?: ...; "200"?: ...; "400"?: ...; full?: ... };
                                      };
                                  };
                              };
                              user_id?: string;
                          };
                          "application/xml": Record<string, unknown>;
                      };
                  };
                  responses: {
                      "200": {
                          content: {
                              "application/json": {
                                  errors?: {
                                      field?: { id?: ...; value?: ... };
                                      impact?: {
                                          description?: ...;
                                          id?: ...;
                                          lc_description?: ...;
                                          lc_name?: ...;
                                          name?: ...;
                                      };
                                      message?: {
                                          description?: ...;
                                          id?: ...;
                                          lc_description?: ...;
                                          lc_name?: ...;
                                          name?: ...;
                                      };
                                  }[];
                                  result?: { id?: string; lc_name?: string; name?: string };
                                  status?:
                                      | "success"
                                      | "success_with_warnings"
                                      | "success_with_errors"
                                      | "failure";
                                  warnings?: {
                                      field?: { id?: ...; value?: ... };
                                      impact?: {
                                          description?: ...;
                                          id?: ...;
                                          lc_description?: ...;
                                          lc_name?: ...;
                                          name?: ...;
                                      };
                                      message?: {
                                          description?: ...;
                                          id?: ...;
                                          lc_description?: ...;
                                          lc_name?: ...;
                                          name?: ...;
                                      };
                                  }[];
                              } & { product?: { images?: { uploaded?: { [key: ...]: ... } } } };
                          };
                          headers: { [name: string]: unknown };
                      };
                  };
              },
              {
                  body: {
                      cc?: string;
                      image_data_base64?: string;
                      lc?: string;
                      password?: string;
                      selected?: {
                          front?: {
                              [key: string]: {
                                  generation?: {
                                      angle?: number;
                                      coordinates_image_size?: string;
                                      normalize?: boolean;
                                      white_magic?: boolean;
                                      x1?: number;
                                      x2?: string;
                                      y1?: string;
                                      y2?: string;
                                  };
                                  imgid?: number;
                                  rev?: number;
                                  sizes?: {
                                      "100"?: { h?: number; url?: string; w?: number };
                                      "200"?: { h?: number; url?: string; w?: number };
                                      "400"?: { h?: number; url?: string; w?: number };
                                      full?: { h?: number; url?: string; w?: number };
                                  };
                              };
                          };
                          ingredients?: {
                              [key: string]: {
                                  generation?: {
                                      angle?: number;
                                      coordinates_image_size?: string;
                                      normalize?: boolean;
                                      white_magic?: boolean;
                                      x1?: number;
                                      x2?: string;
                                      y1?: string;
                                      y2?: string;
                                  };
                                  imgid?: number;
                                  rev?: number;
                                  sizes?: {
                                      "100"?: { h?: number; url?: string; w?: number };
                                      "200"?: { h?: number; url?: string; w?: number };
                                      "400"?: { h?: number; url?: string; w?: number };
                                      full?: { h?: number; url?: string; w?: number };
                                  };
                              };
                          };
                          nutrition?: {
                              [key: string]: {
                                  generation?: {
                                      angle?: number;
                                      coordinates_image_size?: string;
                                      normalize?: boolean;
                                      white_magic?: boolean;
                                      x1?: number;
                                      x2?: string;
                                      y1?: string;
                                      y2?: string;
                                  };
                                  imgid?: number;
                                  rev?: number;
                                  sizes?: {
                                      "100"?: { h?: number; url?: string; w?: number };
                                      "200"?: { h?: number; url?: string; w?: number };
                                      "400"?: { h?: number; url?: string; w?: number };
                                      full?: { h?: number; url?: string; w?: number };
                                  };
                              };
                          };
                          packaging?: {
                              [key: string]: {
                                  generation?: {
                                      angle?: number;
                                      coordinates_image_size?: string;
                                      normalize?: boolean;
                                      white_magic?: boolean;
                                      x1?: number;
                                      x2?: string;
                                      y1?: string;
                                      y2?: string;
                                  };
                                  imgid?: number;
                                  rev?: number;
                                  sizes?: {
                                      "100"?: { h?: number; url?: string; w?: number };
                                      "200"?: { h?: number; url?: string; w?: number };
                                      "400"?: { h?: number; url?: string; w?: number };
                                      full?: { h?: number; url?: string; w?: number };
                                  };
                              };
                          };
                      };
                      user_id?: string;
                  };
                  params: { path: { code: string } };
              },
              `${string}/${string}`,
          >,
      >