Weather Forecast API

Introduction

NextBillion.ai's Weather Forecast API provides point-based weather forecast data for any location worldwide. The service offers two methods:

  • Hourly Weather Forecast: returns hour-by-hour forecast information for up to the next 24 hours, including temperature, precipitation, wind, humidity, pressure, and UV index.
  • Daily Weather Forecast: returns day-by-day forecast information for up to the next 14 days, including minimum and maximum temperature, precipitation, wind, UV index, and sun and moon timing.

Both methods share a common authentication scheme and accept a single (lat, lon) point as input. They are designed to support a wide range of use cases such as trip planning, fleet routing, field operations, and weather-aware delivery scheduling.

Hourly Weather Forecast

The Hourly Weather Forecast method returns hour-by-hour forecast information for the location specified by lat and lon. Forecast entries begin at the current hour and extend up to 24 hours into the future. Each entry includes both a UTC timestamp (dateTime) and the equivalent local time (dateTimeLocal).

GET

https://api.nextbillion.io/map/weather/hourly?key={your_api_key}&at={lat,lng}


Request Parameters

Loading..

Response Schema

Loading..

Example

The following query retrieves a 3-hour weather forecast for Amsterdam.

Sample API Request

1
curl --location 'https://api.nextbillion.io/map/weather/hourly?key=<your_api_key>&at=52.37,4.9&forecastHours=3'

Sample API Response

1
{
2
"data": { "hourlyWeatherInfo": [...] }
3
}

Daily Weather Forecast

The Daily Weather Forecast method returns day-by-day forecast information for the location specified by lat and lon. Forecast entries begin on the current day (in the station's local time) and extend up to 14 days into the future.

GET

https://api.nextbillion.io/map/weather/daily?key={your_api_key}&at={lat,lng}


Request Parameters

Loading..

Response Schema

Loading..

Example

The following query retrieves a 3-day weather forecast for Amsterdam.

Sample API Request

1
curl --location 'https://api.nextbillion.io/map/weather/daily?key=<your_api_key>&at=52.37,4.9&forecastDays=3'

Sample API Response

1
{
2
"data": { "dailyWeatherInfo": [...] }
3
}

Weather Codes

The weatherCode field is a 9-character string that encodes the weather condition in a structured form: {T}_{XX}_{PPP}{L}. The components are described below.

ComponentPositionMeaningAllowed Values
{T}1Time of dayD (day), N (night)
{XX}3–4Sky / cloud conditionCS (clear sky), MI (mist), FO (fog), SA (sand or dust storm), HZ (hazy), SC (some clouds), PC (partly cloudy), CL (cloudy), OC (overcast), ST (storm), CY (cyclone)
{PPP}6–8Precipitation type (optional; ___ if none)DRI (drizzle), RAI (rain), RAS (rain showers), RAT (thunderstorm with rain), SNO (snow), SNS (snow showers), SNT (snow with thunderstorm), SLE (sleet), SLS (sleet showers), SLT (sleet with thunderstorm), ICR (ice rain), HAI (hail), HAS (hail showers), HAT (hail with thunderstorm)
{L}9Precipitation level (optional; _ if none)1 (light), 2 (moderate), 3 (heavy)

The weatherDescription field provides a pre-decoded, human-readable English description of the same condition. The table below shows a few examples.

weatherCodeweatherDescription
D_CS_____Clear sky (day)
N_PC_____Partly cloudy (night)
D_CL_RAI2Cloudy with moderate rain (day)
D_OC_SNO3Overcast with heavy snow (day)

API Query Limits

  • The maximum value for forecastHours is 24.
  • The maximum value for forecastDays is 14.
  • NextBillion.ai allows a maximum rate limit of 6000 queries per minute or 100 queries per second for continuous requests.
    Note: We can increase the quota if needed on request. Contact support@nextbillion.ai for more details.

API Error Codes

Response codeDescriptionAdditional notes
200Normal success case.Normal success case.
400Input validation failed.There is a missing or an invalid parameter or a parameter with an invalid value type is added to the request.
401APIKEY not supplied or invalidThis error occurs when the wrong API key is passed in the request or the key is missing altogether.
403APIKEY is valid but does not have access to requested resourcesYou might be querying for a geographical region which is not valid for your account or requesting a service which is not enabled for you.
404Requested host/path not foundThis error occurs when a malformed hostname is used.
422Could not process the requestA feasible solution could not be generated for the given set of locations or parameter configuration.
429Too many requestsQPM reached or API request count quota reached.
500Internal Service error.There was an internal issue with NextBillion.ai services. You can reach out to support@nextbillion.ai for an explanation.