Leaf’s Weather API provides historical and forecasted weather data tied to field boundaries or arbitrary lat/lon coordinates. Data is available in daily or hourly granularity, sourced from multiple weather models worldwide.
Forecast data
The forecast service covers 5 days in the past through 10 days into the future. If you don’t specify dates, Leaf returns the next 7 days by default.
Forecast models
| Model | Provider | Country | Resolution | Forecast Length | Update Frequency |
|---|
| GFS | NOAA | United States | 3–25 km | 16 days | Every hour |
| ICON | Deutscher Wetterdienst | Germany | 2–11 km | 7.5 days | Every 3 hours |
| IFS | ECMWF | European Union | 44 km | 7 days | Every 6 hours |
| JMA | JMA | Japan | 5–55 km | 11 days | Every 3 hours |
| GEM | Canadian Weather Service | Canada | 2.5 km | 10 days | Every 6 hours |
| Arpege & Arome | Météo-France | France | 1–40 km | 4 days | Every 6 hours |
The default model is gfs. Leaf selects the best model for any given location when using the default, so you generally don’t need to specify one unless you want data from a particular source.
Forecast variables
Variables available across most models (some models omit soil temperature or soil moisture):
Daily: temperature (mean/min/max), soil temperature (mean/min/max), sunrise, sunset, max wind speed, max wind gusts, wind direction, evapotranspiration, rain sum, snowfall sum, precipitation sum.
Hourly (additional): dew point, longwave radiation, shortwave radiation, cloud cover, relative humidity, soil moisture at multiple depths.
Sunrise and sunset are daily-only. Dew point, radiation, cloud cover, and relative humidity are hourly-only. All other variables appear in both daily and hourly responses.
Historical data
Historical weather data is sourced from ERA5 reanalysis products and goes back to 1940 (ERA5) or 1950 (ERA5-Land). There is a 5-day delay on historical data availability. For weather data within the last 5 days, use the forecast endpoints instead.
Historical models
| Model | Coverage | Resolution | Temporal Resolution | Data Availability |
|---|
| ERA5 | Global | ~25 km | Hourly | 1940–present |
| ERA5-Land | Global | ~11 km | Hourly | 1950–present |
The default is era5. ERA5-Land offers higher spatial resolution but starts a decade later.
Historical variables
The same variable set as forecast data, with soil moisture measured at different depth intervals: 0–7 cm, 7–28 cm, 28–100 cm, and 100–255 cm (vs. 0–1 cm, 1–3 cm, 3–9 cm, 9–27 cm, 27–81 cm for forecast models).
Query options
You can fetch weather data in two ways:
By field — Requires a Leaf user ID and field ID. Leaf uses the centroid of the field boundary.
GET /services/weather/api/users/{leafUserId}/weather/forecast/field/{fieldId}/daily
GET /services/weather/api/users/{leafUserId}/weather/historical/field/{fieldId}/hourly
By lat/lon — No Leaf user or field required. Pass coordinates directly.
GET /services/weather/api/weather/forecast/daily/{lat},{lon}
GET /services/weather/api/weather/historical/hourly/{lat},{lon}
All endpoints accept these parameters:
| Parameter | Description |
|---|
startTime | Start date (YYYY-MM-DD). |
endTime | End date (YYYY-MM-DD). |
model | Weather model to use. Defaults to gfs (forecast) or era5 (historical). |
units | metric (default) or imperial. |
Request limits
- Daily endpoints: maximum span of 366 days per request.
- Hourly endpoints: maximum span of 30 days per request.
Units
All numeric values respect the units parameter:
| Measurement | Metric | Imperial |
|---|
| Temperature | °C | °F |
| Precipitation / Rain / ET | mm | inch |
| Snowfall | cm | inch |
| Wind speed / gusts | km/h | mph |
| Radiation | W/m² | W/m² |
| Soil moisture | m³/m³ | m³/m³ |
| Cloud cover / Humidity | % | % |
| Wind direction | ° | ° |
All weather endpoints return GeoJSON Features. The geometry is a Point (field centroid or the lat/lon you specified). The properties object contains each weather variable as a named key with values (time series array) and unit.
{
"type": "Feature",
"properties": {
"maxTemperature": {
"values": [
{ "time": "2024-07-21T00:00:00", "value": 28.8 },
{ "time": "2024-07-22T00:00:00", "value": 28.1 }
],
"unit": "ºC"
}
},
"geometry": {
"type": "Point",
"coordinates": [-89.643, 39.802]
}
}
If no data is available for a given time/day, the value is returned as null.
What to do next