Hong Kong Observatory API
Free Hong Kong weather API with no key: current readings by district, rainfall, warnings and forecasts from the territory's official meteorological service. Tested example included.
Endpoint tested and returned HTTP 200 on 21 Aug 2026
What is the Hong Kong Observatory API?
The Hong Kong Observatory publishes its open data as JSON with no API key. The current weather report returns district-by-district rainfall alongside temperature readings, humidity, UV index and any active warning messages, in English or Chinese.
Hong Kong's density makes district-level weather genuinely useful rather than a curiosity — rain over Sha Tin says nothing about conditions in Yau Tsim Mong. The Observatory's open data reflects that, returning per-district readings from its automatic weather station network rather than a single figure for the whole territory.
Everything is driven by one `dataType` parameter on a single PHP endpoint, which is idiosyncratic but easy to work with: `rhrread` for the current report, `fnd` for the nine-day forecast, `flw` for the local forecast text and `warnsum` for a summary of active warnings. The `lang` parameter switches between English, Traditional Chinese and Simplified Chinese. One thing to note about the rainfall block: `main` is the string `"TRUE"` or `"FALSE"` rather than a boolean, marking whether the district is one of the headline reporting areas.
Quick facts
- Base URL
https://data.weather.gov.hk/weatherAPI/opendata- Authentication
- No API key and no registration for the open data endpoints.
- Rate limit
- No published limit. Current readings refresh roughly every ten minutes.
- Pricing
- Free. Hong Kong government open data.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the Hong Kong Observatory API
Every request below was executed against the live API on 21 Aug 2026, and the response shown is the real body it returned — not an illustration.
1. Fetch the current weather report
GET https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang=en
curl 'https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang=en'const res = await fetch("https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang=en");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang=en", timeout=20)
res.raise_for_status()
print(res.json()){
"rainfall": {
"data": [
{
"unit": "mm",
"place": "Central & Western District",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Eastern District",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Kwai Tsing",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Islands District",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "North District",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Sai Kung",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Sha Tin",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Southern District",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Tai Po",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Tsuen Wan",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Tuen Mun",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Wan Chai",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Yuen Long",
"max": 0,
"main": "FALSE"
},
{
"unit": "mm",
"place": "Yau Tsim Mong",
"max": 0,Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dataType | query | Required | Which dataset to return: `rhrread` current report, `fnd` nine-day forecast, `flw` local forecast, `warnsum` warning summary. rhrread |
lang | query | Optional | `en` for English, `tc` for Traditional Chinese, `sc` for Simplified Chinese. en |
Response fields
rainfall.dataarray- One entry per district. Each carries `place`, `max` millimetres, `unit`, and `main` as the string `"TRUE"` or `"FALSE"` marking headline reporting districts.
rainfall.startTime / endTimestring- The accumulation window the rainfall figures cover, as ISO 8601 with a Hong Kong offset.
temperatureobject- Beyond the point the captured excerpt truncates: per-station temperature readings in the same `place`/`value`/`unit` shape, with a `recordTime`.
humidityobject- Relative humidity readings in the same shape as temperature.
uvindexobject or string- UV index with an intensity description during daylight; an empty string outside observation hours, which is a type change to guard against.
warningMessagearray or string- Active warning text. An empty string when nothing is in force, rather than an empty array.
icon / iconUpdateTimearray / string- Numeric weather icon codes and when they were set. The Observatory publishes the code-to-image mapping separately.
updateTimestring- When the report was generated.
What you can build with the Hong Kong Observatory API
- Build a district-level Hong Kong weather widget
- Alert on typhoon or rainstorm warnings from the official source
- Compare rainfall across districts during a storm
- Serve a bilingual weather panel using the lang parameter
Common errors and how to fix them
Boolean test on `main` always passes
It is the string `"TRUE"` or `"FALSE"`.
Fix: Compare against the string. A non-empty `"FALSE"` is truthy in most languages.
uvindex is an empty string
Outside daylight observation hours the field changes type.
Fix: Check the type before reading into it. This is the most common runtime error against this API.
Empty response for a dataType
The value was misspelled or is not supported for that language.
Fix: Use the exact codes — `rhrread`, `fnd`, `flw`, `warnsum` — and check them against the Observatory's documentation page.
Times look shifted
Timestamps carry a Hong Kong offset, not UTC.
Fix: Parse the offset properly rather than stripping it, especially if you are combining with other sources.
Hong Kong Observatory API — frequently asked questions
Is the Hong Kong Observatory API free?
Yes, free with no key and no registration. It is published as Hong Kong government open data by the territory's official meteorological service.
How do I get a forecast rather than current conditions?
Change `dataType` to `fnd` for the nine-day forecast or `flw` for the local forecast text. One endpoint serves all of the datasets.
Is the data available in Chinese?
Yes. The `lang` parameter accepts `en`, `tc` for Traditional Chinese and `sc` for Simplified Chinese, and it changes the place names and warning text as well as the labels.
How often does it update?
Current readings refresh roughly every ten minutes, and `updateTime` in the response tells you exactly when the report was generated.
Tools that pair with this API
Unit Converter
Convert between units of length, weight, temperature, area, volume, speed, time and data storage instantly, with a swap button and common conversion tables.
Time Zone Converter
Convert any date and time between world time zones. See UTC offsets, daylight saving handled automatically, and compare multiple zones at once.
Alternatives to Hong Kong Observatory API
If Hong Kong Observatory does not fit, these weather apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.
| API | What it does | Auth | CORS | Last verified |
|---|---|---|---|---|
| Open-Meteo | Free weather forecast API with no API key and no signup. Hourly and daily forecasts worldwide, free for commercial use. Working curl example and live response. | No key | Yes | 19 Aug 2026 |
| Open-Meteo Air Quality | Free air quality API with no key: PM2.5, PM10, ozone, nitrogen dioxide, European and US AQI plus pollen forecasts worldwide. Tested curl example included. | No key | Yes | 19 Aug 2026 |
| wttr.in | wttr.in is a free console-oriented weather API with no key. Get weather as plain text, ASCII art, PNG or full JSON with one curl command. Live example included. | No key | Yes | 19 Aug 2026 |
| Open-Meteo Geocoding | Free geocoding API with no key: convert a city or place name into latitude and longitude, with population, country and timezone. Tested curl example and live JSON. | No key | Yes | 19 Aug 2026 |
| IPMA (Portugal) | Free Portuguese weather API with no key: five-day city forecasts from the national meteorological institute, plus seismic and warning datasets. Tested example included. | No key | Yes | 21 Aug 2026 |
| Open-Meteo Marine | Free marine weather API with no key: wave height, wave period and direction, swell and sea surface temperature forecasts worldwide. Tested curl example. | No key | No | 20 Aug 2026 |
Hong Kong Observatory is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 21 Aug 2026; always check the official documentation before relying on this API in production, as terms and limits can change.