Make your first call in three steps
- 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.
- 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"
- 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.