Weather API Reference
Complete endpoint documentation and usage examples for the Singapore Weather API.
Authentication
All requests require an API key to be sent in the request header:
/api/weatherGet weather data for all regions
Description
Returns complete weather forecast data including all 5 regions (North, South, East, West, Central) with general forecast and 3-period daily breakdown.
Parameters
None - no query parameters
Headers
x-api-keyYour API key (required)Response (200 OK)
{
"code": 0,
"data": {
"date": "2026-07-16",
"updatedTimestamp": "2026-07-16T14:41:12+08:00",
"general": {
"forecast": "Thundery Showers",
"temperature": {
"high": 34,
"low": 25
},
"humidity": {
"high": 95,
"low": 65
},
"wind": {
"direction": "SSE",
"speed": {
"high": 20,
"low": 10
}
}
},
"regions": {
"north": { /* regional data */ },
"south": { /* regional data */ },
"east": { /* regional data */ },
"west": { /* regional data */ },
"central": { /* regional data */ }
}
}
}Example Request
curl -H "x-api-key: YOUR_API_KEY" \ https://api.mydigistudio.com/api/weather
/api/weather/[region]Get weather data for a specific region
Description
Returns weather forecast data for a single region with detailed 3-period breakdown.
Parameters
regionrequiredRegion code: n, s, e, w, or c
Response (200 OK)
{
"code": 0,
"data": {
"region": "north",
"forecast": "Thundery Showers",
"code": "TL",
"temperature": {
"high": 34,
"low": 25
},
"humidity": {
"high": 95,
"low": 65
},
"wind": {
"direction": "SSE",
"speed": {
"high": 20,
"low": 10
}
},
"periods": [
{
"timePeriod": {
"start": "2026-07-16T12:00:00+08:00",
"end": "2026-07-16T18:00:00+08:00",
"text": "Midday to 6 pm 16 Jul"
},
"forecast": "Thundery Showers",
"code": "TL"
}
]
}
}Example Requests
# North region curl -H "x-api-key: YOUR_API_KEY" \ https://api.mydigistudio.com/api/weather/n # South region curl -H "x-api-key: YOUR_API_KEY" \ https://api.mydigistudio.com/api/weather/s
Error Responses
{
"error": "Missing API key"
}{
"error": "Failed to fetch weather data"
}Rate Limiting & Caching
Cache Duration
Responses are cached for 30 minutes. Requests within this window receive cached data instantly.
Stale-While-Revalidate
If revalidation fails, cached data is served for up to 60 minutes total.
Update Frequency
Weather data is updated hourly from the National Environment Agency.
Code Examples
JavaScript
const apiKey = 'YOUR_API_KEY';
// Get all regions
const response = await fetch(
'https://api.mydigistudio.com/api/weather',
{
headers: { 'x-api-key': apiKey }
}
);
const data = await response.json();
console.log(data.data.regions.north.forecast);
// Get specific region
const northResponse = await fetch(
'https://api.mydigistudio.com/api/weather/n',
{
headers: { 'x-api-key': apiKey }
}
);
const northData = await northResponse.json();
console.log(northData.data.forecast);Python
import requests
api_key = 'YOUR_API_KEY'
headers = {'x-api-key': api_key}
# Get all regions
response = requests.get(
'https://api.mydigistudio.com/api/weather',
headers=headers
)
data = response.json()
print(data['data']['regions']['north']['forecast'])
# Get specific region
response = requests.get(
'https://api.mydigistudio.com/api/weather/n',
headers=headers
)
data = response.json()
print(data['data']['forecast'])Need Help?
Check out the live weather demo or read the overview for more information.