USDA FoodData Central

USDA FoodData Central is the United States Department of Agriculture's official food composition database, providing detailed nutritional profiles for 300,000 plus branded and generic foods, free to use without commercial restrictions.

MoEngage <> USDA FoodData Central

The MoEngage <> USDA FoodData Central integration allows you to personalise health, nutrition, and grocery campaigns with authoritative food composition data at send time. Common use cases include surfacing nutritional details for foods a user has logged or purchased, or enriching dietary coaching campaigns with calorie and macronutrient breakdowns.

Integration

library_add_check

Prerequisites

Ensure you have a USDA FoodData Central API key. Free keys are available instantly at fdc.nal.usda.gov/api-key-signup.html.

Step 1: Get your USDA FoodData API key

  1. Navigate to fdc.nal.usda.gov/api-key-signup.html and submit the registration form.
  2. Your API key is emailed to you immediately. Copy it.

Step 2: Set up the Content API on MoEngage

  • Navigate to Dashboard > Settings > APIs and open the Content API tab.
  • Click Add Content API.
  • Fill in the details using the table below as a reference.
Key Value
Name Choose a descriptive name, for example USDA Food Nutrition Lookup.
Method GET
API URL

https://api.nal.usda.gov/fdc/v1/foods/search

Use /fdc/v1/food/{fdcId} to retrieve detailed data for a specific food by its FDC ID. Refer to the FoodData Central API reference.

Key Value Parameters
Parameter Example value Notes
api_key Your API key Required for every request.
query @user.last_logged_food Food name to search. Bind to a user attribute storing a recently logged food item.
pageSize 1 Number of results to return. Use 1 to get the closest match.
dataType Branded,Foundation Optional. Filter by data type to narrow results.
  • Click Validate to confirm the platform returns a response, then click Save.

Once saved, refer to the MoEngage documentation on using Content APIs in campaigns to learn how to reference response fields inside your campaign templates.

Understanding the API response

The response contains a foods array. Each object represents one food item with its nutritional data.

 

Response field Template variable example Description
foods[0].description {{ContentApi.foods[0].description}} Food name or description.
foods[0].brandOwner {{ContentApi.foods[0].brandOwner}} Brand name, if a branded food.
foods[0].foodNutrients[0].nutrientName {{ContentApi.foods[0].foodNutrients[0].nutrientName}} Name of the first nutrient in the list, for example "Protein".
foods[0].foodNutrients[0].value {{ContentApi.foods[0].foodNutrients[0].value}} Quantity of that nutrient per 100g.
foods[0].foodNutrients[0].unitName {{ContentApi.foods[0].foodNutrients[0].unitName}} Unit of measurement, for example G or KCAL.

Previous

Next

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?