# USDA NASS Agricultural Statistics Scraper (`crawlerbros/usda-nass-scraper`) Actor

Scrape USDA National Agricultural Statistics Service (NASS) QuickStats data - crop production, prices, area harvested, livestock, and agricultural census data by commodity, state, and year. No API key required.

- **URL**: https://apify.com/crawlerbros/usda-nass-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, Integrations, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

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

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 NASS Agricultural Statistics Scraper

Extract agricultural statistics from the USDA National Agricultural Statistics Service (NASS) QuickStats database — crop production, prices, area harvested, livestock, and agricultural census data by commodity, state, and year.

### What This Actor Does

This actor scrapes the USDA NASS QuickStats database to extract structured agricultural data including:

- Crop production volumes (bushels, tons, bales)
- Area harvested and planted (acres)
- Prices received by farmers (per bushel, per hundredweight)
- Livestock inventory and sales
- Agricultural census data (every 5 years)
- County, state, and national level statistics

**No API key required** — data is fetched directly from the NASS QuickStats website. If you have a free NASS API key, you can optionally provide it for direct API access.

### Data Source

**USDA National Agricultural Statistics Service — QuickStats**\
Website: <https://quickstats.nass.usda.gov/>\
Free API key available at: <https://quickstats.nass.usda.gov/api>

### Use Cases

- **Agricultural market analysis** — Track crop prices and production trends
- **Supply chain research** — Analyze commodity availability by region and year
- **Academic research** — Access standardized USDA agricultural data
- **Farm economics** — Study income, expenses, and profitability metrics
- **Food system analysis** — Map production geography for specific commodities

### Input Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `mode` | Select | Search mode: `searchCommodity`, `searchByState`, `browseCensus`, `searchSurvey` |
| `commodity` | String | Crop or commodity name (e.g. CORN, SOYBEANS, WHEAT, COTTON, CATTLE) |
| `state` | Select | US state or "US TOTAL" for national data |
| `year` | String | 4-digit year (e.g. 2022) |
| `sector` | Select | Data sector: CROPS, ANIMALS & PRODUCTS, ECONOMICS, DEMOGRAPHICS, ENVIRONMENTAL |
| `source` | Select | SURVEY (annual) or CENSUS (every 5 years) |
| `agg_level` | Select | Geographic aggregation: NATIONAL, STATE, COUNTY, etc. |
| `apiKey` | String | Optional NASS API key (free, get at quickstats.nass.usda.gov/api) |
| `maxItems` | Integer | Maximum records to return (default: 100, max: 5000) |

### Output Fields

| Field | Type | Description |
|-------|------|-------------|
| `source_desc` | String | Program: SURVEY or CENSUS |
| `year` | Integer | Year of the data |
| `period_desc` | String | Period (YEAR, APR, MARKETING YEAR, etc.) |
| `agg_level_desc` | String | Geographic level (NATIONAL, STATE, COUNTY) |
| `state_name` | String | State name |
| `state_fips_code` | String | State FIPS code |
| `county_name` | String | County name (county-level data) |
| `county_code` | String | County FIPS code |
| `commodity_desc` | String | Commodity name (CORN, SOYBEANS, etc.) |
| `statisticcat_desc` | String | Category (AREA HARVESTED, PRODUCTION, PRICE RECEIVED) |
| `unit_desc` | String | Unit of measurement (ACRES, BU, $ / BU) |
| `value` | Number | Statistical value |
| `cv_percent` | Number | Coefficient of variation % (data quality) |
| `domain_desc` | String | Domain (TOTAL, CHEMICAL, ECONOMIC CLASS) |
| `domaincat_desc` | String | Domain category |
| `sector_desc` | String | Sector (CROPS, ANIMALS & PRODUCTS, etc.) |
| `data_item` | String | Full data item description |
| `scrapedAt` | String | ISO-8601 scrape timestamp |

### Example Output

```json
{
  "source_desc": "SURVEY",
  "year": 2022,
  "period_desc": "YEAR",
  "agg_level_desc": "STATE",
  "state_name": "Iowa",
  "state_fips_code": "19",
  "commodity_desc": "CORN",
  "statisticcat_desc": "PRODUCTION",
  "unit_desc": "BU",
  "value": 2466834000.0,
  "cv_percent": 2.1,
  "domain_desc": "TOTAL",
  "domaincat_desc": "NOT SPECIFIED",
  "sector_desc": "CROPS",
  "data_item": "CORN, GRAIN - PRODUCTION, MEASURED IN BU",
  "scrapedAt": "2026-06-02T10:00:00+00:00"
}
```

### Modes

#### `searchCommodity` (default)

Search for all data for a specific commodity. Combine with `state` and `year` to narrow down.

#### `searchByState`

Get all agricultural statistics for a specific state in a given year.

#### `browseCensus`

Browse agricultural census data (collected every 5 years: 2017, 2022). Census data is more comprehensive than survey data.

#### `searchSurvey`

Search annual survey data by commodity and filters.

### Common Commodities

CORN, SOYBEANS, WHEAT, COTTON, RICE, SORGHUM, BARLEY, OATS, SUNFLOWER, POTATOES, TOMATOES, APPLES, CATTLE, HOGS, CHICKENS, TURKEYS, MILK, EGGS, HONEY

### Data Note: Suppressed Values

USDA NASS suppresses some data to protect individual farmer privacy. Suppressed values are indicated in the raw data as `(D)`, `(Z)`, etc. This actor omits the `value` field for suppressed records (dimensional fields like state, commodity, and year are still included).

### Frequently Asked Questions

**Q: Is an API key required?**\
A: No. This actor works without an API key by fetching data through the QuickStats website. If you have a free NASS API key, provide it via `apiKey` for potentially faster access.

**Q: How do I get a free API key?**\
A: Register at <https://quickstats.nass.usda.gov/api>. The key is free and provides higher rate limits.

**Q: What is the difference between SURVEY and CENSUS data?**\
A: SURVEY data is collected annually and provides timely estimates. CENSUS data is collected every 5 years (2012, 2017, 2022) and provides more detailed, comprehensive counts.

**Q: How many records can I get?**\
A: Up to 5,000 records per run. For large extracts, run multiple queries with different filters.

**Q: What does CV% mean?**\
A: The Coefficient of Variation percentage indicates data quality. Lower values indicate more reliable estimates. Values above 25% should be used with caution.

# Actor input Schema

## `mode` (type: `string`):

Search mode.

## `commodity` (type: `string`):

Commodity or crop name (e.g. CORN, SOYBEANS, WHEAT, COTTON, CATTLE). Case-insensitive.

## `state` (type: `string`):

US State to filter by (or 'US TOTAL' for national).

## `year` (type: `string`):

4-digit year for data (e.g. 2022, 2021). Leave blank for all available years.

## `sector` (type: `string`):

Data sector to filter by.

## `source` (type: `string`):

Data program: SURVEY (annual survey data) or CENSUS (agricultural census, every 5 years).

## `agg_level` (type: `string`):

Level of geographic aggregation for results.

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

Optional USDA NASS QuickStats API key. Get a free key at https://quickstats.nass.usda.gov/api. If provided, data is fetched via the official API. Without a key, data is fetched via the QuickStats website (same data, slightly slower).

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

Maximum number of records to return.

## Actor input object example

```json
{
  "mode": "searchCommodity",
  "commodity": "CORN",
  "state": "Iowa",
  "year": "2022",
  "source": "SURVEY",
  "maxItems": 20
}
```

# Actor output Schema

## `records` (type: `string`):

Dataset containing all scraped USDA NASS agricultural statistics records.

# 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 = {
    "mode": "searchCommodity",
    "commodity": "CORN",
    "state": "Iowa",
    "year": "2022",
    "source": "SURVEY",
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/usda-nass-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 = {
    "mode": "searchCommodity",
    "commodity": "CORN",
    "state": "Iowa",
    "year": "2022",
    "source": "SURVEY",
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/usda-nass-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 '{
  "mode": "searchCommodity",
  "commodity": "CORN",
  "state": "Iowa",
  "year": "2022",
  "source": "SURVEY",
  "maxItems": 20
}' |
apify call crawlerbros/usda-nass-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crawlerbros/usda-nass-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/i7f0szjY2bMPs1iCx/builds/lYjFstHEIOOjAxOOi/openapi.json
