# USDA FoodData — Nutrition & Ingredients (`ponderable_hydrometer/usda-food-scraper`) Actor

Food & nutrition data from USDA FoodData Central — branded & generic foods, brand, ingredients, serving size & full nutrient profiles. Free API key (BYO).

- **URL**: https://apify.com/ponderable\_hydrometer/usda-food-scraper.md
- **Developed by:** [Ponderable Hydrometer](https://apify.com/ponderable_hydrometer) (community)
- **Categories:** E-commerce, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 89.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## 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

## USDA FoodData — Nutrition & Ingredients

**US-authoritative food & nutrition data from USDA FoodData Central — branded and generic foods with
brand owner, ingredients, serving size, GTIN/UPC, food category and full nutrient profiles.** Search
by keyword (filter by data type) or look up specific foods by FDC ID.

Perfect for nutrition & diet apps, food e-commerce, recipe tools and dietary-research datasets.

### What you get

Per food:

- **Identity** — `fdcId`, `description`, `dataType` (Branded / Foundation / SR Legacy / Survey)
- **Brand & retail** — `brandOwner`, `brandName`, `gtinUpc`, `marketCountry`
- **Classification** — `foodCategory`, `ingredients` (full label text)
- **Serving** — `servingSize`, `servingSizeUnit`, `publishedDate`
- **Full nutrient profile** — `nutrients[]` of `{ name, unit, value }` (protein, fats, carbs,
  sugars, sodium, vitamins, …)
- Direct `url` to the food's FoodData Central page

### Bring your own key (free; DEMO\_KEY fallback)

Get a free key at [fdc.nal.usda.gov/api-key-signup.html](https://fdc.nal.usda.gov/api-key-signup.html)
and set it in the `apiKey` input (stored as a secret). If you leave it empty, the actor falls back to
the shared **`DEMO_KEY`**, which works for trials but is heavily rate-limited (~30 req/hour,
1000/day per IP) — add your own free key for real runs.

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `query` | string | — | Food to search, e.g. `greek yogurt` |
| `dataType` | array | — | Filter: `Branded`, `Foundation`, `SR Legacy`, `Survey (FNDDS)` (empty = all) |
| `fdcIds` | array | — | Specific FoodData Central IDs for full detail |
| `apiKey` | string (secret) | `DEMO_KEY` | Your free USDA key (recommended) |
| `maxResults` | integer | `100` | Cap on foods returned from search |

Provide a `query` and/or `fdcIds`.

#### Example input

```json
{"query":"greek yogurt","dataType":["Branded"],"maxResults":100,"apiKey":"<YOUR_USDA_KEY>"}
```

By FDC ID:

```json
{"fdcIds":["2035482","2057648"],"apiKey":"<YOUR_USDA_KEY>"}
```

### Output (one food)

Fields below are the real normalizer output:

```json
{
  "fdcId": 2035482,
  "description": "GREEK YOGURT, PLAIN",
  "dataType": "Branded",
  "brandOwner": "Chobani, LLC",
  "brandName": "Chobani",
  "gtinUpc": "894700010045",
  "foodCategory": "Yogurt",
  "ingredients": "CULTURED PASTEURIZED NONFAT MILK, LIVE AND ACTIVE CULTURES...",
  "servingSize": 170,
  "servingSizeUnit": "g",
  "marketCountry": "United States",
  "publishedDate": "2021-07-29",
  "nutrients": [
    { "name": "Protein", "unit": "G", "value": 17.6 },
    { "name": "Total lipid (fat)", "unit": "G", "value": 0 },
    { "name": "Carbohydrate, by difference", "unit": "G", "value": 5.88 },
    { "name": "Sodium, Na", "unit": "MG", "value": 65 }
  ],
  "url": "https://fdc.nal.usda.gov/fdc-app.html#/food-details/2035482/nutrients"
}
```

### Why this actor

- **US-authoritative** — branded + generic foods complement crowdsourced global sources.
- **Full nutrient profiles** — every nutrient with name, unit and value, plus ingredients & serving size.
- **BYO-key** keeps your usage on your own USDA agreement; DEMO\_KEY lets you try it instantly.

### Pricing

Pay per result — **$2.00 per 1,000 results** (one result = one food item). No subscription or platform fees.

### Related actors

- **Open Food Facts Scraper** — global, crowdsourced food & barcode data.
- **PubChem Scraper** — chemical compound properties (keyless).

### Notes & limits

- `DEMO_KEY` is heavily throttled — add a free key for anything beyond a trial.
- Nutrient availability varies by food and data type.
- Public official data; this is an independent tool, not affiliated with the USDA. You are
  responsible for compliant use of the output.

# Actor input Schema

## `query` (type: `string`):

Food to search, e.g. "greek yogurt", "cheddar cheese", "banana".

## `dataType` (type: `array`):

Filter by data type: Branded, Foundation, "SR Legacy", Survey (FNDDS). Empty = all.

## `fdcIds` (type: `array`):

Specific FoodData Central IDs to fetch full detail, e.g. \["2035482"].

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

Your free USDA FoodData Central API key (get one at fdc.nal.usda.gov/api-key-signup.html). Leave empty to use the shared DEMO\_KEY (heavily rate-limited). Kept secret.

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

Cap on number of foods returned from search.

## Actor input object example

```json
{
  "query": "greek yogurt",
  "maxResults": 100
}
```

# Actor output Schema

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

All rows produced by this run, as JSON.

# 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 = {
    "query": "greek yogurt"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ponderable_hydrometer/usda-food-scraper").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 = { "query": "greek yogurt" }

# Run the Actor and wait for it to finish
run = client.actor("ponderable_hydrometer/usda-food-scraper").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 '{
  "query": "greek yogurt"
}' |
apify call ponderable_hydrometer/usda-food-scraper --silent --output-dataset

```

## MCP server setup

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

```

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/Ie0dKl6mPld2ftGrv/builds/6qxoeIeFFrHcSaMyh/openapi.json
