Skip to main content
Use this when you need the price history of a raw ingredient, for example to track input costs, check a supplier’s quote against the market, or feed a forecast. The Commodities API is two endpoints used together. First you list price series to find the one you want. Then you ask for that series’ values by date.

What’s covered

Every price is grouped the way USDA Market News groups it: a category, then a commodity inside it. Pass either one, or both, to List Commodities. ?category=grains&commodity=corn lists every corn price series. A few groupings follow USDA rather than the grocery aisle: eggs are under poultry, and soybeans, oilseeds and dry beans are under grains, because USDA reports them in its grain bids. Where USDA splits one crop into types, such as bell and jalapeño peppers or grape and plum tomatoes, the crop is the commodity and the type is one of its attributes. Sweet corn is sweet_corn under vegetables; corn under grains is field corn. Fruit and vegetables include every product the USDA has priced within two years of its newest report, each with its full history.

Find a series in four layers

Each price series answers four questions, and List Commodities can narrow on each one: Each result is one series: its id and metric_name, the product it prices (its category, commodity and attributes), then one field for each market and series layer, named exactly like the parameter that filters it. You never have to take a metric_name apart, because every part of it is also its own field.

List commodities

GET /v1/commodities lists price series, narrowed by any of the four layers, one page at a time. It is free.
Use first_observed_on and last_observed_on to see how far back a series goes and how fresh it is before you ask for its values. When next_cursor is null, you have reached the last page. The --globoff flag stops curl from reading the square brackets in attributes[...] as a pattern.

Get commodity metric values

GET /v1/commodities/metric-values returns dated values for one or more series. It costs $0.01 per call, however many series you ask for.

When you leave out the dates

If you leave out start_date, each series returns a recent stretch. How long depends on how often the series is published: The stretch is counted back from end_date if you pass it. If you don’t, it is counted back from the series’ own newest value, not from today, so a series that stopped updating still returns its last stretch. Each series is counted on its own, so two series in one call can start on different dates. Pass start_date to get an exact range, or an early date such as start_date=1990-01-01 to get a series’ full history.

Understanding the response

  • data has one entry per series you asked for, in the order you asked.
  • Each entry describes the series with the same fields as List Commodities, then adds start_date, end_date and values.
  • start_date and end_date are the first and last dates used for that series. They are null only when you passed no dates and the series has no values at all.
  • unit tells you how to read value. For example, usd_per_lb is dollars per pound.
  • values is in date order, with one value per date. Days with no value, such as weekends for a daily series, are left out.
  • value is the number the USDA published, in the series’ unit. A price the USDA publishes in cents is given in dollars.
  • A date range with no values returns the series with an empty values array, not an error.
To compare series side by side, pass several names separated by commas, for example a Chicago and a national cheddar price over the same weeks. If any name is wrong, the whole request fails with 400, and the message names the ones it doesn’t know. So a typo never silently drops a series.
400 Unknown metric

Series fields

Returned by both endpoints, inside data[]. Get Commodity Metric Values adds:

Validation rules

Summary

What to do next