# USDA Food Data Normalizer (`wakey7dev/usda-food-normalizer`) Actor

Search 500K+ foods from USDA FoodData Central with normalized brands, standardized categories, and converted nutrient units. Brand mapping, category dedup, per-serving values. Free API key.

- **URL**: https://apify.com/wakey7dev/usda-food-normalizer.md
- **Developed by:** [Chris Wakefield](https://apify.com/wakey7dev) (community)
- **Categories:** AI, Business
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

![Chris The Dev](https://raw.githubusercontent.com/chriswakefield87/appstore-screenshot-translator/main/assets/actor-banner.png)

## 🥗 USDA Food Data Normalizer

Search the **USDA FoodData Central** database for branded and generic foods — with normalized brand names, standardized food categories, converted nutrient units, and deduplicated UPC codes. Perfect for health apps, nutrition platforms, food manufacturers, and meal planning services.

### ✨ Key Features

- **🔍 Smart Food Search** — Search by keyword across 500K+ branded and generic foods
- **🏷️ Brand Normalization** — Maps messy brand owner strings to clean canonical names (200+ brand mappings covering major food conglomerates, retailers, and supplement companies)
- **📂 Category Standardization** — Converts USDA's verbose category strings into user-friendly groups (80+ mappings)
- **🧪 Nutrient Unit Conversion** — Standardizes nutrient values to common units (calories, protein, fat, sodium, vitamins)
- **📊 Per-Serving Values** — Automatically calculates per-serving nutrient values from the food's serving size
- **🔄 UPC/GTIN Dedup** — Removes duplicate entries by FDC ID
- **📋 Three Output Formats** — Dataset (JSON), human-readable OUTPUT table, and machine-readable STATS

### 📥 Input Parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| `searchQuery` | string | ✅ | Food name or keyword (e.g. 'apple', 'yogurt', 'protein bar') |
| `apiKey` | string | ✅ | Free USDA API key from [fdc.nal.usda.gov/api-key-signup.html](https://fdc.nal.usda.gov/api-key-signup.html). Use `DEMO_KEY` for testing (30 req/hr limit) |
| `maxResults` | integer | ❌ | Max foods to return (1–200, default: 50) |
| `dataType` | string | ❌ | Filter: `Branded`, `Foundation`, `SR Legacy`, `Survey (FNDDS)`, or leave empty for all |
| `includeNutrients` | boolean | ❌ | Fetch full nutrient breakdown (default: true) |

### 📥 Example Input

```json
{
  "searchQuery": "greek yogurt",
  "apiKey": "DEMO_KEY",
  "maxResults": 25,
  "dataType": "",
  "includeNutrients": true
}
```

### 📤 Example Output (Dataset Item)

```json
{
  "fdcId": 2259797,
  "description": "GREEK NONFAT YOGURT, PLAIN",
  "dataType": "Branded",
  "brandOwner": "Chobani LLC",
  "brandNormalized": "Chobani",
  "foodCategory": "Yogurt",
  "categoryNormalized": "Dairy (Yogurt)",
  "gtinUpc": "818290012898",
  "servingSize": 150.0,
  "servingSizeUnit": "g",
  "householdServing": "3/4 cup",
  "nutrients": {
    "Energy": { "value": 53.0, "unit": "kcal" },
    "Protein": { "value": 10.0, "unit": "g" },
    "Total Fat": { "value": 0.33, "unit": "g" },
    "Carbohydrate": { "value": 3.33, "unit": "g" },
    "Sodium": { "value": 33.0, "unit": "mg" }
  },
  "nutrientsPerServing": {
    "Energy": { "value": 79.5, "unit": "kcal", "perServing": "150g" },
    "Protein": { "value": 15.0, "unit": "g", "perServing": "150g" }
  }
}
```

### 🎯 Use Cases

- **Health & Fitness Apps** — Build nutrition databases with clean brand names and consistent units
- **Meal Planning Services** — Enrich recipe ingredients with accurate nutrient data
- **Food Manufacturers** — Benchmark products against competitors by nutrient profile
- **Grocery & Delivery Apps** — Map UPC codes to normalized brand and category info
- **Academic Research** — Pull clean nutrition datasets for dietary studies
- **AI/ML Training** — Feed normalized food data to LLMs and recommendation engines

### 🔑 API Key

Get a free USDA FoodData Central API key at [fdc.nal.usda.gov/api-key-signup.html](https://fdc.nal.usda.gov/api-key-signup.html). Registration is instant and free — no credit card required.

| Tier | Rate Limit | Results/Request |
|---|---|---|
| `DEMO_KEY` | 30 req/hour | 50 |
| Registered | 3,600 req/hour | 200 |

### 📊 Data Source

All data comes from the [USDA FoodData Central](https://fdc.nal.usda.gov/) — the authoritative U.S. government source for food composition data. Includes:

- **Branded Foods** — 450K+ commercial products with UPC codes
- **Foundation Foods** — 10K+ core foods with extensive nutrient profiles
- **SR Legacy** — 7K+ historical Standard Reference foods
- **FNDDS** — 8K+ foods from national dietary surveys

Data is provided under the [USDA Open Data policy](https://www.usda.gov/open).

### 💰 Pricing

This is a **paid Actor** using Apify's pay-per-event model. You are charged per result (normalized food item) returned. See the store page for current pricing.

# Actor input Schema

## `searchQuery` (type: `string`):

Food name or keyword to search (e.g. 'apple', 'yogurt', 'protein bar').

## `apiKey` (type: `string`):

Free USDA FoodData Central API key from https://fdc.nal.usda.gov/api-key-signup.html. Use 'DEMO\_KEY' for testing (limited to 30 req/hr).

## `maxResults` (type: `integer`):

Maximum number of foods to return (1-200). Default: 50.

## `dataType` (type: `string`):

Filter by USDA data type. Leave empty for all types.

## `includeNutrients` (type: `boolean`):

Fetch full nutrient breakdown for each food. Required for unit conversion and daily value calculation.

## Actor input object example

```json
{
  "searchQuery": "apple",
  "maxResults": 50,
  "dataType": "",
  "includeNutrients": true
}
```

# Actor output Schema

## `results` (type: `string`):

All normalized food records with nutrients.

## `summary` (type: `string`):

Human-readable summary with food counts and statistics.

## `stats` (type: `string`):

Machine-readable run statistics.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchQuery": "apple"
};

// Run the Actor and wait for it to finish
const run = await client.actor("wakey7dev/usda-food-normalizer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "searchQuery": "apple" }

# Run the Actor and wait for it to finish
run = client.actor("wakey7dev/usda-food-normalizer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchQuery": "apple"
}' |
apify call wakey7dev/usda-food-normalizer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,wakey7dev/usda-food-normalizer"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/KBJG2nmzCsW9lGHcH/builds/up0xdnDxhz8mlFttQ/openapi.json
