# USDA FoodData Central Scraper (`parseforge/usda-fooddata-central-scraper`) Actor

Export food and nutrient records from the USDA FoodData Central database. Search 1.9M+ foods including branded products, generic foods, and survey foods. Pull nutrient profiles, ingredients, portion sizes, brand owners, and food category data.

- **URL**: https://apify.com/parseforge/usda-fooddata-central-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Other, E-commerce, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.75 / 1,000 result items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

![ParseForge Banner](https://github.com/ParseForge/apify-assets/blob/ad35ccc13ddd068b9d6cba33f323962e39aed5b2/banner.jpg?raw=true)

## 🥦 USDA FoodData Central Scraper

> 🚀 **Export the U.S. national food and nutrient catalog in seconds.** Search **1.9M+ foods** by name, brand, or category and pull full nutrient profiles, ingredients, serving sizes, and brand details. No registration, no manual CSV wrangling.

> 🕒 **Last updated:** 2026-05-21 · **📊 25 fields** per record · **🥑 1.9M+ foods** · **🏷️ 4 data types** · **🇺🇸 U.S. national reference**

The **USDA FoodData Central Scraper** exports the official U.S. food composition database maintained by the Agricultural Research Service. Each record returns **25 fields**, including FDC ID, description, brand owner, ingredients list, serving size, household measure, food category, and a full nutrient profile (calories, macros, vitamins, minerals, fatty acids).

The catalog spans **four data types**: Branded foods (private-label products with UPC, brand, and on-label nutrition), Foundation foods (analytically derived nutrient profiles for common ingredients), Survey foods (FNDDS, used in national dietary surveys), and SR Legacy (the classic Standard Reference release). Together they cover everything from "Cheese, Cheddar" to specific store-brand packaged products with full ingredient lists.

| 🎯 Target Audience | 💡 Primary Use Cases |
|---|---|
| Nutrition app builders, dietitians, food research labs, recipe platforms, meal-planning startups, public-health analysts | Food search and autocomplete, nutrient lookup, ingredient matching, calorie calculation, label compliance, dietary research |

---

### 📋 What the USDA FoodData Central Scraper does

Four food lookups in a single run:

- 🔎 **Keyword search.** Find foods by free-text query like `chicken breast`, `oat milk`, or `chocolate chip cookie`.
- 🏷️ **Data type filter.** Restrict to Branded, Foundation, Survey (FNDDS), or SR Legacy.
- 🏢 **Brand owner filter.** Pull every product from a specific brand like `Kraft Heinz Foods Company` or `General Mills, Inc.`.
- 🧬 **Full nutrient profile.** Each food includes calories, protein, fat, carbs, vitamins, minerals, fatty acids, and serving conversions.

Each record includes identifiers (FDC ID, UPC), descriptive metadata (description, brand, ingredients, category, market country), serving information (size, unit, household measure, portion list with gram weights), and a compact nutrient array for every nutrient measured.

> 💡 **Why it matters:** USDA FoodData Central powers most major nutrition platforms. Building a fresh, structured pull yourself means paginating a search service, joining detail records, and normalizing a sparse nutrient model. This Actor handles all of that and returns a clean per-food row.

---

### 🎬 Full Demo

_🚧 Coming soon: a 3-minute walkthrough showing how to go from sign-up to a downloaded food dataset._

---

### ⚙️ Input

<table>
<thead>
<tr><th>Input</th><th>Type</th><th>Default</th><th>Behavior</th></tr>
</thead>
<tbody>
<tr><td><code>maxItems</code></td><td>integer</td><td><code>10</code></td><td>Records to return. Free plan caps at 10, paid plan at 1,000,000.</td></tr>
<tr><td><code>searchQuery</code></td><td>string</td><td><code>"cheddar cheese"</code></td><td>Free-text food search term.</td></tr>
<tr><td><code>dataType</code></td><td>array</td><td><code>[]</code></td><td>Subset: Branded, Foundation, Survey (FNDDS), SR Legacy. Empty = all.</td></tr>
<tr><td><code>sortBy</code></td><td>string</td><td><code>"dataType.keyword"</code></td><td>Sort field: data type, description, FDC ID, or published date.</td></tr>
<tr><td><code>sortOrder</code></td><td>string</td><td><code>"desc"</code></td><td>Ascending or descending.</td></tr>
<tr><td><code>brandOwner</code></td><td>string</td><td><code>""</code></td><td>Filter Branded foods by brand owner name.</td></tr>
</tbody>
</table>

**Example: 50 branded cheddar cheese products.**

```json
{
    "maxItems": 50,
    "searchQuery": "cheddar cheese",
    "dataType": ["Branded"]
}
````

**Example: every Kraft Heinz product across the catalog.**

```json
{
    "maxItems": 500,
    "searchQuery": "kraft",
    "brandOwner": "Kraft Heinz Foods Company",
    "dataType": ["Branded"]
}
```

> ⚠️ **Good to Know:** Branded records carry brand owner, UPC, and on-label nutrition exactly as the manufacturer registered them. Foundation and Survey records carry analytically derived values for generic foods. Pick the data type that matches your downstream use (label compliance vs. dietary modeling vs. nutrient research).

***

### 📊 Output

Each food record contains **25 fields**. Download the dataset as CSV, Excel, JSON, or XML.

#### 🧾 Schema

| Field | Type | Example |
|---|---|---|
| 🆔 `fdcId` | number | `2705709` |
| 📝 `description` | string | `"Cheese, Cheddar"` |
| 🏷️ `dataType` | string | `"Survey (FNDDS)"` |
| 🏢 `brandOwner` | string | null | `"Kraft Heinz Foods Company"` |
| 🏷️ `brandName` | string | null | `"Kraft"` |
| 🏷️ `gtinUpc` | string | null | `"021000615650"` |
| 🧾 `ingredients` | string | null | `"PASTEURIZED MILK, CHEESE CULTURE, SALT, ENZYMES..."` |
| 🥄 `servingSize` | number | null | `28` |
| 📏 `servingSizeUnit` | string | null | `"g"` |
| 🥣 `householdServingFullText` | string | null | `"1 slice"` |
| 🗂️ `foodCategory` | string | null | `"Cheese"` |
| 📅 `publicationDate` | string | `"10/31/2024"` |
| 📅 `modifiedDate` | string | null | `"2024-09-15"` |
| 📅 `availableDate` | string | null | `"2023-01-01"` |
| 🌎 `marketCountry` | string | null | `"United States"` |
| ⚖️ `packageWeight` | string | null | `"8 OZ/226 GR"` |
| 🔥 `calories` | number | null | `409` |
| 🥩 `protein` | number | null | `23.3` |
| 🧈 `totalFat` | number | null | `34` |
| 🍞 `carbohydrate` | number | null | `2.44` |
| 🧪 `nutrients` | array | `[{"name":"Calcium, Ca","unit":"mg","amount":707}, ...]` |
| 📦 `portions` | array | `[{"description":"1 slice","gramWeight":21}, ...]` |
| 🔗 `detailUrl` | string | `"https://fdc.nal.usda.gov/food-details/2705709/nutrients"` |
| 🕒 `scrapedAt` | ISO 8601 | `"2026-05-20T22:14:00.000Z"` |
| ❗ `error` | string | null | populated only on failure |

#### 📦 Sample records

<details>
<summary><strong>🧀 Survey food: Cheese, Cheddar (FDC 2705709)</strong></summary>

```json
{
    "fdcId": 2705709,
    "description": "Cheese, Cheddar",
    "dataType": "Survey (FNDDS)",
    "brandOwner": null,
    "brandName": null,
    "gtinUpc": null,
    "ingredients": null,
    "servingSize": null,
    "servingSizeUnit": null,
    "householdServingFullText": null,
    "foodCategory": null,
    "publicationDate": "10/31/2024",
    "calories": 409,
    "protein": 23.3,
    "totalFat": 34,
    "carbohydrate": 2.44,
    "nutrients": [
        {"name": "Protein", "unit": "g", "amount": 23.3},
        {"name": "Total lipid (fat)", "unit": "g", "amount": 34},
        {"name": "Calcium, Ca", "unit": "mg", "amount": 707},
        {"name": "Sodium, Na", "unit": "mg", "amount": 654},
        {"name": "Vitamin B-12", "unit": "µg", "amount": 1.06}
    ],
    "portions": [
        {"description": "1 slice", "gramWeight": 21, "measureUnit": "undetermined"},
        {"description": "1 cup, shredded", "gramWeight": 113, "measureUnit": "undetermined"}
    ],
    "detailUrl": "https://fdc.nal.usda.gov/food-details/2705709/nutrients",
    "scrapedAt": "2026-05-20T22:14:00.000Z"
}
```

</details>

<details>
<summary><strong>🥫 Branded product with UPC, ingredients, and on-label nutrition</strong></summary>

```json
{
    "fdcId": 1859004,
    "description": "CHEDDAR CHEESE",
    "dataType": "Branded",
    "brandOwner": "Kraft Heinz Foods Company",
    "brandName": "KRAFT",
    "gtinUpc": "021000615650",
    "ingredients": "PASTEURIZED MILK, CHEESE CULTURE, SALT, ENZYMES, ANNATTO (VEGETABLE COLOR)",
    "servingSize": 28,
    "servingSizeUnit": "g",
    "householdServingFullText": "1 slice",
    "foodCategory": "Cheese",
    "marketCountry": "United States",
    "packageWeight": "7 OZ/198 GR",
    "calories": 393,
    "protein": 25,
    "totalFat": 32.1,
    "carbohydrate": 3.57,
    "detailUrl": "https://fdc.nal.usda.gov/food-details/1859004/nutrients",
    "scrapedAt": "2026-05-20T22:14:00.000Z"
}
```

</details>

<details>
<summary><strong>🥦 Foundation food: analytically derived nutrient profile</strong></summary>

```json
{
    "fdcId": 170379,
    "description": "Broccoli, raw",
    "dataType": "Foundation",
    "foodCategory": "Vegetables and Vegetable Products",
    "calories": 34,
    "protein": 2.82,
    "totalFat": 0.37,
    "carbohydrate": 6.64,
    "nutrients": [
        {"name": "Fiber, total dietary", "unit": "g", "amount": 2.6},
        {"name": "Vitamin C, total ascorbic acid", "unit": "mg", "amount": 89.2},
        {"name": "Calcium, Ca", "unit": "mg", "amount": 47}
    ],
    "detailUrl": "https://fdc.nal.usda.gov/food-details/170379/nutrients",
    "scrapedAt": "2026-05-20T22:14:00.000Z"
}
```

</details>

***

### ✨ Why choose this Actor

| | Capability |
|---|---|
| 🥦 | **National catalog.** 1.9M+ branded, foundation, survey, and legacy food records. |
| 🧬 | **Full nutrient profiles.** Every food includes calories, macros, vitamins, minerals, and fatty acids in a single compact array. |
| 🏷️ | **Brand-level filtering.** Restrict to a single manufacturer to compare every SKU side by side. |
| 📦 | **Portion conversions.** Each food returns a portion list with gram weights, so you can convert "1 slice" or "1 cup" into grams without a lookup table. |
| ⚡ | **Fast.** 10 foods in under 5 seconds, 10,000 records in under three minutes. |
| 🇺🇸 | **Official U.S. source.** Maintained by USDA Agricultural Research Service and used by every major nutrition platform. |
| 🚫 | **No keys to manage.** No personal token required for the default run. |

> 📊 Accurate food composition data is the foundation of nutrition apps, recipe builders, dietary modeling, and public-health research.

***

### 📈 How it compares to alternatives

| Approach | Cost | Coverage | Refresh | Filters | Setup |
|---|---|---|---|---|---|
| **⭐ USDA FoodData Central Scraper** *(this Actor)* | $5 free credit, then pay-per-use | **1.9M+** foods | **Live per run** | query, data type, brand owner, sort | ⚡ 2 min |
| Build your own pipeline | Free, but engineering hours | Full catalog if you build it | Manual | DIY | 🐢 Days |
| Commercial nutrition APIs | $99-$999/month | Vendor-curated subset | Vendor cadence | Vendor's | ⏳ Hours |
| Manual CSV exports | Free | Stale snapshots | Quarterly at best | None | 🕒 Variable |

Pick this Actor when you want a clean per-food record with nutrients flattened, brand-level filtering, and no parser to maintain.

***

### 🚀 How to use

1. 📝 **Sign up.** [Create a free account with $5 credit](https://console.apify.com/sign-up?fpr=vmoqkp) (takes 2 minutes).
2. 🌐 **Open the Actor.** Go to the USDA FoodData Central Scraper page on the Apify Store.
3. 🎯 **Set input.** Type a food search term, optionally pick a data type or brand owner, set `maxItems`.
4. 🚀 **Run it.** Click **Start** and let the Actor collect your data.
5. 📥 **Download.** Grab your results in the **Dataset** tab as CSV, Excel, JSON, or XML.

> ⏱️ Total time from signup to downloaded dataset: **3-5 minutes.** No coding required.

***

### 💼 Business use cases

<table>
<tr>
<td width="50%" valign="top">

#### 📱 Nutrition Apps & Calorie Trackers

- Food autocomplete with canonical FDC IDs
- Per-food calorie, macro, and micronutrient lookup
- Brand-aware product search across millions of SKUs
- Portion conversion using gram-weight tables

</td>
<td width="50%" valign="top">

#### 🍽️ Recipe & Meal-Planning Platforms

- Ingredient matching to USDA descriptions
- Recipe-level nutrient roll-up from per-ingredient grams
- Allergen flags from ingredient strings
- Substitute suggestions within the same food category

</td>
</tr>
<tr>
<td width="50%" valign="top">

#### 🏥 Clinical Nutrition & Dietetics

- Diet plan builders backed by reference values
- Therapeutic diet templates (low-sodium, renal, diabetic)
- Patient-facing food logs with official references
- Research-grade per-food micronutrient tracking

</td>
<td width="50%" valign="top">

#### 🧪 Food Research & Public Health

- Comparative analysis across brand portfolios
- Population dietary modeling with FNDDS records
- Reformulation tracking via modified-date diffs
- Label compliance and ingredient parsing pipelines

</td>
</tr>
</table>

***

### 🔌 Automating USDA FoodData Central Scraper

Control the scraper programmatically for scheduled runs and pipeline integrations:

- 🟢 **Node.js.** Install the `apify-client` NPM package.
- 🐍 **Python.** Use the `apify-client` PyPI package.
- 📚 See the [Apify API documentation](https://docs.apify.com/api/v2) for full details.

The [Apify Schedules feature](https://docs.apify.com/platform/schedules) lets you trigger this Actor on any cron interval. Weekly refreshes keep your downstream food database in sync as USDA adds new branded products and updates nutrient values.

***

### 🌟 Beyond business use cases

Food composition data powers more than commercial workflows. The same structured records support research, education, civic projects, and personal initiatives.

<table>
<tr>
<td width="50%">

#### 🎓 Research and academia

- Nutrition science papers with cited reference values
- Public-health dietary modeling and policy analysis
- Coursework in nutrition, food science, and dietetics
- Reproducible studies with versioned dataset pulls

</td>
<td width="50%">

#### 🎨 Personal and creative

- Hobby calorie trackers and personal food diaries
- Indie cooking apps and recipe portfolios
- Educational content for food bloggers and creators
- Custom meal planners for athletic or therapeutic diets

</td>
</tr>
<tr>
<td width="50%">

#### 🤝 Non-profit and civic

- School-meal nutrition planning and audits
- Community-kitchen menu design backed by USDA data
- Food-bank inventory tagged with macro and micronutrient totals
- Public-health communications and labeling literacy projects

</td>
<td width="50%">

#### 🧪 Experimentation

- Train food-classification and OCR-to-nutrient models
- Prototype agent pipelines that resolve "what is in this dish"
- Validate ingredient-substitution rules
- Build dashboards comparing brand portfolios

</td>
</tr>
</table>

***

### 🤖 Ask an AI assistant about this scraper

Open a ready-to-send prompt about this ParseForge actor in the AI of your choice:

- 💬 [**ChatGPT**](https://chat.openai.com/?q=How%20do%20I%20use%20the%20USDA%20FoodData%20Central%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🧠 [**Claude**](https://claude.ai/new?q=How%20do%20I%20use%20the%20USDA%20FoodData%20Central%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🔍 [**Perplexity**](https://perplexity.ai/search?q=How%20do%20I%20use%20the%20USDA%20FoodData%20Central%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🅒 [**Copilot**](https://copilot.microsoft.com/?q=How%20do%20I%20use%20the%20USDA%20FoodData%20Central%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)

***

### ❓ Frequently Asked Questions

#### 🧩 How does it work?

Type a food search term in the input form, optionally pick a data type or brand owner, click Start. The Actor pulls matching foods, joins each one with its full nutrient detail, and writes a clean per-food row to the dataset.

#### 📏 How accurate are the nutrient values?

Foundation records carry analytically derived values from accredited labs. Branded records carry the manufacturer's on-label nutrition (subject to labeling tolerances). Survey records are derived from FNDDS for use in national dietary research. Use the `dataType` field to choose the precision that matches your project.

#### 🔁 How fresh is the data?

USDA updates FoodData Central regularly as branded products are added or reformulated and as new analytical work is published. Every run of this Actor pulls the latest catalog state, so your dataset reflects current values as of run time.

#### 🥦 Can I get every nutrient or only the headline ones?

Every nutrient measured for the food is returned in the `nutrients` array. Headline values (calories, protein, fat, carbs) are also broken out as top-level fields for convenient sorting and filtering.

#### 🏷️ Can I export every product from a single brand?

Yes. Set `brandOwner` to the exact manufacturer string (for example `Kraft Heinz Foods Company`) and restrict `dataType` to `Branded`. The Actor will return every SKU that brand has registered.

#### ⏰ Can I schedule regular runs?

Yes. Use Apify Schedules to run this Actor on any cron interval (daily, weekly, monthly) and keep a downstream food database in sync as USDA publishes new products and nutrient values.

#### ⚖️ Is this data legal to use?

FoodData Central is a publicly funded U.S. government resource and is free to use, including for commercial products. Review the FoodData Central terms for any project-specific obligations.

#### 💳 Do I need a paid Apify plan to use this Actor?

No. The free Apify plan is enough for testing and small runs (10 records per run). A paid plan lifts the limit and gives you access to scheduling, higher concurrency, and larger datasets.

#### 🔁 What happens if a run fails or gets interrupted?

Apify automatically retries transient errors. If a run still fails, you can inspect the log in the Runs tab, fix the input, and re-run. Partial datasets from interrupted runs are preserved so you never lose progress.

#### 🧪 What if I need lab-grade reference values?

Filter `dataType` to `Foundation` or `SR Legacy`. Those records are analytically derived and best suited for research-grade calculations.

#### 🆘 What if I need help?

Our support team is here to help. Contact us through the Apify platform or use the Tally form linked below.

***

### 🔌 Integrate with any app

USDA FoodData Central Scraper connects to any cloud service via [Apify integrations](https://apify.com/integrations):

- [**Make**](https://docs.apify.com/platform/integrations/make) - Automate multi-step workflows
- [**Zapier**](https://docs.apify.com/platform/integrations/zapier) - Connect with 5,000+ apps
- [**Slack**](https://docs.apify.com/platform/integrations/slack) - Get run notifications in your channels
- [**Airbyte**](https://docs.apify.com/platform/integrations/airbyte) - Pipe food data into your warehouse
- [**GitHub**](https://docs.apify.com/platform/integrations/github) - Trigger runs from commits and releases
- [**Google Drive**](https://docs.apify.com/platform/integrations/drive) - Export datasets straight to Sheets

You can also use webhooks to trigger downstream actions when a run finishes. Push fresh food data into your nutrition app backend, or alert your team in Slack.

***

### 🔗 Recommended Actors

- [**✈️ OurAirports Scraper**](https://apify.com/parseforge/ourairports-scraper) - Global airport reference dataset
- [**🔌 AFDC EV Stations Scraper**](https://apify.com/parseforge/afdc-ev-stations-scraper) - U.S. alternative fuel and EV charging stations
- [**📈 Indexmundi Scraper**](https://apify.com/parseforge/indexmundi-scraper) - Global demographic and economic indicators
- [**🗺️ Nominatim OSM Scraper**](https://apify.com/parseforge/nominatim-osm-scraper) - Geocode addresses via OpenStreetMap
- [**🏨 Agoda Scraper**](https://apify.com/parseforge/agoda-scraper) - Hotel availability, pricing, and reviews

> 💡 **Pro Tip:** browse the complete [ParseForge collection](https://apify.com/parseforge) for more reference-data scrapers.

***

**🆘 Need Help?** [**Open our contact form**](https://tally.so/r/BzdKgA) to request a new scraper, propose a custom data project, or report an issue.

***

> **⚠️ Disclaimer:** this Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by the U.S. Department of Agriculture or FoodData Central. All trademarks mentioned are the property of their respective owners. Only publicly available food composition data is collected.

# Actor input Schema

## `maxItems` (type: `integer`):

Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000

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

Food search term. Examples: 'cheddar cheese', 'banana', 'chicken breast'.

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

Filter to specific food data types. Leave empty for all.

## `sortBy` (type: `string`):

How to order results.

## `sortOrder` (type: `string`):

Ascending or descending order.

## `brandOwner` (type: `string`):

Filter Branded foods by brand owner. Example: 'Kraft Heinz Foods Company'.

## Actor input object example

```json
{
  "maxItems": 10,
  "searchQuery": "cheddar cheese",
  "sortBy": "dataType.keyword",
  "sortOrder": "desc"
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# 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 = {
    "maxItems": 10,
    "searchQuery": "cheddar cheese",
    "sortBy": "dataType.keyword",
    "sortOrder": "desc"
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/usda-fooddata-central-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 = {
    "maxItems": 10,
    "searchQuery": "cheddar cheese",
    "sortBy": "dataType.keyword",
    "sortOrder": "desc",
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/usda-fooddata-central-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "maxItems": 10,
  "searchQuery": "cheddar cheese",
  "sortBy": "dataType.keyword",
  "sortOrder": "desc"
}' |
apify call parseforge/usda-fooddata-central-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=parseforge/usda-fooddata-central-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "USDA FoodData Central Scraper",
        "description": "Export food and nutrient records from the USDA FoodData Central database. Search 1.9M+ foods including branded products, generic foods, and survey foods. Pull nutrient profiles, ingredients, portion sizes, brand owners, and food category data.",
        "version": "1.0",
        "x-build-id": "5ONC6q04po0jMymEi"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/parseforge~usda-fooddata-central-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-parseforge-usda-fooddata-central-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/parseforge~usda-fooddata-central-scraper/runs": {
            "post": {
                "operationId": "runs-sync-parseforge-usda-fooddata-central-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/parseforge~usda-fooddata-central-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-parseforge-usda-fooddata-central-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000"
                    },
                    "searchQuery": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Food search term. Examples: 'cheddar cheese', 'banana', 'chicken breast'."
                    },
                    "dataType": {
                        "title": "Data Type",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "Filter to specific food data types. Leave empty for all.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "Branded",
                                "Foundation",
                                "Survey (FNDDS)",
                                "SR Legacy"
                            ]
                        }
                    },
                    "sortBy": {
                        "title": "Sort By",
                        "enum": [
                            "dataType.keyword",
                            "lowercaseDescription.keyword",
                            "fdcId",
                            "publishedDate"
                        ],
                        "type": "string",
                        "description": "How to order results."
                    },
                    "sortOrder": {
                        "title": "Sort Order",
                        "enum": [
                            "desc",
                            "asc"
                        ],
                        "type": "string",
                        "description": "Ascending or descending order."
                    },
                    "brandOwner": {
                        "title": "Brand Owner",
                        "type": "string",
                        "description": "Filter Branded foods by brand owner. Example: 'Kraft Heinz Foods Company'."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
