Skip to main content

How to use a Hong Kong open data API

Discover a dataset, inspect its source and read supported records through mcp.hk. Keep catalogue metadata, query access and source reliability distinct.

1. Find the dataset

Start with the catalogue and choose the dataset that matches the question. A catalogue entry describes a resource; it does not prove that its rows can be read through mcp.hk. A source may require parameters, a worksheet, a JSON record path or an adapter.

curl "https://mcp.hk/api/v1/catalogue/datasets?q=public%20holidays"

Search the catalogue

HTTP API reference

2. Inspect the resource before querying

List the dataset resources and check format, access status, provider and source URL. Use the schema endpoint to inspect supported fields, then query only the records needed. Do not treat a blocked, unsupported, held or failed source as an empty dataset.

GET /api/v1/resources?datasetId=DATASET_ID
POST /api/v1/resources/RESOURCE_ID/schema
POST /api/v1/resources/RESOURCE_ID/query

Resource API contracts

3. Preserve the evidence

Retain original source URLs, attribution, reference periods, warnings, retrieval/check timestamps and snapshot identifiers where supplied. A source read can succeed while its observations are old. Validate field meaning and units before using the records in an answer or analysis.

Source and freshness guide

Current source status