TL;DR
The SG Weather API from data.gov.sg provides real-time environmental readings across Singapore, sourced from the Meteorological Service Singapore sensor network. Endpoints cover air temperature, rainfall, relative humidity, wind direction/speed, and PSI readings. Data is refreshed every 5 minutes from over 60 weather stations island-wide. No API key is required. Perfect for building local weather apps, smart home systems, or environmental dashboards specific to Singapore.
Quick start: https://api.data.gov.sg/v1/environment/air-temperature
No API key needed — just make a request!
How to Use This API
1. Air Temperature Readings
https://api.data.gov.sg/v1/environment/air-temperature
2. Rainfall Across Singapore
https://api.data.gov.sg/v1/environment/rainfall
3. 24-Hour PSI and PM2.5
https://api.data.gov.sg/v1/environment/psi
4. Wind Speed and Direction
https://api.data.gov.sg/v1/environment/wind-speed
5. JavaScript — Live Temperature Map
fetch('https://api.data.gov.sg/v1/environment/air-temperature')
.then(r => r.json())
.then(data => {
data.items[0].readings.forEach(r => {
console.log(`${r.station_id}: ${r.value}°C`);
});
});
6. Python — Check if It's Raining
import requests
data = requests.get(
'https://api.data.gov.sg/v1/environment/rainfall'
).json()
total = sum(r['value'] for r in data['items'][0]['readings'])
stations_with_rain = [r for r in data['items'][0]['readings'] if r['value'] > 0]
print(f"Stations reporting rain: {len(stations_with_rain)}")
print(f"Total rainfall across all stations: {total}mm")
https://api.data.gov.sg/v1/environment/air-temperature
Frequently Asked Questions
- What environmental endpoints are available?
- Endpoints include:
air-temperature,rainfall,humidity,wind-direction,wind-speed,pm25,psi, anduv-index. All under/v1/environment/. - How many weather stations are there?
- The API covers over 60 weather stations distributed across Singapore, from Changi to Tuas, providing localized readings for different parts of the island.
- How often is the data refreshed?
- Sensor readings are updated approximately every 5 minutes. The API returns the most recent 30-minute window of data from each station.
- Can I get historical data?
- The API supports a
dateparameter for historical queries:?date=2026-01-15returns data for a specific date. Data is stored for a limited time. - What format is the response?
- All responses use JSON. The structure includes
api_info(status),items(array of time-stamped readings), andmetadata(station names and locations). - Do I need an API key?
- No. The data.gov.sg API is open to all without registration. Just make a GET request to the desired endpoint.
API Details
- API URL
https://api.data.gov.sg/v1/environment- Documentation
- data.gov.sg
- Category
- Weather
- Authentication
- Not Required
- Geographic Coverage
- Singapore (SG) — island-wide sensor network
What You Can Build
- Singapore-specific weather dashboard with island-wide station map
- Rain alert system that notifies when your area has precipitation
- Jogging route planner that checks temperature and PSI by district
- Smart home automation that closes windows when rain is detected
- Haze monitoring app tracking PM2.5 and PSI across Singapore