Hong Kong Obervatory API

Beginner's Pick Weather / No Auth Required Beginner HTTPS
Free to Use Varies (check documentation)
85 A
Measured Score 0 50 100 Reachability 30/30 Speed 5/20 Security 15/15 Developer XP 20/20 Reliability 15/15 TESTED 2026-07-23

Overview

The Hong Kong Observatory Open Data API provides free access to weather observations, forecasts, earthquake reports, and climate data for Hong Kong and the surrounding region. No authentication is required — you can call it directly from any application without signing up. It is a great no-cost option for learning API integration while building weather apps for the Hong Kong area.

Beginner Tip

No API key is needed — just call the endpoint URLs directly. Use the dataType query parameter to select the data product you want, such as rhrread for hourly readings or fnd for a 9-day forecast.

Available Data

temperature
weather conditions
humidity
wind speed
forecast data

Example Response

JSON Response
{
  "location": "Tokyo",
  "temperature": {
    "current": 22,
    "feels_like": 24,
    "min": 18,
    "max": 26
  },
  "condition": "Partly Cloudy",
  "humidity": 65,
  "wind": {
    "speed": 12,
    "direction": "NE"
  },
  "forecast": [
    {
      "date": "2025-01-16",
      "high": 25,
      "low": 17,
      "condition": "Sunny"
    }
  ]
}

Field Reference

temperature.data[].value Air temperature in degrees Celsius recorded at a specific station.
humidity.data[].value Relative humidity percentage at a weather station.
rainfall.data[].max Maximum rainfall recorded in millimetres during the observation period.
updateTime ISO 8601 timestamp of when this data was last updated by HKO.
warningMessage List of active weather warning messages issued by the Observatory.

Implementation Example

Request
const url = "https://www.hko.gov.hk/en/abouthko/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

Empty or unexpected JSON response An unsupported dataType value was used.
Check the HKO documentation for the exact dataType string (e.g., rhrread, fnd, warnsum) and ensure spelling is correct.
CORS error in browser The browser blocks cross-origin requests to the HKO API.
Proxy the request through a backend or use a server-side language; only enable CORS overrides locally for testing.
Stale data / unexpected timestamps The API updates on its own schedule (hourly or sub-hourly depending on dataType).
Cache the response and refresh on a schedule aligned with the API update frequency rather than polling continuously.

Measured Score Breakdown

Live HTTP request to the API endpoint

Reachability 30/30
Speed 5/20
Security 15/15
Developer XP 20/20
Reliability 15/15
Endpoint Response Time 1833ms

Fully tested on Jul 23, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Weather
Difficulty Beginner
Verified: 2026-04-04

Related Tags

Similar APIs

View All →