Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.climatifai.com/llms.txt

Use this file to discover all available pages before exploring further.

The climate endpoint returns two time series for a geographic location: a historical monthly record spanning the years you specify, and a CMIP6 climate projection under a chosen emissions scenario. Both series include temperature, precipitation, and soil moisture for each month. You can use this data to analyse long-term climate trends, calibrate crop models, or compare a baseline period against projected future conditions.

Endpoint

GET api.climatifai.com/agri/climate

Parameters

lat
float
required
Latitude of the location in decimal degrees, WGS 84.
lon
float
required
Longitude of the location in decimal degrees, WGS 84.
from
integer
default:"1991"
Start year (inclusive) for the historical data series. Combined with to, this defines the historical baseline period.
to
integer
default:"2020"
End year (inclusive) for the historical data series.
scenario
string
default:"SSP3-7.0"
CMIP6 emissions scenario to use for the projected series. Example values: SSP1-2.6, SSP2-4.5, SSP3-7.0, SSP5-8.5.
country_iso
string
Optional ISO 3166-1 alpha-2 country code for the location being queried. Must be a LATAM country code, excluding Brazil (BR). Examples: PE, MX, CO. Safe to omit for standard use.

Response

lat
float
required
Latitude echoed from the request.
lon
float
required
Longitude echoed from the request.
scenario
string
required
CMIP6 scenario used for the projected series, echoed from the request.
historical
array
required
Monthly climate observations for the requested historical period. Each element is a ClimateMonth object.
projected
array
required
Monthly climate values from the CMIP6 projection. Shares the same ClimateMonth structure as historical.
_cache
object
Cache freshness metadata for both the historical and projected datasets.
_upstream_hints
object
Contains upstream error information if any part of the data could not be fetched live and a stale or fallback result was served instead.

Error codes

CodeDescription
502Upstream error from Open-Meteo. The detail field contains the original message.
503Open-Meteo rate limit exceeded. Retry after a short back-off.

Example

curl "https://api.climatifai.com/agri/climate?lat=4.711&lon=-74.0721&from=1991&to=2020&scenario=SSP3-7.0&country_iso=CO"
{
  "lat": 4.711,
  "lon": -74.0721,
  "scenario": "SSP3-7.0",
  "historical": [
    {
      "year": 1991,
      "month": 1,
      "temp_c": 13.8,
      "precip_mm": 42.1,
      "soil_moisture": 0.198
    },
    {
      "year": 1991,
      "month": 2,
      "temp_c": 14.2,
      "precip_mm": 58.4,
      "soil_moisture": 0.213
    }
  ],
  "projected": [
    {
      "year": 2041,
      "month": 1,
      "temp_c": 15.1,
      "precip_mm": 38.7,
      "soil_moisture": 0.181
    },
    {
      "year": 2041,
      "month": 2,
      "temp_c": 15.6,
      "precip_mm": 52.0,
      "soil_moisture": 0.195
    }
  ],
  "_cache": {
    "historical": {
      "cached_at": "2026-05-18T08:30:00Z",
      "stale": false
    },
    "projected": {
      "cached_at": "2026-05-18T08:30:00Z",
      "stale": false
    },
    "any_stale": false
  },
  "_upstream_hints": {
    "historical": null,
    "projected": null
  }
}