58

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?

39

The complete USDA National Nutrient Database for Standard Reference can be downloaded as ASCII text files from https://www.ars.usda.gov/Services/docs.htm?docid=8964 — no PDF scraping necessary :)

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

17

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.

15

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.

  • 1
    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 '17 at 14:58
1

FDDB

Calorie table, Food Diary, Food Database

http://fddb.info/db/en/index.html

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

0

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.

-3

I was in the same boat as you. I have been searching everywhere for an API for nutrition until I came across nutritionix.com. Check it out.

  • 5
    -1: It is not Open Data: nutritionix.com/terms "The site editor reserves all of the site editor’s rights, including but not limited to any and all copyrights" – Nicolas Raoul Oct 22 '14 at 5:23
  • Should this answer be deleted? – philshem Mar 6 '17 at 14:31
  • @philshem I'd say edited to reflect that it is not open data. – Swier Mar 8 '17 at 9:04

protected by philshem Jul 1 at 12:14

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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