Overview

FoodData Central, established in 2019 by the U.S. Department of Agriculture (USDA), serves as a central repository for food and nutrient composition data. This system consolidates several data types, including foundational food data, experimental data, and survey data, providing a comprehensive resource for understanding the nutritional content of a wide array of foods. The FoodData Central API offers programmatic access to this extensive database, allowing developers to integrate detailed nutritional information directly into their applications and services. This makes it a valuable tool for various use cases, from developing dietary tracking apps to supporting scientific research on food composition.

The API is particularly well-suited for applications requiring authoritative and granular nutrient data. For instance, developers building health and wellness platforms can use the API to provide users with precise nutritional breakdowns of meals and ingredients. Academic researchers can leverage the data for studies on public health, food science, and dietary patterns, accessing information on specific nutrients, food groups, and preparation methods. Food product developers can utilize the API to formulate new products with specific nutritional profiles or to verify the nutrient content of existing items, ensuring compliance with labeling requirements and consumer expectations. Public health initiatives, such as those focused on nutrition education or chronic disease prevention, can also benefit from the readily available and standardized data provided by FoodData Central.

FoodData Central integrates data from multiple sources within the USDA, including the National Nutrient Database for Standard Reference (SR), the Food and Nutrient Database for Dietary Studies (FNDDS), and the Global Branded Food Products Database (BFPD). This integration provides a more complete picture of food composition, encompassing both generic and branded food items. The API's design focuses on ease of access and comprehensive data retrieval, offering various endpoints to search for foods, retrieve detailed nutrient profiles, and filter data based on specific criteria. The detailed FoodData Central API guide outlines the available endpoints and query parameters, facilitating integration for developers. The API's free availability further lowers the barrier to entry for a broad range of projects and organizations.

The system distinguishes between different types of food data. Foundation Foods provide comprehensive nutrient profiles for basic foods, often based on extensive laboratory analysis. SR Legacy Foods represent the historical data from the National Nutrient Database for Standard Reference. Branded Foods include specific product information from manufacturers, often containing proprietary data. Survey Foods are used in dietary surveys and provide nutrient data as consumed. This multi-faceted approach ensures that users can access the most appropriate data for their specific needs, whether they are analyzing raw agricultural products or consumer-ready meals. The API supports queries across these data types, allowing for flexible data retrieval and analysis.

Key features

  • Comprehensive Nutrient Data: Access detailed information on over 150 nutrients for thousands of foods, including vitamins, minerals, macronutrients, and amino acids.
  • Multiple Food Data Types: Retrieve data from Foundation Foods, SR Legacy Foods, Branded Foods, and Survey Foods, offering a broad spectrum of food composition information.
  • Advanced Search Capabilities: Search for foods by keywords, FDC ID, data type, or specific nutrient content, allowing for precise data retrieval.
  • Food-Specific Details: Obtain detailed information for individual food items, including descriptions, nutrient values, and associated publication references.
  • Ingredient and Recipe Analysis: Facilitate the nutritional analysis of recipes and multi-ingredient dishes by aggregating data from individual components.
  • Free Access: The API is entirely free to use, removing cost as a barrier for developers and researchers.
  • Interactive API Documentation: Utilizes Swagger UI for interactive testing of API endpoints and clear documentation of request and response structures, as detailed in the FoodData Central API reference.

Pricing

As of May 28, 2026, the FoodData Central API is provided free of charge by the USDA.

Service Tier Cost Features
Standard Access Free Full access to all FoodData Central API endpoints and data types.

For more details on usage policies, refer to the FoodData Central API Guide.

Common integrations

The FoodData Central API is designed for integration into various applications and platforms:

  • Health and Fitness Apps: Integrate nutritional data for meal tracking, diet planning, and health recommendations, similar to how platforms like Nutritionix API provide food database access for fitness applications.
  • Food Product Development Software: Incorporate data for R&D, nutritional labeling, and allergen management in food manufacturing.
  • Academic Research Platforms: Utilize the API for data collection and analysis in studies related to nutrition, public health, and food science.
  • E-commerce Platforms: Display detailed nutritional information for food products sold online, enhancing consumer transparency.
  • Educational Tools: Build interactive applications for teaching about nutrition and healthy eating habits.

Alternatives

  • Nutritionix API: Offers a comprehensive food database, including branded products and restaurant items, with a focus on ease of integration for commercial applications.
  • Edamam Nutrition Analysis API: Provides nutrition analysis for ingredients and recipes, along with diet and health label filtering capabilities.
  • FatSecret Platform API: Delivers access to a large food and nutrition database, including food diaries and exercise logs, geared towards health and fitness applications.

Getting started

To begin using the FoodData Central API, developers typically need to obtain an API key from the USDA. Once the key is acquired, it can be used to authenticate requests to the various endpoints. The API supports standard HTTP GET requests and returns data primarily in JSON format. Below is a Python example demonstrating how to search for food items and retrieve detailed nutrient information using the requests library.

This example first performs a search query for 'apple' and then, using an FDC ID obtained from the search results, fetches the complete nutrient profile for a specific apple entry. Error handling is included to manage potential issues with API requests or data parsing. For more extensive examples and a full list of parameters, consult the official FoodData Central API guide.

import requests
import json

# Replace with your actual API Key from USDA FoodData Central
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.nal.usda.gov/fdc/v1"

headers = {
    "Content-Type": "application/json"
}

def search_food(query):
    search_endpoint = f"{BASE_URL}/foods/search"
    params = {
        "api_key": API_KEY,
        "query": query
    }
    try:
        response = requests.get(search_endpoint, params=params, headers=headers)
        response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx)
        return response.json()
    except requests.exceptions.HTTPError as err:
        print(f"HTTP error occurred: {err}")
    except requests.exceptions.RequestException as err:
        print(f"An error occurred: {err}")
    return None

def get_food_details(fdc_id):
    details_endpoint = f"{BASE_URL}/food/{fdc_id}"
    params = {
        "api_key": API_KEY
    }
    try:
        response = requests.get(details_endpoint, params=params, headers=headers)
        response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx)
        return response.json()
    except requests.exceptions.HTTPError as err:
        print(f"HTTP error occurred: {err}")
    except requests.exceptions.RequestException as err:
        print(f"An error occurred: {err}")
    return None

if __name__ == "__main__":
    search_query = "apple"
    search_results = search_food(search_query)

    if search_results and search_results.get("foods"):
        print(f"Search results for '{search_query}':")
        # Print first few results to find an FDC ID
        for i, food_item in enumerate(search_results["foods"][:3]):
            print(f"  {i+1}. FDC ID: {food_item['fdcId']}, Description: {food_item['description']}")
        
        # Choose an FDC ID from the search results, e.g., the first one
        first_fdc_id = search_results["foods"][0]["fdcId"]
        print(f"\nRetrieving details for FDC ID: {first_fdc_id}")
        food_details = get_food_details(first_fdc_id)

        if food_details:
            print(f"\nDetails for {food_details.get('description')}:")
            print("Nutrients:")
            for nutrient in food_details.get("foodNutrients", [])[:5]: # Print first 5 nutrients
                unit_name = nutrient.get('nutrient', {}).get('unitName')
                value = nutrient.get('value')
                print(f"  - {nutrient.get('nutrient', {}).get('name')}: {value} {unit_name}")
        else:
            print(f"Could not retrieve details for FDC ID: {first_fdc_id}")
    else:
        print(f"No search results found for '{search_query}'.")