BYTETOOLS

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.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

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 2026-08-21, 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
curl 'https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang=en'
JavaScript (fetch)
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);
Python (requests)
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())
Response — HTTP 200 (truncated)
{
  "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

ParameterTypeRequiredDescription
dataTypequeryRequiredWhich dataset to return: `rhrread` current report, `fnd` nine-day forecast, `flw` local forecast, `warnsum` warning summary. rhrread
langqueryOptional`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

Hong Kong Observatory is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.