Gov APInsbd.swj.beijing.gov.cn ↗
Access 24-hour precipitation readings from Beijing hydrological monitoring stations, grouped by district with summary statistics, via the Beijing Water Authority.
What is the Gov API?
The Beijing Water Authority Rainfall API exposes 1 endpoint — get_rainfall — that returns precipitation measurements from all monitoring stations across Beijing's districts, covering a 24-hour window ending at 8:00 AM on the queried date. Each response includes per-station readings with station codes and names, district groupings, rainfall amounts in millimeters, and summary statistics such as city-wide averages, maximums, and year-to-date cumulative totals.
curl -X GET 'https://api.parse.bot/scraper/50f211e6-1d38-4e24-9fd3-0082ee9dea8d/get_rainfall?date=2026-09-27' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace nsbd-swj-beijing-gov-cn-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: Beijing Rainfall Monitoring — fetch and inspect station data."""
from parse_apis.nsbd_swj_beijing_gov_cn_api import BeijingRainfall, InputFormatInvalid
client = BeijingRainfall()
# Fetch yesterday's rainfall report (default when date is omitted).
try:
report = client.reports.get()
except InputFormatInvalid as e:
print("Invalid date format:", e.message)
raise
# Display the measurement period covered by this report.
print("Period:", report.query_period)
# Show per-station readings.
for station in report.stations[:5]:
print(f" {station.station_name} ({station.district}): {station.rainfall_mm} mm")
# Show summary statistics (average, max, etc.).
for stat in report.statistics:
print(f" [stat] {stat.station_name}: {stat.rainfall_mm} mm")
# Fetch a specific historical date.
historical = client.reports.get(date="2026-08-01")
print("Historical period:", historical.query_period)
print(f" Stations reported: {len(historical.stations)}")
print("exercised: reports.get (default + explicit date)")
Returns rainfall measurements from all monitoring stations in Beijing for a 24-hour period ending at 8:00 AM on the queried date. Includes per-station readings grouped by district and summary statistics (average, maximum, year-to-date cumulative, etc.). When date is omitted, defaults to yesterday.
| Param | Type | Description |
|---|---|---|
| date | string | Query date in ISO format YYYY-MM-DD. The response covers the 24-hour period ending at 8:00 AM on this date. Defaults to yesterday when omitted. |
{
"type": "object",
"fields": {
"stations": "Array of station rainfall readings, each with station_code, station_name, district, and rainfall_mm",
"statistics": "Array of summary statistics (average, max, year-to-date, etc.) with the same shape as station entries",
"query_period": "Human-readable label describing the measurement period (e.g. '2026年08月12日8时 至 2026年08月13日8时')"
},
"sample": {
"data": {
"stations": [
{
"district": "城近郊区",
"rainfall_mm": 20.5,
"station_code": "30523930",
"station_name": "天安门"
},
{
"district": "城近郊区",
"rainfall_mm": 11.3,
"station_code": "30523800",
"station_name": "松林闸"
},
{
"district": "延庆",
"rainfall_mm": 79.5,
"station_code": "30745500",
"station_name": "永宁"
}
],
"statistics": [
{
"district": "统计",
"rainfall_mm": 15.6,
"station_code": "1111",
"station_name": "平均降水量"
},
{
"district": "统计",
"rainfall_mm": 94.8,
"station_code": "2222",
"station_name": "最大降水量"
}
],
"query_period": "2026 年 08 月 12 日 8 时 至 2026 年 08 月 13 日 8 时"
},
"status": "success"
}
}About the Gov API
What the API Returns
The get_rainfall endpoint returns structured precipitation data published by the Beijing Water Authority (北京市水务局). Each response contains a stations array, where every entry includes station_code, station_name, district, and rainfall_mm. A parallel statistics array carries computed summary metrics — average rainfall, maximum single-station reading, year-to-date cumulative totals, and others — in the same shape as station entries. The query_period field provides a human-readable Chinese-language label confirming the exact 24-hour measurement window.
Query Parameters
The single optional input is date, a string in YYYY-MM-DD format. When supplied, the response covers the 24-hour period ending at 8:00 AM on that date. When omitted, the API defaults to the most recent available reporting period, making it straightforward to poll for the latest published figures without tracking dates manually.
Source and Coverage
Data originates from official hydrological monitoring stations distributed across Beijing's administrative districts. Because readings are grouped by district, consumers can filter or aggregate at the district level without post-processing the full station list. Coverage is limited to stations operated and reported by the Beijing Water Authority; private or third-party weather sensor networks are not included.
Limitations
The reporting cadence is once per day, anchored to the 8:00 AM boundary. Intra-day or sub-hourly precipitation data is not available through this endpoint. Historical depth depends on what the source publishes; very old dates may return empty or no data.
The Gov API is a managed, monitored endpoint for nsbd.swj.beijing.gov.cn — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when nsbd.swj.beijing.gov.cn changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official nsbd.swj.beijing.gov.cn API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Track daily district-level rainfall totals in Beijing for flood early-warning dashboards
- Aggregate year-to-date cumulative precipitation from the
statisticsarray for seasonal drought monitoring - Identify the highest-rainfall stations via the
maxstatistic for infrastructure risk assessments - Feed
rainfall_mmreadings into irrigation scheduling systems for Beijing-area agricultural operations - Build historical precipitation archives by querying
get_rainfallwith sequentialdatevalues - Compare per-district rainfall from the
districtfield to correlate with runoff or soil moisture datasets
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 200 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
| Team | $300/mo | 20,000 | 300 req/min |
| Company | $1,000/mo | 100,000 | 500 req/min |
Each endpoint has a fixed posted price per successful call — most fall between 1 and 10 credits — shown on this API's page before you run it. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does nsbd.swj.beijing.gov.cn offer an official developer API?+
What does the `statistics` array in `get_rainfall` contain, and how is it different from the `stations` array?+
stations array contains one entry per monitoring station with that station's individual rainfall_mm reading. The statistics array uses the same field shape but holds computed aggregates — such as the city-wide average, maximum, and year-to-date cumulative rainfall — rather than individual station readings. Both arrays are returned in a single call.Can I retrieve sub-hourly or real-time intra-day rainfall data?+
Does the API return river water-level or reservoir storage data from Beijing's hydrological network?+
How far back does historical rainfall data go?+
date parameter may return empty results. Testing a range of recent dates is the most reliable way to determine the practical historical depth for your use case.