Weather Forecast

Weather Forecast

Agriculture Weather Credits / request: 2

Daily forecast up to 10 days and hourly forecast up to 96 hours for a point.

GET https://api.apikodu.com/api/v1/weather/forecast
Documentation
Overview

Daily forecast up to 10 days and hourly up to 96 hours for a point. MET Norway is preferred for Baltic/Nordic points, Open-Meteo (ICON-EU) elsewhere.

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/weather/forecast?latitude=39.92&longitude=32.87&granularity=both
GET query.
Parameters
Name Type Required Default Options Description
latitude number * Required — — Point latitude -90..90.
longitude number * Required — — Point longitude -180..180.
granularity string Optional daily daily hourly both daily, hourly or both. Default daily.
days integer Optional 10 — Daily forecast days 1–10. Default 10.
hours integer Optional 96 — Hourly forecast hours 1–96. Default 96.
fields string Optional — temp tmin tmax tmean precip precipprob snow wind windgust winddir humidity pressure cloud uvi dewpoint et0 sunrise sunset daylight weathercode Comma-separated field list. All fields when empty. Valid keys are listed under Options (tmin/tmax/tmean... daily only, temp hourly only).
Response
Name Type Description
granularity string Granularity used.
fromDate string First daily date (daily/both).
toDate string Last daily date (daily/both).
fromTime string First hourly time UTC ISO (hourly/both).
toTime string Last hourly time UTC ISO (hourly/both).
daysReturned integer Number of daily rows returned.
hoursReturned integer Number of hourly rows returned.
gridLatitude number Latitude of the 0.1° grid corner around the request (interpolation reference).
gridLongitude number Longitude of the 0.1° grid corner.
gridInterpolated boolean true: values bilinearly blended from the 4 surrounding cells. false: single cell.
sources array Data sources that contributed: copernicus-era5-land, open-meteo, openweather, met-norway. For past days (older than about a week) Copernicus ERA5 / ERA5-Land takes precedence; UV, precipitation probability and the weather code of wet hours / days are derived from ERA5-Land variables, wind gust comes from ERA5 (0.25°); cloud cover and the weather code of dry hours / days are filled from other sources when available. At coastal / sea points ERA5-Land values come from the nearest land grid point.
disclaimer string Decision-support disclaimer and source attribution.
daily array Daily rows when granularity is daily.
daily[].date string Day YYYY-MM-DD (UTC).
daily[].tmin number Minimum temperature °C.
daily[].tmax number Maximum temperature °C.
daily[].tmean number Mean temperature °C.
daily[].precipMm number Total precipitation mm.
daily[].snowMm number Snow mm (approx. water equivalent).
daily[].windKmh number Max wind km/h.
daily[].windGustKmh number Max wind gust km/h. For past days from ERA5 (0.25° grid, daily max of end-of-hour hourly gusts); may be lower than mean wind (windKmh, 0.1° ERA5-Land). May be null.
daily[].windDirectionDeg number Dominant wind direction degrees.
daily[].humidityPercent number Mean relative humidity %.
daily[].pressureHpa number Mean pressure hPa.
daily[].cloudPercent number Mean cloud cover %. May be null.
daily[].uvi number Max UV index (forecast only).
daily[].dewPointC number Mean dew point °C.
daily[].et0Mm number Reference evapotranspiration ET0 mm (FAO-56).
daily[].sunrise string Sunrise UTC ISO.
daily[].sunset string Sunset UTC ISO.
daily[].daylightMinutes integer Daylight duration minutes.
daily[].weatherCode integer OpenWeather-style condition code (800 clear, 5xx rain ...).
hourly array Hourly rows when granularity is hourly/both.
hourly[].time string Hour UTC ISO.
hourly[].tempC number Temperature °C.
hourly[].humidityPercent number Relative humidity %.
hourly[].windKmh number Wind km/h.
hourly[].windGustKmh number Wind gust km/h (max gust over the preceding hour). May be null.
hourly[].precipMm number Precipitation in that hour mm.
hourly[].precipProbability number Precipitation probability 0–1 (when available).
hourly[].cloudPercent number Cloud cover %. May be null.
hourly[].weatherCode integer OpenWeather-style condition code.
Errors
HTTP code Description
400 -257 latitude/longitude missing or out of range (lat -90..90, lon -180..180).
400 -258 Invalid date parameter.
400 -259 granularity/days/hours/metric/op/comparator is invalid.
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 -261 No stored weather for this location yet. Cells were created; the collector is filling them. Retry shortly.
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": {
    "gridLatitude": 39.90,
    "gridLongitude": 32.90,
    "gridInterpolated": true,
    "granularity": "both",
    "fromDate": "2026-08-30",
    "toDate": "2026-09-08",
    "fromTime": "2026-08-30T02:00:00Z",
    "toTime": "2026-09-03T02:00:00Z",
    "daysReturned": 10,
    "hoursReturned": 96,
    "daily": [
      {
        "date": "2026-08-30",
        "tmin": 16.4,
        "tmax": 31.2,
        "tmean": 23.8,
        "precipMm": 0.0,
        "precipProbability": 0.05,
        "windKmh": 12.8,
        "et0Mm": 5.90,
        "weatherCode": 801
      }
    ],
    "hourly": [
      {
        "time": "2026-08-30T02:00:00Z",
        "tempC": 18.1,
        "humidityPercent": 62.0,
        "windKmh": 9.4,
        "precipMm": 0.0,
        "cloudPercent": 20.0,
        "weatherCode": 800
      }
    ],
    "sources": [
      "met-norway",
      "open-meteo"
    ],
    "disclaimer": "Weather data aggregated from Copernicus ERA5 / ERA5-Land, Open-Meteo, OpenWeather and MET Norway. Contains modified Copernicus Climate Change Service information. Decision support only."
  }
}

Code samples

  
      const response = await fetch('https://api.apikodu.com/api/v1/weather/forecast', {
        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/weather/forecast', 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/weather/forecast");
      Console.WriteLine(response);
  
  
      $response = file_get_contents('https://api.apikodu.com/api/v1/weather/forecast', 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/weather/forecast' \
        -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.

Get started free