API

nf.{PD:Api}

NatFirst Product Discovery API 1.0

Natfirst’s Product Discovery API is a comprehensive interface that allows getting the essential details on the packaged food products and the enhanced information that contains ingredient, nutrition and health tags.

The cataloguing and search filter service simplifies product organization and allows enhancing the customer shopping experience.

Additionally, we offer regulatory compliance solutions tailored for e-commerce platforms, ensuring a seamless and compliant online business environment.

The Product Discovery API is a comprehensive API that grants access to various resources and functionalities.

This documentation aims to provide an overview of the available endpoints and their usage.

Table of Content

+ Audience

This guide is for developers building e-commerce storefronts or applications. Learn how to use Natfirst's API for product organisation, improved search, and compliance solutions.

+ Required knowledge and Skills

HTTP Methods: You should be familiar with HTTP methods such as POST and GET. The API documentation specifies which method to use for each endpoint.

URLs:You need to understand how to construct URLs to access different API endpoints. The documentation provides the URLs for each endpoint.

Request Headers: The documentation mentions the required headers for each request. In this case, the "Authorization" header with the API key is required for authentication purposes. You should understand how to include headers in API requests.

Request Body: Some endpoints require a request body in JSON format. You need to understand how to construct the JSON payload and include it in the request. The documentation provides examples of the request body structure for the relevant endpoints.

Request Query Parameters: The documentation specifies query parameters for certain endpoints. Query parameters are included in the URL after a question mark and separated by ampersands. You should know how to include query parameters in API requests.

Authentication: The API uses an API key for authentication. You need to understand how to include the API key in the request headers to authenticate your API calls.

Barcode and Keywords: Depending on the endpoint, you may need to provide a barcode or keywords in the request. You should have a basic understanding of barcodes and how to provide relevant keywords for searching or categorizing products.

Additionally, familiarity with API development concepts, JSON data format, and how to handle API responses would be beneficial for effectively using this API.

+ Register for Natfirst API

Before you start using the for the Product Detailing API, you must have Natfirst API access key from Natfirst.

To sign up for the Product Detailing API

Contact us at api@natfirst.com for assistance.

+ Getting Started

This guide helps to get started with the Natfirst Product Detailing API. You can use the product details for your product listing and compliance requirements.

+ Understanding Product Tags & Filters

Product tags provide consumers with quick and clear information about the content of different products and empowers them with valuable information about the nutritional aspects and ingredients.

Product tags enable a consumer to make informed choices that align with their dietary preferences and requirements.

Here is the list of product tags an API user can search and filter the Products in Natfirst Product Detailing API.
Tag Name Description
HT_ARTIFICIAL_INGREDIENT_FREE Artificial Ingredient Free This tag indicates that the product is free from artificialingredients, ensuring a more natural and wholesome option.
HT_ARTIFICIAL_INGREDIENT_PRESENT Artificial Ingredient Present Conversely, this tag signals the presence of artificialingredients in the product.
HT_CALORIE_FREE Calorie Free Products with this tag are energy-free or calorie-free,making them suitable for those seeking low-calorie options.
HT_DAIRY_FREE Dairy Free This tag is applied to products that do not contain dairy ormilk components.
HT_DAIRY_PRESENT Dairy Present Conversely, this tag denotes that the product does containdairy or milk.
HT_GLUTEN_FREE Gluten Free Products with this tag are free from gluten, making themsuitable for individuals with gluten sensitivities or celiac disease.
HT_GLUTEN_PRESENT Gluten Present On the other hand, this tag indicates the presence of glutenin the product.
HT_GOOD_SOURCE_FIBER Good Source Fiber This tag highlights products that are considered a goodsource of dietary fiber, beneficial for digestion and overall health.
HT_HIGH_ADDED_SUGARS High Added Sugars Products with this tag contain a high amount of addedsugars.
HT_HIGH_CALORIE High Calorie This tag indicates that the product is high in energy orcalories, important for individuals looking for more substantial energyintake.
HT_HIGH_CHOLESTEROL High Cholesterol Products with this tag contain high cholesterol levels.
HT_HIGH_FAT High Fat This tag is applied to products that have a high fatcontent.
HT_HIGH_SAT_FAT High Saturated Fat Conversely, this tag indicates the presence of high levelsof saturated fat in the product.
HT_HIGH_SODIUM High Sodium This tag is used for products with high sodium (salt)content.
HT_HIGH_TRANS_FAT High Trans Fat Products with this tag contain high levels of trans fat,which can be detrimental to health when consumed in excess.
HT_LACTOSE_FREE Lactose Free This tag indicates that the product is lactose-free,suitable for individuals with lactose intolerance.
HT_LACTOSE_PRESENT Lactose Present Conversely, this tag denotes that the product does containlactose.
HT_LOW_ADDED_SUGARS Low Added Sugars Products with this tag contain a low amount of added sugars.
HT_LOW_CALORIE Low Calorie This tag indicates that the product is low in energy orcalories, suitable for those looking to manage their caloric intake.
HT_LOW_CHOLESTEROL Low Cholesterol Products with this tag contain low levels of cholesterol.
HT_LOW_FAT Low Fat This tag is applied to products that have a low fat content.
HT_LOW_SAT_FAT Low Saturated Fat Conversely, this tag indicates the presence of low levels ofsaturated fat in the product.
HT_LOW_SODIUM Low Sodium This tag is used for products with low sodium (salt)content.
HT_LOW_TRANS_FAT Low Trans Fat Products with this tag contain low levels of trans fat.
HT_NON_VEGETARIAN Non-Vegetarian This tag signifies that the product is not suitable forvegetarians as it contains animal-derived ingredients.
HT_PEANUT_FREE Peanut Free Products with this tag are free from peanuts.
HT_PEANUT_PRESENT Peanut Present Conversely, this tag denotes the presence of peanuts in theproduct.
HT_RICH_SOURCE_FIBER Rich Source Fiber This tag highlights products that are a rich source ofdietary fiber, offering significant health benefits.
HT_RICH_SOURCE_PROTEIN Rich Source Protein This tag indicates that the product is a rich source ofprotein, essential for building and repairing tissues in the body.
HT_SOY_FREE Soy Free Products with this tag are free from soy or soy-derivedingredients.
HT_SOY_PRESENT Soy Present Conversely, this tag indicates the presence of soy in theproduct.
HT_TREE_NUTS_FREE Tree Nuts Free Products with this tag are free from tree nuts.
HT_TREE_NUTS_PRESENT Tree Nuts Present Conversely, this tag denotes the presence of tree nuts inthe product.
HT_VEGAN Vegan This tag signifies that the product is suitable for vegans,containing no animal-derived ingredients.
HT_VEGETARIAN Vegetarian Products with this tag are suitable for vegetarians, freefrom meat and fish ingredients.

+ Understanding Product Categories

Product category is a group of similar products put together based on their characteristics, functionalities, or intended use.

Product categories enable consumers to compare similar items easily. When products with similar functions or features are grouped together, customers can make more informed decisions based on their preferences and needs.

Here is the brief introduction to each product category in TruthIn API.
Tag Name Description
CAT_BAKERY Bakery In this category, you will find a delightful assortmentprepared with the finest ingredients to satisfy your cravings.
CAT_BISCUITS Cookies Treat yourself to a delectable selection of cookies in sweet delights are perfect companions for your tea or coffee breaks.
CAT_BREAKFAST_AND_SPREADS Breakfast Essentials Kickstart your day with our Breakfast Essentials and honey to make your mornings more enjoyable.
CAT_CHOCOLATES_AND_DESSERTS Sweets & Treats Indulge your sweet tooth with our tempting collection of mouthwatering desserts, you'll find something to satisfy your cravings.
CAT_COLD_DRINKS_AND_JUICES Beverages Stay refreshed with a range of cold drinks and juices. different tastes and preferences.
CAT_DAIRY_BREAD_AND_EGGS Daily Basics This category offers essential daily items such as dairy your kitchen needs.
CAT_DRY_FRUITS_OIL_AND_MASALAS Pantry Staples Stock up your pantry with our selection of dry fruits, creating flavorful and nutritious dishes.
CAT_INSTANT_FOODS Ready-To-Eat For those on the go or looking for quick meal options, that are both convenient and delicious.
CAT_MEAT Meat This category caters to meat enthusiasts, offering a dishes for your meals.
CAT_MUNCHIES Snacks Snack time becomes more enjoyable with our Snacks satisfy your cravings between meals.
CAT_RICE_ATTA_AND_DALS Grains & Pulses Find an extensive selection of rice, flour, and lentils many traditional and modern recipes.
CAT_TEA_COFFEE_AND_MORE Tea, Coffee, and More Embrace the world of beverages with our assortment of coffee-drinking experience.

+ Use Cases & Endpoints

base_url : https://api.natfirst.in

1. Get Categories


Description: The get-categories API returns the list of product category tags that can be used for retrieving

Products in Search API.

Process to invoke the API
  • HTTP Method: GET
  • URL: {base_url}/nfapi/get-categories/
  • Request Headers
Header Value Description
Api-key XXXX API key for authentication
Authorization api-key XXXX Authentication

Request Parameters: None


Response
                                
                        {
                            "data": [
                                        {
                                            "name": "Bakery",
                                            "category_tag": "CAT_BAKERY"
                                        },
                                        {
                                            "name": "Cookies",
                                            "category_tag": "CAT_BISCUITS"
                                        }
                                    ],
                            "message": "product category data retrieved",
                            "status": "success"
                        }
                            

2. Get Product Filters


Description: get-product-filters API returns the list of product filter tags that can be used for retrieving

Products in Search API.
  • HTTP Method: GET
  • URL: {base_url}/nfapi/get-product-filters/
  • Request Headers
Header Value Description
Api-key XXXX API key for authentication
Authorization api-key XXXX Authentication

Request Parameters: None


Response
                                
                            {
                                "data": [
                                            {"name": "High Trans fat","tag": "HT_HIGH_TRANS_FAT"
                                            },
                                            {"name": "FOR LACTOSE INTOLERANCE","tag": "HT_LACTOSE_FREE"
                                            },
                                            {"name": "MAY CAUSE LACTOSE INTOLERANCE","tag": "HT_LACTOSE_PRESENT"
                                            }
                                        ],
                                "message": "product filter data retrieved",
                                "status": "success"
                            }
                            

​3. Search


Description: Performs search based on the input Product Category tags, Product Filter tags and keywords. In Search payload, user can send one or more Category tags and Filter tags.

If no tag is specified, that defaults to All. For more information on supported Category tags and Filter tags refer to respective sections briefed above.

This API returns a list of products meeting the criteria.
  • HTTP Method: POST
  • URL: {base_url}/nfapi/search/
  • Request Headers
Header Value Description
Api-key XXXX API key for authentication
Authorization api-key XXXX Authentication

Request parameters to be sent as payload.

Parameter Example Value Description
product_tags HT_DAIRY_FREE One or more tags used for product filtering. If not specified, the default is set to 'ALL'.
category_tags CAT_MUNCHIES One or more tags used for category classification. If not specified, the default is 'ALL'.
keyword Biscuits Keywords are terms or phrases used to search for relevant products.

Request Body
  • Mode: raw (JSON)
  • Raw Body:

                                  
                                    { {
                                        "keyword": "biscuit",
                                        "product_tags": [
                                            "HT_DAIRY_FREE"
                                        ],
                                        "category_tags": [
                                            "CAT_DAIRY_BREAD_AND_EGGS",
                                            "CAT_MUNCHIES"
                                        ]
                                    } }
                            


Response
                                  
                                    {
                                        "status": "success",
                                        "message": "Products matching criteria",
                                        "data": {
                                            "products": [
                                                {
                                                    "name": "Monin Watermelon Bottle",
                                                    "barcode": "3052911222184",
                                                    "unit_of_measure": "ml",
                                                    "net_weight": 250.0,
                                                    "serving_size": 30.0,
                                                    "serving_size_unit": "ml",
                                                    "icon_file_name": "{aws_url}/images/3052911222184222184_front.png"
                                                },
                                                {
                                                    "name": "Tang Lemon Instant Drink Mix - No Artificial Flavours",
                                                    "barcode": "7622201636012",
                                                    "unit_of_measure": "g",
                                                    "net_weight": 500.0,
                                                    "serving_size": 17.0,
                                                    "serving_size_unit": "g",
                                                    "icon_file_name": "{aws_url}/images/7622201636012636012_front.png"
                                                },
                                                {
                                                    "name": "Mogu Mogu Juice Pineapple",
                                                    "barcode": "8850389100868",
                                                    "unit_of_measure": "ml",
                                                    "net_weight": 300.0,
                                                    "serving_size": 300.0,
                                                    "serving_size_unit": "ml",
                                                    "icon_file_name": "{aws_url}/images/8850389100868100868_front.png"
                                                }
                                            ],
                                            "current_page": 1,
                                            "items_per_page": 10,
                                            "total_items": 24,
                                            "is_last_page": false
                                        }
                                    }
                            

4. Get Product Details


Description: Retrieves product details based on the provided barcode.
  • HTTP Method: GET
  • URL: {base_url}/nfapi/pd/?barcode=070177180539
  • Request Headers
Header Value Description
Api-key XXXX API key for authentication
Authorization api-key XXXX Authentication

Request Query Parameters


Parameter Example Value Description
barcode 70177180539 The barcode serves as a distinctive identifier for a product, enabling the retrieval or lookup of its specific details.

Response
                                
                                            {
                                                "status": "success",
                                                "message": "Product details",
                                                "data": {
                                                    "product": {
                                                        "name": "Twinings Assam Tea",
                                                        "barcode": "070177180539",
                                                        "unit_of_measure": "g",
                                                        "net_weight": 50.0,
                                                        "serving_size": 2.0,
                                                        "serving_size_unit": "g",
                                                        "ingredient_text": "Tea in tea bags",
                                                        "nutrients": [
                                                            {
                                                                "weight": 7.23,
                                                                "unit_of_measure": "kcal",
                                                                "name": "Energy"
                                                            },
                                                            {
                                                                "weight": 0.02,
                                                                "unit_of_measure": "g",
                                                                "name": "Total Fat"
                                                            }
                                                        ],
                                                        "icon_file_name": "{aws_url}/images/070177180539_front.JPG",
                                                        "tags": [
                                                            "HT_ARTIFICIAL_INGREDIENT_FREE",
                                                            "HT_DAIRY_FREE",
                                                            "HT_GLUTEN_FREE",
                                                        ]
                                                    }
                                                }
                                            }

                            

+ Support

This API offers a range of endpoints to facilitate searches, retrieve product details, and obtain categories. To ensure successful interactions with the API, make sure to include the required headers, parameters, and request bodies as specified in the documentation.

© natfirst 2024 | All Rights Reserved