I've seen many applications (mobile and web) that use a database of nutritional information and barcodes to track daily food consumption. Smartphones have the ability to scan barcodes, and many mobile applications have started to include a barcode scanner to search for and log food consumption. Calorie Counter by MyFitnessPal is an example of this.

I would like to know where/how they get their resources. I found the National Nutrient Database provided by the USDA, but the most structured format that comes in is PDF. It also doesn't provide the barcodes that would be required for an app like Calorie Counter. It seems like the most reasonable approach for these applications would be to call an open API, rather than scraping PDFs.

Is there an open API for nutritional information and/or food label barcodes?


5 Answers 5


The complete USDA National Nutrient Database for Standard Reference can be downloaded as ASCII text files from here — no PDF scraping necessary. 🙂

Regarding product barcodes, have a look at Open Product Data, a new project by the Open Knowledge Foundation.


Have a look at OpenFoodFacts, which is a "free, open and collaborative database of food products from the entire world." It contains almost 920,000 items from around the world and may be helpful in solving your issue.


The USDA now provides an Open API for the National Nutrient Database for Standard Reference using data.gov. You need a data.gov API key in order to access this, and requests are sent to api.data.gov using the REST protocol.

  • 2
    This is true but the API does not allow lookup by UPC barcode number only lookup by their internal NDB number How do you go from UPC to NDB?
    – bhspencer
    Jul 8, 2017 at 14:58


Calorie table, Food Diary, Food Database


It's open data and anyone can contribute. Exists since 2004 and there are several apps in the Android app store which rely on this database


I just came accross FoodRepo, with currently 25027* products (*as of 2018-06-14)

Food Repo is an open, freely accessible database on barcoded food products. Importantly, Food Repo is accesisble through a high-performing API, ensuring that it can be used easily as a data source in web and phone applications. Food Repo is currently limited to Switzerland, but plans to eventually expand to other countries.

It seems to be many Swiss products - but it has photos, ingredient lists, nutritional information, and, of course, barcodes.

Example product: https://www.foodrepo.org/ch/products/2061?status=all

License statement:

Food Repo Content: All Content (other than computer software) made available by Food Repo on the websites, apps or services is licensed under the Creative Commons Attribution 4.0 International License, unless marked otherwise.

Not the answer you're looking for? Browse other questions tagged or ask your own question.