# 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, NaN 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/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 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/](https://quickstats.nass.usda.gov/)  
Free API key available at: [https://quickstats.nass.usda.gov/api](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("💾 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 '{
  "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": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlerbros/usda-nass-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "USDA NASS Agricultural Statistics Scraper",
        "description": "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.",
        "version": "1.0",
        "x-build-id": "lYjFstHEIOOjAxOOi"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crawlerbros~usda-nass-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crawlerbros-usda-nass-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/crawlerbros~usda-nass-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crawlerbros-usda-nass-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/crawlerbros~usda-nass-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crawlerbros-usda-nass-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",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "searchCommodity",
                            "searchByState",
                            "browseCensus",
                            "searchSurvey"
                        ],
                        "type": "string",
                        "description": "Search mode.",
                        "default": "searchCommodity"
                    },
                    "commodity": {
                        "title": "Commodity / Crop",
                        "type": "string",
                        "description": "Commodity or crop name (e.g. CORN, SOYBEANS, WHEAT, COTTON, CATTLE). Case-insensitive.",
                        "default": "CORN"
                    },
                    "state": {
                        "title": "State",
                        "enum": [
                            "US TOTAL",
                            "Alabama",
                            "Alaska",
                            "Arizona",
                            "Arkansas",
                            "California",
                            "Colorado",
                            "Connecticut",
                            "Delaware",
                            "Florida",
                            "Georgia",
                            "Hawaii",
                            "Idaho",
                            "Illinois",
                            "Indiana",
                            "Iowa",
                            "Kansas",
                            "Kentucky",
                            "Louisiana",
                            "Maine",
                            "Maryland",
                            "Massachusetts",
                            "Michigan",
                            "Minnesota",
                            "Mississippi",
                            "Missouri",
                            "Montana",
                            "Nebraska",
                            "Nevada",
                            "New Hampshire",
                            "New Jersey",
                            "New Mexico",
                            "New York",
                            "North Carolina",
                            "North Dakota",
                            "Ohio",
                            "Oklahoma",
                            "Oregon",
                            "Pennsylvania",
                            "Rhode Island",
                            "South Carolina",
                            "South Dakota",
                            "Tennessee",
                            "Texas",
                            "Utah",
                            "Vermont",
                            "Virginia",
                            "Washington",
                            "West Virginia",
                            "Wisconsin",
                            "Wyoming"
                        ],
                        "type": "string",
                        "description": "US State to filter by (or 'US TOTAL' for national).",
                        "default": "Iowa"
                    },
                    "year": {
                        "title": "Year",
                        "type": "string",
                        "description": "4-digit year for data (e.g. 2022, 2021). Leave blank for all available years.",
                        "default": "2022"
                    },
                    "sector": {
                        "title": "Sector",
                        "enum": [
                            "ANIMALS & PRODUCTS",
                            "CROPS",
                            "DEMOGRAPHICS",
                            "ECONOMICS",
                            "ENVIRONMENTAL"
                        ],
                        "type": "string",
                        "description": "Data sector to filter by."
                    },
                    "source": {
                        "title": "Data Source / Program",
                        "enum": [
                            "SURVEY",
                            "CENSUS"
                        ],
                        "type": "string",
                        "description": "Data program: SURVEY (annual survey data) or CENSUS (agricultural census, every 5 years).",
                        "default": "SURVEY"
                    },
                    "agg_level": {
                        "title": "Geographic Aggregation Level",
                        "enum": [
                            "NATIONAL",
                            "STATE",
                            "AGRICULTURAL DISTRICT",
                            "COUNTY",
                            "REGION : MULTI-STATE",
                            "REGION : SUB-STATE",
                            "WATERSHED"
                        ],
                        "type": "string",
                        "description": "Level of geographic aggregation for results."
                    },
                    "apiKey": {
                        "title": "USDA NASS API Key (optional)",
                        "type": "string",
                        "description": "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": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum number of records to return.",
                        "default": 100
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
