# USDA FoodData Central Scraper - Nutrition Facts API (`pink_comic/usda-fooddata-central`) Actor

Scrape USDA FoodData Central nutrition data for foods, branded products, UPCs, ingredients, calories, macros, vitamins, and minerals. Search by keyword, FDC ID, or data type for diet apps, recipe calculators, food labeling, CPG research, and health data workflows.

- **URL**: https://apify.com/pink\_comic/usda-fooddata-central.md
- **Developed by:** [Ava Torres](https://apify.com/pink_comic) (community)
- **Categories:** Automation, Business, AI
- **Stats:** 3 total users, 0 monthly users, 96.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 Central - Nutrition Facts, Ingredients & Food Composition for 300K+ Foods

Search the USDA FoodData Central database for complete nutrition data on 300,000+ foods. Get calories, protein, fat, carbohydrates, fiber, vitamins, minerals, ingredients lists, serving sizes, UPC/GTIN codes, brand owner names, and food categories. Filter by data type: branded packaged products, foundation reference foods, or SR Legacy classic USDA data. Look up any individual food by FDC ID for a full nutrient profile.

Data is sourced from the USDA FoodData Central API. No user API key configuration required.

***

### Output Fields

| Field | Type | Description |
|---|---|---|
| `fdcId` | integer | FoodData Central unique identifier |
| `dataType` | string | Data source (Branded, Foundation, SR Legacy, Survey) |
| `brandOwner` | string | Brand owner company name |
| `foodCategory` | string | Food category |
| `servingSize` | number | Serving size quantity |
| `servingSizeUnit` | string | Serving size unit (g, ml, oz, etc.) |
| `ingredients` | string | Full ingredients list |
| `gtinUpc` | string | UPC or GTIN barcode |
| `nutrients` | array | Nutrient values: name, amount, and unit for each reported nutrient |

The `nutrients` array contains all nutrients reported for the food, including macronutrients (energy, protein, fat, carbohydrates, fiber, sugars), vitamins (A, C, D, B12, folate, etc.), and minerals (calcium, iron, potassium, sodium, etc.).

***

### Use Cases

- **Food tech and nutrition apps** — Bulk-load nutrient data for a recipe calculator, diet tracker, or meal planning tool without building and maintaining your own database.
- **CPG and product development** — Research competitive nutrient profiles, serving sizes, and ingredient formulations for existing branded products in a category.
- **E-commerce and retail** — Populate product pages with accurate nutrition facts and ingredients for food items by UPC code.
- **Health and wellness platforms** — Build or enrich a nutrition database with USDA-verified data for specific food categories or brands.
- **Academic and dietary research** — Access the SR Legacy and Foundation datasets for standardized nutrient composition data used in dietary studies.
- **Regulatory and labeling compliance** — Cross-reference labeled nutrition facts against USDA reference data for a product category.

***

### How to Use

Search by keyword, look up a specific food by FDC ID, or browse a food list filtered by data type.

**Example input — search for cheddar cheese (all types):**

```json
{
  "searchType": "search",
  "query": "cheddar cheese",
  "dataType": "",
  "maxResults": 25,
  "pageSize": 50
}
```

**Example input — branded chicken breast products only:**

```json
{
  "searchType": "search",
  "query": "chicken breast",
  "dataType": "Branded",
  "maxResults": 50,
  "pageSize": 50
}
```

**Example input — look up a food by FDC ID:**

```json
{
  "searchType": "lookup",
  "fdcId": "2057648",
  "maxResults": 1
}
```

**Example input — browse Foundation foods (USDA reference foods):**

```json
{
  "searchType": "list",
  "dataType": "Foundation",
  "maxResults": 100,
  "pageSize": 100
}
```

#### Search Types

| Value | Description |
|---|---|
| `search` | Full-text search by food name or keywords |
| `lookup` | Retrieve a single food by FDC ID with complete nutrient data |
| `list` | Browse foods filtered by data type |

#### Data Type Options

| Value | Description |
|---|---|
| `Branded` | Packaged consumer products with UPC codes, brand names, and label-based nutrition |
| `Foundation` | USDA reference foods with analytically measured nutrient values |
| `SR Legacy` | USDA Standard Reference — classic database used in dietary research |
| `Survey (FNDDS)` | Foods and nutrient values from the national dietary survey |

Leave `dataType` empty to search across all types.

***

### Cost

Approximately **$0.10 per run** (platform start fee) plus minimal compute. Most runs complete in under 30 seconds.

***

### Output Formats

Results are available as **JSON**, **CSV**, and **Excel** from the Apify dataset interface. The `nutrients` array in JSON contains the full nutrient breakdown for each food.

***

### FAQ

**Does this require a USDA API key?**
No configuration is required. The actor handles API access automatically.

**How many foods are in the database?**
FoodData Central contains over 300,000 foods across all data types: branded products, foundation foods, SR Legacy items, and survey foods.

**What is the difference between Branded and Foundation data?**
Branded foods use nutrient values from product labels submitted by manufacturers. Foundation foods are analyzed in USDA laboratories and include more detailed nutrient profiles at the raw ingredient level.

**Can I search by UPC or barcode?**
The `query` field accepts UPC/GTIN codes as search terms when using `searchType: "search"`. Results for branded products include the `gtinUpc` field.

**What nutrients are included?**
The nutrient list varies by food and data type. Branded foods typically include the standard Nutrition Facts panel nutrients. Foundation and SR Legacy foods include 50–100+ nutrients, including fatty acid profiles, amino acids, and micronutrients not required on labels.

**What is an FDC ID?**
The unique identifier assigned to each food in FoodData Central (e.g. `2057648`). Use it with `searchType: "lookup"` to retrieve the complete record for a specific food.

# Actor input Schema

## `searchType` (type: `string`):

How to search for foods.

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

Food name or keywords to search for (e.g. "cheddar cheese", "chicken breast", "organic milk").

## `fdcId` (type: `string`):

FoodData Central ID for single food lookup (e.g. "2057648"). Use with 'Look Up by FDC ID' search type.

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

Filter by food data source. Branded = packaged products with UPC. Foundation = reference foods with detailed nutrients. SR Legacy = classic USDA database.

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

Maximum number of food results to return.

## `pageSize` (type: `integer`):

Number of results per API page (max 200). Higher values mean fewer API calls.

## Actor input object example

```json
{
  "searchType": "search",
  "query": "cheddar cheese",
  "fdcId": "",
  "dataType": "",
  "maxResults": 25,
  "pageSize": 50
}
```

# 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 = {
    "searchType": "search",
    "query": "cheddar cheese",
    "fdcId": "",
    "dataType": "",
    "maxResults": 25,
    "pageSize": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("pink_comic/usda-fooddata-central").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 = {
    "searchType": "search",
    "query": "cheddar cheese",
    "fdcId": "",
    "dataType": "",
    "maxResults": 25,
    "pageSize": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("pink_comic/usda-fooddata-central").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 '{
  "searchType": "search",
  "query": "cheddar cheese",
  "fdcId": "",
  "dataType": "",
  "maxResults": 25,
  "pageSize": 50
}' |
apify call pink_comic/usda-fooddata-central --silent --output-dataset

```

## MCP server setup

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

```

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/Szd4olghSdkruHH0x/builds/Uw29TbgvPJsOZZVgl/openapi.json
