USDA FAS Global Agricultural Trade API
USDA FAS Global Agricultural Trade API
USDA FAS Global Agricultural Trade System data for U.S. Census trade and UN Comtrade, returned as JSON or XML through import, export and re-export endpoints. Records use partner or reporter, year and month, HS commodity codes, quantities, values, units and optional U.S. customs districts; a free api.data.gov key is required.
Required Attribution:
Requested citation: "GATS Data: U.S Census Bureau Trade Data and U.N Commodity Trade Statistics Data."
Coverage
Monthly U.S. agricultural trade history extends to 1967 and is updated monthly; UN trade covers nearly 200 countries or areas from the Harmonized System's 1989 inception and updates after national submissions are standardized. U.S. routes query one partner, year and month, while UN routes query one reporter and year; no numeric response cap is stated.
Verdict
GATS supplies bilateral agricultural trade-flow signals for demand, sourcing and market-share analysis. U.S. Census series are monthly, while UN series are annual and arrive after countries submit data, creating uneven lags across reporters. Census corrections are applied once a year, and classifications can require HS-code concordance across time. Lookup endpoints are needed for commodity, unit, country, region and customs-district labels.
Get the free weekly email
Free weekly email of newly verified free data. Unsubscribe by emailing us.
By entering your email and clicking Subscribe, you agree to receive the Signal Lab weekly email from Quantum Data Technologies Ltd., 3200-650 West Georgia Street, Vancouver, BC V6B 4P7, Canada (signal-lab@qdt.ai). You can unsubscribe at any time: reply "unsubscribe" to any email or write to signal-lab@qdt.ai. See our Privacy Policy.
Use in your agent
Load USDA GATS monthly exports into pandas and Parquet. Checked against the provider's documentation on Nov 1, 2026.
Access
- Obtain a free api.data.gov key through the FAS portal signup form.
- Set the key in FAS_API_KEY and send it in the API_KEY header.
Request
curl 'https://apps.fas.usda.gov/OpenData/api/gats/censusExports/partnerCode/CH/year/2025/month/1' -H "API_KEY: $FAS_API_KEY" -H 'Accept: application/json'Format
JSON array or XML response of monthly U.S. Census agricultural exports for one partner, year and month, with commodity and unit identifiers and trade measures.
Load into pandas and Parquet
Needs Python 3 with requests, pandas and pyarrow.
"""USDA GATS monthly U.S. exports -> pandas -> Parquet."""
import os
import requests
import pandas as pd
URL = "https://apps.fas.usda.gov/OpenData/api/gats/censusExports/partnerCode/CH/year/2025/month/1"
headers = {"API_KEY": os.environ["FAS_API_KEY"], "Accept": "application/json"}
r = requests.get(URL, headers=headers, timeout=60)
r.raise_for_status()
df = pd.json_normalize(r.json())
df.to_parquet("usda_fas_gats_ch_2025_01.parquet", index=False)
print(len(df), "GATS export rows", len(df.columns), "columns")Not run: it needs a free API key.
Limits
- Rate limit: Not stated.
- U.S. Census trade routes select one partner, year and month per call.
- UN Comtrade routes select one reporter and year per call.
Quirks
- The Swagger example uses partner code CH for China; obtain valid codes from the countries endpoint instead of assuming ISO codes.
- U.S. Census commodities are available at HS10 detail, while the documented UN trade routes use HS6.
- Census data receive annual corrections, and UN data update only after national submissions are standardized.
Terms and attribution
- Access or use of the FAS API constitutes acceptance of its terms.
- GATS combines U.S. Census Bureau trade data and UN Commodity Trade Statistics data.
- Do not alter or falsely represent content and still claim FAS as the source.
Sources
- https://apps.fas.usda.gov/opendatawebV2/main.6da18f8b4fa8a2baed40.js: “Historical U.S. agricultural trade data is available back to 1967.”
- https://apps.fas.usda.gov/opendatawebV2/main.6da18f8b4fa8a2baed40.js: “UN trade data is available for nearly 200 countries or areas, dating from the inception of the Harmonized System (HS) of trade codes in 1989 to present.”
- https://apps.fas.usda.gov/opendata/swagger/docs/v1: “Census reports data on a monthly basis with corrections applied once a year.”
Information and education only. Not financial, investment, legal or tax advice. Listings can be inaccurate, incomplete or out of date and are provided "as is". Free tiers, limits and licenses belong to each provider and can change, so check the provider's own terms before you rely on them. Terms & Disclaimer