Weather Endpoints

About

Here we list all the available endpoints from Leaf's Weather API. For an easy way to call them, we recommend using Leaf's Postman collection.

All HTTP methods should be prepended by this service's endpoint:

https://api.withleaf.io/services/weather/api

This service has the following endpoints available:

DescriptionEndpoints
Get Daily ForecastGET /users/{leafUserId}/weather/forecast/field/{fieldId}/daily
Get Hourly ForecastGET /users/{leafUserId}/weather/forecast/field/{fieldId}/hourly
Get Daily HistoricalGET /users/{leafUserId}/weather/historical/field/{fieldId}/daily
Get Hourly HistoricalGET /users/{leafUserId}/weather/historical/field/{fieldId}/hourly

Endpoints

Get Daily Forecast

 GET /users/{leafUserId}/weather/forecast/field/{fieldId}/daily

Get daily forecasted weather data by leaf user and field. If dates are not set on the endpoint, the response will return forecast data for the next seven days by default.

Parameter (to filter by)values
endTimeISO 8601 date. Returns operations until the endTime
startTimeISO 8601 date. Returns operations from the startTime onward
modelWeather model data: icon, gfs, ifs, jma, gem or arpegeArome

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/weather/api/users/{leafUserId}/weather/forecast/field/{fieldId}/daily'

Response

{
"type": "Feature",
"properties": {
"maxTemperature": {
"values": [
"time": "str",
"value": int
],
"unit": "ºC"
},
"sunrise": {
"values": [
"time": "str",
"value": "str"
],
"unit": "iso8601"
},
"snowfallSum": {
"values": [
"time": "str",
"value": int
],
"unit": "cm"
},
"precipitationSum": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"maxWindspeed": {
"values": [
"time": "str",
"value": int
],
"unit": "km/h"
},
"evapotranspiration": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"processedTime": "str",
"rainSum": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"maxWindgusts": {
"values": [
"time": "str",
"value": int
],
"unit": "km/h"
},
"meanTemperature": {
"values": [
"time": "str",
"value": int
],
"unit": "°C"
},
"minTemperature": {
"values": [
"time": "str",
"value": int
],
"unit": "°C"
},
"sunset": {
"values": [
"time": "str",
"value": "str"
],
"unit": "iso8601"
},
"windDirection": {
"values": [
"time": "str",
"value": int
],
"unit": "°"
}
},
"geometry": {
"type": "Point",
"coordinates": [
-89.64355775454169,
39.802794365611476
]
}
}

Get Hourly Forecast

 GET /users/{leafUserId}/weather/forecast/field/{fieldId}/hourly

Get hourly forecasted weather data by Leaf User and field. If dates are not set on the endpoint, the response will return forecast data for the next seven days by default.

Parameter (to filter by)values
endTimeISO 8601 date. Returns operations until the endTime
startTimeISO 8601 date. Returns operations from the startTime onward
modelWeather model data: icon, gfs, ifs, jma, gem or arpegeArome

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/weather/api/users/{leafUserId}/weather/forecast/field/{fieldId}/hourly'

Response

{
"type": "Feature",
"properties": {
"rain": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"dewpoint": {
"values": [
"time": "str",
"value": int
],
"unit": "°C"
},
"windgusts": {
"values": [
"time": "str",
"value": int
],
"unit": "km/h"
},
"snowfall": {
"values": [
"time": "str",
"value": int
],
"unit": "cm"
},
"evapotranspiration": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"shortwaveRadiation": {
"values": [
"time": "str",
"value": int
],
"unit": "W/m²"
},
"processedTime": "str",
"cloudcover": {
"values": [
"time": "str",
"value": int
],
"unit": "%"
},
"precipitation": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"relativeHumidity": {
"values": [
"time": "str",
"value": int
],
"unit": "%"
},
"temperature": {
"values": [
"time": "str",
"value": int
],
"unit": "°C"
},
"windspeed": {
"values": [
"time": "str",
"value": int
],
"unit": "km/h"
},
"windDirection": {
"values": [
"time": "str",
"value": int
],
"unit": "km/h"
}
},
"geometry": {
"type": "Point",
"coordinates": [
-89.64355775454169,
39.802794365611476
]
}
}

Get Daily Historical

 GET /users/{leafUserId}/weather/historical/field/{fieldId}/daily

Get daily historical weather data by Leaf User and field. If the dates are not defined in the endpoint, the response will return data from the last seven days by default.

Please note, historical weather data from less than 5 days ago is unavailable. If you’re wanting historical weather data within the last 5 days, you can use the forecast service to get this information.

Parameter (to filter by)values
endTimeISO 8601 date. Returns operations until the endTime
startTimeISO 8601 date. Returns operations from the startTime onward
modelHistorical model data: era5 or era5Land

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/weather/api/users/{leafUserId}/weather/historical/field/{fieldId}/daily'

Response

{
"type": "Feature",
"properties": {
"maxTemperature": {
"values": [
"time": "str",
"value": int
],
"unit": "ºC"
},
"sunrise": {
"values": [
"time": "str",
"value": "str"
],
"unit": "iso8601"
},
"snowfallSum": {
"values": [
"time": "str",
"value": int
],
"unit": "cm"
},
"precipitationSum": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"maxWindspeed": {
"values": [
"time": "str",
"value": int
],
"unit": "km/h"
},
"evapotranspiration": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"processedTime": "str",
"rainSum": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"maxWindgusts": {
"values": [
"time": "str",
"value": int
],
"unit": "km/h"
},
"meanTemperature": {
"values": [
"time": "str",
"value": int
],
"unit": "°C"
},
"minTemperature": {
"values": [
"time": "str",
"value": int
],
"unit": "°C"
},
"sunset": {
"values": [
"time": "str",
"value": "str"
],
"unit": "iso8601"
},
"windDirection": {
"values": [
"time": "str",
"value": int
],
"unit": "°"
}
},
"geometry": {
"type": "Point",
"coordinates": [
-89.64355775454169,
39.802794365611476
]
}
}

Get Hourly Historical

 GET /users/{leafUserId}/weather/historical/field/{fieldId}/hourly

Get hourly historical weather data by Leaf User and field. If the dates are not defined in the endpoint, the response will return data from the last seven days by default.

Parameter (to filter by)values
endTimeISO 8601 date. Returns operations until the endTime
startTimeISO 8601 date. Returns operations from the startTime onward
modelHistorical model data: era5 or era5Land

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/weather/api/users/{leafUserId}/weather/historical/field/{fieldId}/hourly'

Response

{
"type": "Feature",
"properties": {
"rain": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"dewpoint": {
"values": [
"time": "str",
"value": int
],
"unit": "°C"
},
"windgusts": {
"values": [
"time": "str",
"value": int
],
"unit": "km/h"
},
"snowfall": {
"values": [
"time": "str",
"value": int
],
"unit": "cm"
},
"evapotranspiration": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"shortwaveRadiation": {
"values": [
"time": "str",
"value": int
],
"unit": "W/m²"
},
"processedTime": "str",
"cloudcover": {
"values": [
"time": "str",
"value": int
],
"unit": "%"
},
"precipitation": {
"values": [
"time": "str",
"value": int
],
"unit": "mm"
},
"relativeHumidity": {
"values": [
"time": "str",
"value": int
],
"unit": "%"
},
"temperature": {
"values": [
"time": "str",
"value": int
],
"unit": "°C"
},
"windspeed": {
"values": [
"time": "str",
"value": int
],
"unit": "km/h"
},
"windDirection": {
"values": [
"time": "str",
"value": int
],
"unit": "km/h"
}
},
"geometry": {
"type": "Point",
"coordinates": [
-89.64355775454169,
39.802794365611476
]
}
}
Warning

If there is no data available at that time/day, the property will be returned as null.