API Documentation

Integrate WeatherUpdateHub weather data into your applications

API Overview

WeatherUpdateHub provides a RESTful API for accessing weather data, forecasts, and air quality information. Our API is built on Open-Meteo's reliable weather data and is completely free to use.

Base URL

https://weatherupdatehub.com/api

Rate Limit

1000 requests per hour

Data Source

Open-Meteo API

API Endpoints

GET/api/weather

Get current weather conditions

Parameters

latitude(number)RequiredLatitude coordinate
longitude(number)RequiredLongitude coordinate

Example

/api/weather?latitude=31.5204&longitude=74.3587
GET/api/forecast/hourly

Get hourly weather forecast

Parameters

latitude(number)RequiredLatitude coordinate
longitude(number)RequiredLongitude coordinate
hours(number)Number of hours (max: 24)

Example

/api/forecast/hourly?latitude=31.5204&longitude=74.3587&hours=12
GET/api/forecast/daily

Get daily weather forecast

Parameters

latitude(number)RequiredLatitude coordinate
longitude(number)RequiredLongitude coordinate
days(number)Number of days (max: 7)

Example

/api/forecast/daily?latitude=31.5204&longitude=74.3587&days=5
GET/api/air-quality

Get air quality data

Parameters

latitude(number)RequiredLatitude coordinate
longitude(number)RequiredLongitude coordinate

Example

/api/air-quality?latitude=31.5204&longitude=74.3587

Code Examples

javascript

// Fetch current weather
const response = await fetch('https://weatherupdatehub.com/api/weather?latitude=31.5204&longitude=74.3587');
const data = await response.json();

console.log(data.current.temperature); // Current temperature
console.log(data.current.weatherCode); // Weather condition code

python

import requests

# Fetch current weather
response = requests.get('https://weatherupdatehub.com/api/weather?latitude=31.5204&longitude=74.3587')
data = response.json()

print(f"Temperature: {data['current']['temperature']}°C")
print(f"Weather Code: {data['current']['weatherCode']}")

curl

# Fetch current weather
curl "https://weatherupdatehub.com/api/weather?latitude=31.5204&longitude=74.3587"

Response Format

{
  "current": {
    "temperature": 25.4,
    "weatherCode": 61,
    "windSpeed": 12.3,
    "humidity": 65
  },
  "hourly": [
    {
      "time": "2024-01-15T12:00:00Z",
      "temperature": 26.1,
      "weatherCode": 61,
      "precipitation": 20
    }
  ],
  "daily": [
    {
      "date": "2024-01-15",
      "maxTemperature": 28.5,
      "minTemperature": 18.2,
      "weatherCode": 61,
      "precipitationProbability": 30
    }
  ]
}

Error Handling

400 Bad Request

Invalid parameters or missing required fields

429 Too Many Requests

Rate limit exceeded. Try again later.

500 Internal Server Error

Server error. Please try again later.

Need Help?

If you have questions about our API or need integration support, we're here to help!