GnistAI GnistAI
Log in

FAOSTAT (FAO Food & Agriculture)

FAO food and agriculture statistics — crop production, livestock, trade, prices, food security, land use, fertilizers, and emissions data for 193+ countries from 1961 to present.

Overview   |   MCP   |   REST API   |   OpenAPI   |   CLI   |   Tutorial   |   Toolkits   |   Home
status: healthy status status healthy healthy tools: 7 tools tools 7 7 type: api wrapper type type api wrapper api wrapper lifecycle: maintained lifecycle lifecycle maintained maintained Economics

Data source: FAOSTAT API

REST Bridge Endpoint https://context.gnist.ai/rest/faostat/
Authentication

All requests require a Gnist-API-Key header (or api_key query parameter).

Free tier: 100 calls/day. Get your API key.

Tools (7)

search_datasets

Search the FAOSTAT dataset catalog by keyword.

Search across all FAO domains for datasets matching your query.
FAOSTAT covers crop production, livestock, trade, prices, food
security, land use, fertilizers, emissions, and more for 193+ countries.

Args:
query: Search term (e.g. "wheat", "rice", "food prices").
limit: Number of results to return (1-50, default 20).

Returns:
Matching datasets with domain codes needed for get_data calls.

ParameterTypeRequiredDescription
querystringrequiredSearch term for FAOSTAT datasets (e.g. "wheat", "rice production", "food prices", "fertilizer", "livestock").
limitintegeroptionalNumber of results to return (1-50, default 20). (default: 20)
Request Body
{
  "query": "example"
}
list_datasets

List available FAOSTAT dataset groups and domains.

Browse the full FAOSTAT catalog organized by topic group. Use this
to discover available domains before querying data. Key groups:
Production (QCL, QI, QV), Trade (TCL, TM), Prices (PP, CP),
Food Security (FS), Food Balances (FBS), Emissions (GT, GCE).

Args:
group: Optional group name filter. Omit to list all datasets.
limit: Maximum datasets to return (1-200, default 50).

Returns:
List of datasets with group and domain codes.

ParameterTypeRequiredDescription
groupanyoptionalOptional group filter (e.g. "Production", "Trade", "Prices", "Food Security", "Emissions"). Omit to list all.
limitintegeroptionalMaximum datasets to return (1-200, default 50). (default: 50)
Request Body
{
  "query": "example"
}
get_domain_dimensions

Get available dimensions and filter options for a FAOSTAT domain.

Shows what filters (area, element, item, year) are available for
a dataset, so you know what parameters to pass to get_data.
Use get_dimension_codes to see the valid values for each dimension.

Args:
domain: FAOSTAT domain code from list_datasets.

Returns:
List of dimensions with IDs and labels.

ParameterTypeRequiredDescription
domainstringrequiredFAOSTAT domain code (e.g. "QCL" for crops, "TCL" for trade, "PP" for prices, "FS" for food security). Use list_datasets to find codes.
Request Body
{
  "domain": "example"
}
get_dimension_codes

Get valid codes for a specific dimension of a FAOSTAT domain.

Look up what area codes, element codes, item codes, or year values
are valid for a domain. Use these codes in get_data filters.

Common area codes: 231 (USA), 351 (China), 100 (India), 5000 (World).
Common element codes vary by domain (e.g. 2510=Production quantity).

Args:
domain: FAOSTAT domain code.
dimension: Dimension name (area, element, item, year, etc.).
limit: Maximum codes to return (1-500, default 100).

Returns:
List of valid codes with labels and descriptions.

ParameterTypeRequiredDescription
domainstringrequiredFAOSTAT domain code (e.g. "QCL", "TCL", "PP").
dimensionstringrequiredDimension name (e.g. "area" for countries, "element" for indicators, "item" for commodities, "year" for time periods).
limitintegeroptionalMaximum codes to return (1-500, default 100). (default: 100)
Request Body
{
  "domain": "example",
  "dimension": "example"
}
get_data

Fetch data from a FAOSTAT domain.

Query any FAOSTAT dataset filtered by area (country/region),
element (indicator), item (commodity), and year. Covers production,
trade, prices, food security, land use, emissions, and more
for 193+ countries from 1961 to present.

Args:
domain: FAOSTAT domain code. Use list_datasets to find codes.
areas: FAO area codes. Omit for all areas.
elements: Element codes for indicator type.
items: Item codes for commodities.
years: Year values.
area_cs: Area coding system (M49, FAO, ISO2, ISO3).
limit: Maximum records to return (1-2000, default 500).

Returns:
Data records with area, element, item, year, value, unit, and flags.

ParameterTypeRequiredDescription
domainstringrequiredFAOSTAT domain code (e.g. "QCL" for crops/livestock, "TCL" for trade, "PP" for producer prices, "FS" for food security, "FBS" for food balances). Use list_datasets to find codes.
areasanyoptionalFAO area codes (e.g. ["231", "351", "5000"] for USA, China, World). Use get_dimension_codes to find codes. Omit for all areas.
elementsanyoptionalElement codes for the indicator type (e.g. ["2510"] for production quantity, ["2610"] for import quantity). Use get_dimension_codes to find valid codes.
itemsanyoptionalItem codes for commodities (e.g. ["15"] for wheat, ["27"] for rice). Use get_dimension_codes to find valid codes.
yearsanyoptionalYear values (e.g. ["2020", "2021", "2022"]). Omit for all available years.
area_csanyoptionalArea coding system: "M49" (default), "FAO", "ISO2", or "ISO3".
limitintegeroptionalMaximum records to return (1-2000, default 500). (default: 500)
Request Body
{
  "domain": "example"
}
compare_countries

Compare data across countries/regions for a FAOSTAT domain.

Fetches the same indicator for multiple areas side by side.
Useful for cross-country analysis of production, trade volumes,
food prices, food security metrics, and more.

Args:
domain: FAOSTAT domain code.
area_codes: FAO area codes to compare. Maximum 20.
elements: Element codes to filter by.
items: Item codes to filter by.
years: Year values to filter by.
area_cs: Area coding system.

Returns:
Data grouped by area for easy comparison.

ParameterTypeRequiredDescription
domainstringrequiredFAOSTAT domain code (e.g. "QCL", "FS", "PP").
area_codeslist[string]requiredFAO area codes to compare (e.g. ["231", "351", "100"] for USA, China, India). Maximum 20.
elementsanyoptionalElement codes to filter by.
itemsanyoptionalItem codes to filter by.
yearsanyoptionalYear values to filter by.
area_csanyoptionalArea coding system: "M49", "FAO", "ISO2", or "ISO3".
Request Body
{
  "domain": "example",
  "area_codes": [
    "example"
  ]
}
report_feedback

Report a bug, feature request, or general feedback for this data source.

Use this when something doesn't work as expected, when you'd like
a new feature, or when you have suggestions for improvement.

Args:
feedback: Describe the issue or suggestion.
feedback_type: One of 'bug', 'feature_request', or 'general'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: "general")
Request Body
{
  "feedback": "example"
}

Quick Start

Shell
curl -X POST "https://context.gnist.ai/rest/faostat/search_datasets" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"query": "example"}'
Python
import httpx

resp = httpx.post(
    "https://context.gnist.ai/rest/faostat/search_datasets",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={
  "query": "example"
},
)
print(resp.json())

Related Toolkits (Economics)

Resources