# USDA FoodData Central - Nutrition Search (`pink_comic/usda-fooddata-central`) Actor

Search USDA FoodData Central for nutritional information. Find foods by name, brand, or nutrient content. For nutritionists, food scientists, health app developers, and dietary researchers. Pay per result.

- **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:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN 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/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

## 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("💾 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 '{
  "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": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=pink_comic/usda-fooddata-central",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "USDA FoodData Central - Nutrition Search",
        "description": "Search USDA FoodData Central for nutritional information. Find foods by name, brand, or nutrient content. For nutritionists, food scientists, health app developers, and dietary researchers. Pay per result.",
        "version": "0.1",
        "x-build-id": "Uw29TbgvPJsOZZVgl"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/pink_comic~usda-fooddata-central/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-pink_comic-usda-fooddata-central",
                "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/pink_comic~usda-fooddata-central/runs": {
            "post": {
                "operationId": "runs-sync-pink_comic-usda-fooddata-central",
                "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/pink_comic~usda-fooddata-central/run-sync": {
            "post": {
                "operationId": "run-sync-pink_comic-usda-fooddata-central",
                "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": {
                    "searchType": {
                        "title": "Search Type",
                        "enum": [
                            "search",
                            "lookup",
                            "list"
                        ],
                        "type": "string",
                        "description": "How to search for foods.",
                        "default": "search"
                    },
                    "query": {
                        "title": "Search Keywords",
                        "type": "string",
                        "description": "Food name or keywords to search for (e.g. \"cheddar cheese\", \"chicken breast\", \"organic milk\").",
                        "default": "cheddar cheese"
                    },
                    "fdcId": {
                        "title": "FDC ID",
                        "type": "string",
                        "description": "FoodData Central ID for single food lookup (e.g. \"2057648\"). Use with 'Look Up by FDC ID' search type.",
                        "default": ""
                    },
                    "dataType": {
                        "title": "Data Type",
                        "enum": [
                            "",
                            "Branded",
                            "Foundation",
                            "SR Legacy",
                            "Survey (FNDDS)"
                        ],
                        "type": "string",
                        "description": "Filter by food data source. Branded = packaged products with UPC. Foundation = reference foods with detailed nutrients. SR Legacy = classic USDA database.",
                        "default": ""
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum number of food results to return.",
                        "default": 25
                    },
                    "pageSize": {
                        "title": "Page Size",
                        "minimum": 1,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Number of results per API page (max 200). Higher values mean fewer API calls.",
                        "default": 50
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
