Growing Degree Days (GDD)
Agriculture Math & Calculations Credits / request: 1Calculates cumulative growing degree days from base and upper temperatures. Decision support, not agronomic advice.
POST
https://api.apikodu.com/api/v1/agriculture/gdd
Documentation
Overview
Growing degree days. Weather from DB or dailyTemps. First lat/lon call creates a cell; if empty, code -256.
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
POST
https://api.apikodu.com/api/v1/agriculture/gdd
JSON body. dailyTemps or latitude+longitude.
Parameters
| Name | Type | Required | Default | Options | Description |
|---|---|---|---|---|---|
crop |
string | Optional | — | wheat barley maize sunflower cotton potato tomato rapeseed oats rye sugarbeet grape apple chickpea lentil |
Crop code. baseTemp required if empty. |
fromDate |
string | * Required | — | — | YYYY-MM-DD |
toDate |
string | * Required | — | — | Max 366 days. |
baseTemp |
number | Optional | — | — | GDD base °C. |
upperTemp |
number | Optional | — | — | Upper cap °C. |
latitude |
number | Optional | — | — | 0.1° cell. Required without dailyTemps. |
longitude |
number | Optional | — | — | Longitude. |
includeDaily |
boolean | Optional | true |
true false |
Daily breakdown. |
dailyTemps |
json | Optional | — | — | [{date,tmin,tmax}]. Overrides lat/lon. |
Response
| Name | Type | Description |
|---|---|---|
gddCumulative |
number | Accumulated GDD over the window. max(0, (tmin+tmax)/2 − baseTemp), capped by upperTemp. |
gddAveragePerDay |
number | gddCumulative / daysWithData. 0 when no data. |
baseTemp |
number | Base temperature °C used (request or crop table). |
upperTemp |
number | Upper cap °C. Null if unused. |
crop |
string | Normalized crop code (wheat, maize ...). Null if omitted. |
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. |
stages |
array | Crop phenology thresholds. Empty array without crop. |
stages[].code |
string | Threshold code. Example: emergence, flowering. |
stages[].threshold |
number | Cumulative GDD required for this stage. |
stages[].reached |
boolean | true when gddCumulative >= threshold. |
daily |
array | Daily rows when includeDaily=true. Empty array when false. |
daily[].date |
string | Day YYYY-MM-DD. |
daily[].tmin |
number | Daily minimum °C. |
daily[].tmax |
number | Daily maximum °C. |
daily[].gdd |
number | GDD for that day. |
daily[].gddCumulative |
number | Running cumulative GDD through that day. |
method |
string | Calculation method. gdd-average-capped for this API. |
source |
string | user: dailyTemps or et0Mm. db: tarim_hava cell. |
disclaimer |
string | Decision-support disclaimer. Not agronomic advice or a prescription. |
Errors
| HTTP | code | Description |
|---|---|---|
400 |
-249 |
Body missing; both crop and baseTemp missing; dailyTemps > 366, or tmin/tmax missing/invalid. |
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": {
"gddCumulative": 18.5,
"gddAveragePerDay": 9.25,
"baseTemp": 4.0,
"upperTemp": 30.0,
"crop": "wheat",
"fromDate": "2026-03-01",
"toDate": "2026-03-02",
"daysTotal": 2,
"daysWithData": 2,
"missingCount": 0,
"missingDates": [],
"stages": [
{
"code": "emergence",
"threshold": 120.0,
"reached": false
}
],
"method": "gdd-average-capped",
"source": "user",
"disclaimer": "Decision support only. Not agronomic advice."
}
}
Code samples
const response = await fetch('https://api.apikodu.com/api/v1/agriculture/gdd', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
name: 'example',
value: 123
})
});
const data = await response.json();
console.log(data);
import requests
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
}
payload = {
'name': 'example',
'value': 123
}
response = requests.post('https://api.apikodu.com/api/v1/agriculture/gdd', headers=headers, json=payload)
data = response.json()
print(data)
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");
var payload = new { name = "example", value = 123 };
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.apikodu.com/api/v1/agriculture/gdd", content);
response.EnsureSuccessStatusCode();
var data = await response.Content.ReadAsStringAsync();
Console.WriteLine(data);
$data = [
'name' => 'example',
'value' => 123
];
$response = file_get_contents('https://api.apikodu.com/api/v1/agriculture/gdd', false, stream_context_create([
'http' => [
'header' => "x-api-key: YOUR_API_KEY"
],
'method' => 'POST',"
'content' => json_encode($data)
]));
print_r(json_decode($response, true));
curl -X POST 'https://api.apikodu.com/api/v1/agriculture/gdd' \
-H 'Content-Type: application/json' \
-H 'x-api-key: YOUR_API_KEY' \
-d '{
"name": "example",
"value": 123
}'
Start building in minutes
Create a free account, get your API key and send your first request in minutes.