Nutrition Label API
#
Endpoint/nutrition-label
#
MethodGET
#
DescriptionThe Nutrition Label API allows users to parse an image of a nutrition label into the nutrition of the item.
#
URLhttps://us-central1-snapcalorieb2bapi.cloudfunctions.net/upc
#
Query Parameterskey
: The API key for authentication (required).image_url
: URL of an image or base64 image containing a nutritional label (optional)*.
#
Sample Requestcurl -X GET 'https://us-central1-snapcalorieb2bapi.cloudfunctions.net/nutrition-label?key=YOUR_API_KEY&image_url=https://www.fda.gov/files/nfl-howtounderstand-honey.png'
#
Sample Responses- Success Response:
{ "code": 200, "success": true, "data": { "name": "Nutrition Label", "alt_units": [ { "unit": "serving", "weight_in_grams": 21 } ], "selected_portion": { "quantity": 1, "unit": "serving" }, "selected_portion_nutrition": { // If field is available and visible on nutriton label. "mass_g": 21, "calories_kcal": 60, "carb_g": 17, "fat_g": 0, "protein_g": 0, "sugar_g": 17, "fiber_g": 0, "sodium_mg": 0, "vitamin_c_mg": 0, "vitamin_d_iu": 0, "calcium_mg": 0, "iron_mg": 0, "potassium_mg": 0, "cholesterol_mg": 0, "saturated_fats_g": 0, "trans_fats_g": 0 }, "nutrition_per_100g": { // This is only returned if mass is visible on the label "mass_g": 100, "calories_kcal": 285.7143, "carb_g": 80.9524, "fat_g": 0, "protein_g": 0,
// Detailed Nutrients if available on label "sugar_g": 80.9524, "fiber_g": 0, "sodium_mg": 0, "vitamin_c_mg": 0, "vitamin_d_iu": 0, "calcium_mg": 0, "iron_mg": 0, "potassium_mg": 0, "cholesterol_mg": 0, "saturated_fats_g": 0, "trans_fats_g": 0 }, }}
- Incomplete Nutrition Label or No Label in Image:
{ "code": 200, "success": false, "text": "Unable to Parse Label"}
- Error Response:
See Error Responses for how the API will signal malformed or failed requests.