Skip to content

Getting Started with the Weather API

Sign up for a free WeatherAPI.com key and make your first weather API call in minutes: base URL, key, request formats and a working example.

Make your first call in three steps

  1. Get a key. Sign up free (no card needed) and copy your API key from your dashboard. The Free plan includes 100,000 calls a month.
  2. Call an endpoint. Paste this into your browser or terminal, with your key in place of YOUR_API_KEY:
    curl "https://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&q=London&aqi=yes"
  3. Read the response. You get JSON with a location and the current weather. Add .xml instead of .json for XML.

The same call in code

JavaScript

const res = await fetch("https://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&q=London");
const data = await res.json();
console.log(data.current.temp_c, data.current.condition.text);

Python

import requests
data = requests.get("https://api.weatherapi.com/v1/current.json",
                    params={"key": "YOUR_API_KEY", "q": "London"}).json()
print(data["current"]["temp_c"], data["current"]["condition"]["text"])

What to try next

Tools that save time

Missing something, or have a suggestion? Contact us.

Get your free weather API key in a minute

100,000 calls a month, free for commercial use. No credit card.