Frost Risk
Agriculture Math & Calculations Credits / request: 1Counts frost nights where daily minimum temperature is at or below a threshold.
GET
https://api.apikodu.com/api/v1/agriculture/frostrisk
Documentation
Overview
Frost nights below a threshold. Weather data © Copernicus ERA5 / ERA5-Land (contains modified Copernicus Climate Change Service information) / Open-Meteo / OpenWeather / MET Norway.
Authentication
Every request requires the x-api-key header. Credits used and remaining quota are returned in response headers (x-api-credits-used, x-api-remaining-credits, x-rate-limit-*).
Request
GET
https://api.apikodu.com/api/v1/agriculture/frostrisk?latitude=39.92&longitude=32.87&horizonDays=10&threshold=0
GET query or POST JSON (with dailyTemps). If fromDate/toDate are omitted, horizonDays is used (default 10).
Parameters
| Name | Type | Required | Default | Options | Description |
|---|---|---|---|---|---|
fromDate |
string | Optional | — | — | YYYY-MM-DD. Empty uses today plus horizonDays. |
toDate |
string | Optional | — | — | YYYY-MM-DD |
threshold |
number | Optional | 0 |
— | Frost threshold °C. Default 0. -20..5. |
latitude |
number | Optional | — | — | Required without dailyTemps. |
longitude |
number | Optional | — | — | Longitude. |
includeBreakdown |
boolean | Optional | true |
true false |
Night breakdown. |
horizonDays |
integer | Optional | 10 |
— | Forecast horizon in days when fromDate/toDate are omitted. Default 10. Range 1–10. |
Response
| Name | Type | Description |
|---|---|---|
frostNights |
integer | Number of nights with tmin <= threshold. |
threshold |
number | Frost threshold °C used. |
minTemperature |
number | Lowest tmin °C in the window. Null when no data. |
firstFrostDate |
string | First frost night YYYY-MM-DD. Null if none. |
lastFrostDate |
string | Last frost night YYYY-MM-DD. Null if none. |
hoursBelow |
integer | Hours with temperature at or below the threshold. Null when hourly data is missing. |
horizonDays |
integer | Forecast horizon used. Null when dates were supplied. |
fromDate |
string | Window start YYYY-MM-DD. |
toDate |
string | Window end YYYY-MM-DD. |
daysTotal |
integer | Calendar days in the window (fromDate..toDate). |
daysWithData |
integer | Days that have temperature data. |
missingCount |
integer | Days without data. missingDates.Length. |
missingDates |
array | YYYY-MM-DD list of missing days. |
gridLatitude |
number | 0.1° cell latitude. Null when dailyTemps was used. |
gridLongitude |
number | 0.1° cell longitude. Null when dailyTemps was used. |
nights |
array | Frost nights when includeBreakdown=true. Empty array when false. |
nights[].date |
string | Frost night YYYY-MM-DD. |
nights[].tmin |
number | Minimum temperature °C that night. |
method |
string | Calculation method. daily-tmin-threshold for this API. |
source |
string | user: dailyTemps or et0Mm. db: tarim_hava cell. |
disclaimer |
string | Decision-support disclaimer. Not agronomic advice. When source is database: Weather data © Copernicus ERA5 / ERA5-Land (contains modified Copernicus Climate Change Service information) / Open-Meteo / OpenWeather / MET Norway. |
Errors
| HTTP | code | Description |
|---|---|---|
400 |
-249 |
Body missing (POST) or threshold outside -20..5. |
400 |
-254 |
fromDate/toDate missing, not YYYY-MM-DD, or the window exceeds 366 days. |
400 |
-255 |
latitude/longitude are required without dailyTemps. Latitude -90..90, longitude -180..180. |
429 |
-316 |
Daily new location (cell) limit (50) reached. Previously requested locations keep working; new locations next day (UTC). Retry-After header gives seconds until end of day. |
503 |
-256 |
Cell created; Worker is filling the last 730 days. Retry in a few minutes. |
400 |
-251 |
No weather for this location/date (and no dailyTemps). |
401 |
-100 |
x-api-key is missing, empty, malformed, inactive, banned, expired, IP-restricted, or not allowed for this API. |
429 |
-221 |
Per-minute request limit exceeded. Response headers: x-rate-limit-limit, x-rate-limit-remaining, x-rate-limit-reset. |
429 |
— | Package credit quota cannot cover this request. Body may be { error, limit, currentUsage, requestCost } (no code field). |
500 |
-1 |
Unexpected server error. message is a generic error text without technical details. |
Notes
- Success body is { data: { ... } }. Error body is { code, message }. code is an ApiResponseCode enum value (negative integer).
Sample response
{
"data": {
"frostNights": 2,
"threshold": 0.0,
"minTemperature": -3.1,
"firstFrostDate": "2026-04-04",
"lastFrostDate": "2026-04-12",
"fromDate": "2026-04-01",
"toDate": "2026-04-30",
"daysTotal": 30,
"daysWithData": 30,
"missingCount": 0,
"method": "daily-tmin-threshold",
"source": "user",
"disclaimer": "Decision support only. Not agronomic advice."
}
}
Code samples
const response = await fetch('https://api.apikodu.com/api/v1/agriculture/frostrisk', {
method: 'GET',
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
const data = await response.json();
console.log(data);
import requests
headers = {
'x-api-key': 'YOUR_API_KEY'
}
response = requests.get('https://api.apikodu.com/api/v1/agriculture/frostrisk', headers=headers)
print(response.json())
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");
var response = await client.GetStringAsync("https://api.apikodu.com/api/v1/agriculture/frostrisk");
Console.WriteLine(response);
$response = file_get_contents('https://api.apikodu.com/api/v1/agriculture/frostrisk', false, stream_context_create([
'http' => [
'header' => "x-api-key: YOUR_API_KEY"
]
]));
print_r(json_decode($response, true));
curl -X GET 'https://api.apikodu.com/api/v1/agriculture/frostrisk' \
-H 'x-api-key: YOUR_API_KEY'
Start building in minutes
Create a free account, get your API key and send your first request in minutes.