Skip to content
DDataNest

Weather · 4 min read

How to use the Weather Forecast API in Python & JavaScript

Weather is one of the most-requested data types in apps. Here's the quickest way to get weather forecast results without managing providers.

By DataNest · Published May 2026

What the Weather Forecast API does

Full-featured forecasting: current conditions, multi-day forecasts, historical weather, and air quality for any location worldwide. Responses are JSON, the API runs behind the RapidAPI gateway for auth and rate limiting, and there's a free tier for prototyping.

When to use it

weather apps
agriculture platforms
logistics planning

The example request

GET https://weather-forecast-by-datanest.p.rapidapi.com/current.json?q=New York

Example JSON response

An illustrative response body — run the live demo for the real thing.

{
  "location": {
    "name": "London",
    "region": "City of London",
    "country": "UK"
  },
  "current": {
    "tempC": 12,
    "condition": "Light rain",
    "windKph": 22,
    "humidity": 88
  },
  "forecast": [
    {
      "date": "2026-05-18",
      "maxC": 15,
      "minC": 8,
      "rainChance": 80
    },
    {
      "date": "2026-05-19",
      "maxC": 17,
      "minC": 9,
      "rainChance": 20
    }
  ],
  "airQuality": {
    "pm2_5": 9.4,
    "usEpaIndex": 2
  }
}

Common parameters

Every request also needs your RapidAPI auth headers.

ParameterInRequiredExample
qqueryYesLondon
x-rapidapi-keyheaderYesYOUR_RAPIDAPI_KEY
x-rapidapi-hostheaderYesweather-forecast-by-datanest.p.rapidapi.com

Step by step

1. Subscribe and get your key

Open the Weather Forecast API on RapidAPI, subscribe to the free BASIC plan, and copy your X-RapidAPI-Key.

2. Call the endpoint

The example call for this API is shown above. The quick-start snippets below send exactly that request in cURL, Python and Node so you get a real response on the first try.

3. Try it without code first

The Weather Forecast page has a live "Try it" panel — change the input, run it, and inspect the real JSON before you integrate.

4. Integrate and cache

Call it from your backend and cache responses where it makes sense. For fast-moving data, a short TTL keeps it fresh without hammering the API.

Quick-start code

curl --request GET \
  --url 'https://weather-forecast-by-datanest.p.rapidapi.com/current.json?q=London' \
  --header 'x-rapidapi-host: weather-forecast-by-datanest.p.rapidapi.com' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'

What you can build

Agriculture planner

Drive irrigation and planting decisions from 14-day forecasts and rainfall probability.

Logistics routing

Re-route deliveries around severe weather using hourly conditions.

Event weather check

Show attendees the forecast for an event date with historical context.

Wrapping up

If your project needs weather apps, the Weather Forecast API removes the part nobody enjoys building. It's one of 23 in the DataNest collection — grab a free key and make your first call.

Weather Forecast updates

New Weather Forecast guides and endpoint updates, occasionally.