Back to APIs
WeatherAPI
Real-time and forecast weather data with astronomy, sports, and air quality. 14-day forecasts with hourly breakdowns.
Base URL
https://api.weatherapi.com/v1realtimeforecastastronomyair qualityalerts
Endpoints
GET
/current.jsonGet real-time weather for any location.
const response = await fetch("https://api.weatherapi.com/v1/current.json?q=New+York&key=YOUR_API_KEY", {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
});
const data = await response.json();
console.log(data);Response Preview
{
"location": { "name": "New York", "country": "USA" },
"current": {
"temp_c": 22.1,
"feelslike_c": 21.4,
"humidity": 60,
"condition": { "text": "Partly cloudy" }
}
}