WeatherAPI API

Beginner's Pick Weather / API Key Beginner HTTPS CORS
No per-minute rate limiting

Overview

WeatherAPI is a feature-rich weather platform that delivers real-time weather, 14-day forecasts, historical data, and extras like astronomy data (sunrise/sunset, moon phases) and geolocation lookups. It has a generous free tier and a simple, consistent API design that makes it easy to get started. Beginners will find the single endpoint approach and clear documentation ideal for building their first weather app.

Beginner Tip

Register at weatherapi.com for a free API key. You can query by city name, coordinates, zip code, or even IP address — all using the same q parameter, making it very flexible for different use cases.

Available Data

Location
Temperature
Condition
humidity
wind speed
forecast data

Example Response

JSON Response
{
  "location": "Tokyo",
  "temperature": {
    "current": 22,
    "feels_like": 24,
    "min": 18,
    "max": 26
  },
  "condition": "Partly Cloudy",
  "humidity": 65,
  "wind": {
    "speed": 12,
    "direction": "NE"
  },
  "forecast": [
    {
      "date": "2025-01-16",
      "high": 25,
      "low": 17,
      "condition": "Sunny"
    }
  ]
}

Field Reference

current.temp_c Current temperature in Celsius
current.temp_f Current temperature in Fahrenheit (returned alongside Celsius in every response)
current.condition.text Human-readable current weather condition such as "Partly cloudy"
current.wind_kph Current wind speed in kilometers per hour
current.humidity Current relative humidity as a percentage
location.localtime Local date and time at the queried location in YYYY-MM-DD HH:MM format

Implementation Example

Request
// Get current weather by city name
const url = "http://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&q=London";

const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();

console.log(`Location: ${data.location.name}, ${data.location.country}`);
console.log(`Temperature: ${data.current.temp_c}°C`);
console.log(`Condition: ${data.current.condition.text}`);
console.log(`Humidity: ${data.current.humidity}%`);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

Error 1002: API key not provided The key parameter is missing from the request URL
Always include key=YOUR_API_KEY as a query parameter in every request
Error 1006: No matching location found The q parameter value is not recognized as a valid location
Try using coordinates like q=48.8566,2.3522 instead of city names for more reliable results
Error 2007: API key has exceeded calls per month quota Monthly request limit reached on the free plan
Upgrade to a paid plan or reduce calls by caching weather data for 15-30 minutes

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS YES
Category Weather
Difficulty Beginner
Verified: 2026-04-04

Alternatives to WeatherAPI

Technical alternatives for different use cases.

Industry-leading forecast accuracy with MinuteCast feature

Better For

Consumer-facing apps where forecast precision matters

Trade-off

Budget-conscious projects (expensive paid tiers)

No API key needed, fully open-source weather data

Better For

Quick prototyping without registration

Trade-off

Production apps needing guaranteed uptime

Largest community and most integrations available

Better For

Finding existing libraries and community support

Trade-off

Free tier limits (1K calls/day on free plan)

More generous free tier with astronomy data

Better For

Apilayer ecosystem compatibility

Trade-off

Free tier with more API calls per month

Recipes Using WeatherAPI

Build something with this API. Each recipe includes step-by-step instructions and code outlines.

Similar APIs

View All →