Water level — the window around one instant
The call to start from. Name one gauge and one instant, and what comes back is the window of stage readings around it, each in metres above that station's own datum rather than above sea level. It is the request worth getting working first, because every other water-level call is this one with something added to it.
GET /data/riskma-water-level
Request
Export your active API key as CTIE_API_KEY, then copy the block as it stands and run it.
curl --request GET \
--get \
--header "x-ctie-api-key: $CTIE_API_KEY" \
--data-urlencode "stationId=99_20309_1_2" \
--data-urlencode "baseDate=2026-08-11T06:10:00Z" \
"https://api.daas.riskma.jp/v1/data/riskma-water-level"What this call sends
| Parameter | Value sent | What it means |
|---|---|---|
stationIdstringRequired | 99_20309_1_2 | The station you want data for, named by its osid — e.g. 99_20309_1_2. Required, and one of the station types this Catalog Item serves. |
baseDatestring (date-time)Optional | 2026-08-11T06:10:00Z | The Anchor — the instant the served window is centred on. With no start/end span beside it, one metered call returns [baseDate − pastMinutes, baseDate + futureMinutes], and the served range rides data.window; widening it means shifting the baseDate, which costs another call. Blank or absent defaults to the request time. It is an instant, not a day, despite the name. A bare date names no minute and this window is minute-precision, so send one of the two formats below. Choosing the range one call serves — baseDate, or the start/end span. These are two separate ways to name that range, and each is complete on its own; a request sends one of them, not both. baseDate alone serves the window named above and is charged one unit per point that window carries — floor((pastMinutes + futureMinutes) × 60 / baseTimeIncrement) + 1, which is three at the ±10-minute profile in force and not one. start and end together serve the clamped span [start, start + increments × increment] and are charged the points that span carries, one more than the increments it floors to — see start for the clamp, and X-Units-Charged for the count either path bills. Sending neither is a valid call rather than an omission: the baseDate defaults to the request time, so the window served is [now − pastMinutes, now + futureMinutes] and the call costs that window's point count, exactly as naming the instant does. A blank baseDate beside a span is not "both". ?start=…&end=…&baseDate= is served as the span it names — blank is absent here, exactly as it is on a call with no span, and a client that renders every parameter it holds sends an empty one rather than omitting it. Future baseDate values and coverage. A baseDate ahead of the request time is how forecast data is requested from a Catalog Item that publishes forecast coverage. Coverage is finite and per Catalog Item: read the maxFutureAnchorMinutes of the categoryQuotas[] entry whose catalogId is this Catalog Item, on GET /v1/plans (public, no auth), rather than assuming one — and treat an omitted field as *unknown*, not unlimited, and a published 0 as *known to be none*. Both Catalog Items publish 0 as of 2.0.0: neither serves forecast data, so a baseDate ahead of the request time cannot be satisfied on either. Size a request from that number — the operation's error table states what a baseDate past the horizon is answered with, and what it costs. Accepts ISO-8601 (YYYY-MM-DDTHH:MM:SSZ, canonical) or datetime-local (YYYY-MM-DDTHH:MM); a naive value is read as UTC. |
What came back
Every response uses the canonical WaterLevelEnvelope envelope, on success and on failure alike.
| Field | Type |
|---|---|
success | booleanMachine-readable outcome flag: true on success, false on failure. Readable without parsing the HTTP status line. |
data | WaterLevelObservation | nullThe water-level payload on success, null on error. One branch beside null, so no discriminator is needed or declared. |
error | ResourceApiError | nullThe canonical error on failure, null on success. Its code is drawn from the closed Resource-API error taxonomy — see ResourceApiError for the set, which a client can switch on exhaustively. |
meta | CanonicalMeta |
What data carries
On success, data carries WaterLevelObservation. Its own fields are below, followed by the schemas it references.
Nested schemas are expanded 2 levels deep. A field whose schema sits deeper shows its type name without a link.
WaterLevelObservation
Sold water-level payload for one Serving Window over one Station.
| Field | Type | Requirement | Description |
|---|---|---|---|
station | StationRef | Required | |
window | ServedWindow | Required | |
series | WaterLevelPoint[] | Required | Points ascending by timestamp, one resolution apart. Every point is a gauge reading taken at the station. Dense: the array carries one point per resolution across the whole window, always — floor((window.end − window.start) / resolution) + 1 of them, the fencepost included because the window is inclusive of both bounds. A station that reported nothing still returns that many points, each with null measurements, rather than an empty array — the count is never zero, because window.start is itself an increment. The length is therefore a function of the window and never of station behaviour, so a caller may index by offset. Bounded by window: every timestamp falls inside [window.start, window.end]. |
StationRef
The station a served payload describes. Carries only the echoed identifier: the station name and coordinates are served by GET /v1/observatory/master rather than repeated on every reading, so a caller that needs labels reads that once and joins.
| Field | Type | Requirement | Description |
|---|---|---|---|
id | string | Required | The station osid the request named. |
ServedWindow
The time range this payload was read for. Present on every successful response, including one whose series is empty, so a caller can always tell what was asked for as distinct from what was found.
series is bounded by this window: every point carries a timestamp inside [start, end]. One metered call buys one window, so data outside the range is read by moving the baseDate, and each move is another call.
One window spans ±10 minutes around the requested baseDate — start and end state it per response, but that is the width to size a read against. The span form (start/end) states its own bounds instead.
| Field | Type | Requirement | Description |
|---|---|---|---|
start | string (date-time) | Required | Inclusive lower bound of the window, ISO-8601 UTC. No series point carries a timestamp below it. |
end | string (date-time) | Required | Inclusive upper bound of the window, ISO-8601 UTC. No series point carries a timestamp above it — a later instant belongs to a later baseDate's window, and to the call that asks for it. |
resolution | string | Required | Spacing between consecutive points, as an ISO-8601 duration. Distinct from the billing grid: the per Catalog Item baseTimeIncrement on GET /v1/plans is what one unit buys, while this is how far apart two points sit. The two carry equal values today and are not the same quantity. |
WaterLevelPoint
One water-level reading. Measurement members are required and nullable: a present number is a measurement, 0.0 included — it means the gauge was operating and read zero — and null means no observation exists for that interval. A gauge that reports stage and not discharge carries null for discharge on every point rather than omitting the member, so a client is forced to handle the absence it will certainly meet. See RainfallPoint for the rule.
| Field | Type | Requirement | Description |
|---|---|---|---|
timestamp | string (date-time) | Required | The Time Increment this point describes, ISO-8601 UTC — window.start advanced by a whole number of resolution steps, never the instant the source's own reading carried. A point reports the observation recorded in [timestamp, timestamp + resolution), so a reading published off the window's phase is attributed to the increment that holds it rather than dropped: the grid is phased on window.start, and an baseDate may name any instant. Where the window sits on the publication cadence — the ordinary case — the two instants are the same value. |
waterLevel | number | null | Required | Gauge stage at timestamp, in metres (m), or null where no observation exists for the interval. May be negative — readings are relative to the station's own gauge datum (量水標零点高), not to sea level and not to zero. What varies between station kinds is the datum, not the unit, so two stations' readings are not comparable as absolute heights. |
discharge | number | null | Required | Volumetric flow at timestamp, in cubic metres per second (m³/s). Corroborated, not confirmed: the stations that carry it publish discharge in that unit, but the data owner has not confirmed it. Expect null often — it has been seen only on gauges that measure it, and there at a coarser cadence than waterLevel on the same rows, so most points of most stations carry no value. Both are observations rather than stated guarantees, so handle the null on any point. |
power | number | null | Required | Carried through under its original name. Both its unit and its meaning remain unconfirmed: no source states what this attribute measures, and no station observed so far carries a value for it — so in practice every point published to date carries null here. It is published rather than dropped so that the contract does not silently discard something the source produces; renaming it would assert an understanding nobody has. |
What the envelope’s named types carry
The envelope members typed as a named schema — ResourceApiError, CanonicalMeta — are documented below, each as its own table.
Nested schemas are expanded 2 levels deep. A field whose schema sits deeper shows its type name without a link.
ResourceApiError
| Field | Type | Requirement | Description |
|---|---|---|---|
code | stringOne of: VALIDATION_ERROR, AUTH_REQUIRED, KEY_INVALID, SUBSCRIPTION_REQUIRED, USAGE_CAP_EXCEEDED, CATALOG_NOT_IN_PLAN, NO_ACTIVE_KEY, NOT_FOUND, FORBIDDEN, BASE_DATE_BEYOND_HORIZON, SPAN_BELOW_MINIMUM, SPAN_CAP_EXCEEDED, SPAN_INVALID, RATE_LIMITED, UNAVAILABLE, UPSTREAM_ERROR, INTERNAL_ERROR | Required | SPAN_BELOW_MINIMUM / SPAN_CAP_EXCEEDED / SPAN_INVALID are the ADR-044 span-metering boundary rejections (#756), refused before any read or charge. BASE_DATE_BEYOND_HORIZON (1.0.0, #1515) is the future-baseDate rejection and is the one code on this surface that is charged — the authorizer debits before the Data Plane can evaluate the horizon. RATE_LIMITED (429) and UNAVAILABLE (503) are the metering-contention and outage renders relocated off the authorizer-deny layer to the Data Plane (#1105, ADR-055). KEY_INVALID (403) is the authorizer's invalid-Active-Key denial; FORBIDDEN (403) is the floor of the authorizer-deny layer — the code a Deny that attaches none is answered with, so a denied caller always reads a switchable code (#1048, #1419). |
message | string | Required | Human-readable explanation. Not a stable contract — switch on code, display message. |
requestId | string | Required | |
docsUrl | string (uri) | Optional | Documentation for this code (1.0.0, ADR-065). Lets an SDK point a developer at the fix without shipping its own copy of the error catalogue. Omitted where no page exists — this deployment publishes none, for any code, so a client must not depend on its presence. |
details | ErrorDetail[] | Optional | Field-level detail, omitted (not empty) when there is nothing field-level to report. Typed as an array of entries at 1.0.0 — it was previously a free-form object, which meant a caller could not enumerate what failed. This is what replaces regexing a sentence: before 1.0.0 a rejected request carried only message: "id is required", so the failing parameter was recoverable from prose alone. |
CanonicalMeta
Envelope metadata (ADR-028, reshaped at 1.0.0 by ADR-065). Transport concerns only — meta carries what identifies and dates the *response*, never what describes the *payload*.
The split it implements: the body carries what application code branches on; headers carry what infrastructure acts on without parsing JSON. This extends ADR-028's own reasoning for putting success in the body — anything a client must still have after the response is logged, cached, or replayed belongs here, because headers do not survive those. Billing is the deliberate exception and stays in X-Units-Charged / X-Query-Span-Seconds, which is why those headers must be named in Access-Control-Expose-Headers for a browser caller to read them at all.
Removed at 1.0.0. source named the upstream a payload was normalized from (riskma); ADR-062 internalized the read path and left no proxied Catalog Item, so the field became false as well as a vendor disclosure to a paying customer. window moved into data.window as ServedWindow — it describes the payload, not the transport, and its pre-1.0.0 shape (pastMinutes / futureMinutes / points) described the request's window rather than the served range.
| Field | Type | Requirement | Description |
|---|---|---|---|
requestId | string | Required | Correlates the call end-to-end. Also emitted as the X-Request-Id response header and duplicated onto error.requestId — the duplication is deliberate, so a consumer holding only one of the three stays correlatable. |
servedAt | string (date-time) | Optional | The Served Instant — when this response was generated, ISO-8601 UTC. Distinct from every instant inside data: a replayed call returns the same window and a later servedAt, which is what makes staleness computable client-side. Optional at 1.0.0, and present on everything a handler renders. It is absent on exactly one class of response: the authorizer denials the gateway renders from the 403 examples the metered GET /data/* operations share (and the keyless 401 beside them; one gateway response serves the whole API, which is why both bands are declared once in components/responses — #1548). A static gateway response template may carry one $context variable, the request id, and cannot format an ISO-8601 instant from the epoch milliseconds it has — so a required servedAt there could only ever be a frozen literal, which is a fabricated instant rather than a Served Instant. This is PRD-016's open question; the resolution taken is its own recommendation and #1517's, *optional-and-absent*, so that the schema and the renderer agree. #1517 carries the reshape into the deployed templates and records the resolution in PRD-016. Requiring it later — if those responses move to templated rendering — is a breaking change and so belongs to a later major version, which is the cost this resolution accepts in exchange for a contract the deployment does not violate on every denial. |
apiVersion | string | Required | The contract version that produced this response — the value of info.version at the time it was served. Added at 1.0.0 so a stored payload identifies its own shape — precisely what pre-1.0.0 responses cannot do, which is why they cannot be migrated retroactively. Also emitted as the X-DaaS-Api-Version response header for consumers that dimension metrics without parsing a body. Examples throughout this document carry the current info.version and are checked against it (test_canonical_envelope_spec.py, #1517). The deployed renders derive the value the same way — a handler from API_VERSION, an authorizer denial from info.version at synth time — so an example that stated a different MAJOR.MINOR pair would contradict a component this schema tells clients to branch on. Branch on MAJOR.MINOR; treat PATCH as informational, since it moves for description-only corrections and for bugfixes inside the frozen shape — never adding, removing or renaming a member, so a client compiled against the previous PATCH still compiles. Informational is not a promise that nothing observable moved: a bugfix can change a served value or the number of points a call returns (1.3.7 did both, #1542). |
pagination | Pagination | null | Optional | Present on list/paged responses; null otherwise. |
ErrorDetail
One field-level failure inside CanonicalError.details.
| Field | Type | Requirement | Description |
|---|---|---|---|
field | string | Required | The request member that failed — a query parameter or a body path. |
code | string | Required | Machine-readable reason, scoped to the field. Deliberately not enumerated: reasons are per-field and per-feature, and the switchable contract is the envelope-level code. Treat an unrecognised value as a generic failure. |
message | string | Required | Human-readable explanation for this field. |
Pagination
The cursor-page envelope the six admin directories and the audit read compose. Both keys are always present: nextCursor is the opaque token of the next page while more rows remain and an explicit null on the last one, and limit echoes the applied (clamped) page size. A console reads nextCursor === null as "drained" — it is never absent, so an undefined value is a bug, not an end.
CanonicalMeta.pagination composes it too, so the required pair binds any ADR-028 list envelope that reports a page. No producer sets that field today (the dataplane envelope carries source alone), and it is the one composer the route drift guard cannot reach — the guard reads page response_models off the mounted routes, and CanonicalMeta is not one.
CatalogItemPage deliberately does not compose this envelope: GET /catalog is served with response_model_exclude_none, which drops a null cursor before it reaches the wire, so its terminal page omits the key instead (#1479). One schema cannot describe both without permitting, for either route, a body that route can never send.
| Field | Type | Requirement | Description |
|---|---|---|---|
nextCursor | string | null | Required | Opaque next-page token; null on the last page. Treat the cursor — never the item count — as the signal that more remains: a page may come back shorter than limit while still carrying one. |
limit | integer | Required | The applied (clamped) page size, echoed back. |
The response one call returned
A response captured from a real call, not one written by hand. Every run of this project's tests holds it to the response schema the specification declares for this operation, so a contract change that would invalidate it fails the build.
{
"success": true,
"data": {
"station": {
"id": "99_20309_1_2"
},
"window": {
"start": "2026-08-11T06:00:00Z",
"end": "2026-08-11T06:20:00Z",
"resolution": "PT10M"
},
"series": [
{
"timestamp": "2026-08-11T06:00:00Z",
"waterLevel": null,
"discharge": null,
"power": null
},
{
"timestamp": "2026-08-11T06:10:00Z",
"waterLevel": null,
"discharge": null,
"power": null
},
{
"timestamp": "2026-08-11T06:20:00Z",
"waterLevel": null,
"discharge": null,
"power": null
}
]
},
"error": null,
"meta": {
"requestId": "064eaec6-2936-41f4-ae03-7892da52305d",
"servedAt": "2026-09-04T10:18:20.195649Z",
"apiVersion": "2.4.1",
"pagination": null
}
}
How this call can refuse
A refusal comes back in the same envelope as a success, with the reason in error.code. These are the codes this call can answer with. What each one means, and what to do about it, is on the errors page — this page names them so you can handle them before you meet them.
- HTTP 400
VALIDATION_ERRORSPAN_BELOW_MINIMUMSPAN_CAP_EXCEEDEDSPAN_INVALID - HTTP 401
AUTH_REQUIRED - HTTP 402
USAGE_CAP_EXCEEDED - HTTP 403
FORBIDDENSUBSCRIPTION_REQUIREDCATALOG_NOT_IN_PLANKEY_INVALID - HTTP 404
NO_ACTIVE_KEY - HTTP 422
BASE_DATE_BEYOND_HORIZON - HTTP 429
RATE_LIMITED - HTTP 502
UPSTREAM_ERROR - HTTP 503
UNAVAILABLE