Reference

API reference

Base URL https://api.waterdata.dev. Every endpoint is a GET and returns JSON unless the path ends in another format.

Generated from the dataset contracts when this site was built. Add @{version} after any dataset id to pin a version (how). Errors are problem documents.

Endpoints

GET /v1

The API index for this site.

  • site, name, tagline
  • api_version: "v1"
  • links.catalog, links.status

Example: https://api.waterdata.dev/v1

GET /v1/catalog

Every dataset published on this site.

  • site
  • datasets[]: id, kind, title, description, current (version), published_at, cadence, check_every, sla, discontinued
  • datasets[].source: name, url, license, commercial_ok
  • datasets[].coverage: start, end

Example: https://api.waterdata.dev/v1/catalog

GET /v1/status

How fresh each dataset is.

  • site, generated_at, overall ("ok" or "degraded")
  • datasets[]: id, status, version, checked_at, source_updated_at, sla, consecutive_failures, last_error
  • status is one of ok, pending, late, stale-upstream, failing, blocked, discontinued

Example: https://api.waterdata.dev/v1/status

GET /v1/{dataset}

Metadata for one dataset: the version that answered, its coverage, source, validation and downloads.

  • dataset, kind, title, description, cadence
  • version, current_version, pinned, published_at
  • source: id, name, publisher, url, license, commercial_ok, attribution, retrieved_at, source_updated_at
  • coverage: start, end
  • validation: status (pass, warn), warnings[]
  • series[]: id, name; for tables also key[] and partition
  • downloads[]: name, bytes, url
  • links: locations, versions, this_version

Example: https://api.waterdata.dev/v1/drought-county

Errors: unknown-dataset , unknown-version , data-unavailable , and rate-limited for any endpoint.

GET /v1/{dataset}/versions

The version history.

  • dataset, current, published_at
  • previous[]: earlier version ids, newest first
  • snapshots: month (YYYY-MM) to version id

Example: https://api.waterdata.dev/v1/drought-county/versions

Errors: unknown-dataset , and rate-limited for any endpoint.

GET /v1/{dataset}/locations

What can be requested: each series with its location ids, or for tables the partitions (under the series id "table").

  • dataset, version, kind
  • series[]: id, name, locations[] (ids)
  • locations[]: id, name

Example: https://api.waterdata.dev/v1/drought-county/locations

Errors: unknown-dataset , unknown-version , and rate-limited for any endpoint.

GET /v1/{dataset}/{series}/{location}.json

One series at one place, ordered by date. Also .csv.

  • meta: dataset, series, series_name, location, location_name, units, source, license, attribution
  • data[]: one object per row, with the dataset's columns

Example: https://api.waterdata.dev/v1/drought-county/area/us-county-06037.json

Errors: unknown-file , unknown-format , and rate-limited for any endpoint.

GET /v1/{dataset}/table/{partition}.json

Rows of a table for one partition value; table/all has every row for tables up to 50,000 rows. Also .csv.

  • meta: dataset, key, partition (when partitioned), rows (count), units, source, license, attribution
  • rows[]: one object per row

Example: https://api.waterdata.dev/v1/stream-gages/table/all.json

Errors: unknown-file , unknown-format , and rate-limited for any endpoint.

GET /v1/{dataset}/download/{dataset}.csv

The whole dataset in one file. Also .parquet. Series downloads add series and location columns.

  • CSV (text/csv) or Parquet (application/vnd.apache.parquet)
  • Supports Range requests (206)

Example: https://api.waterdata.dev/v1/drought-county/download/drought-county.csv

Errors: unknown-file , and rate-limited for any endpoint.

GET /v1/{dataset}/{path}

A file of a files dataset, at its published path.

  • The file, with a content type from its extension

Errors: unknown-file , and rate-limited for any endpoint.

Datasets

County drought categories Time series

Id
drought-county
Updates
Weekly
Series
area
Columns
date date (YYYY-MM-DD) , none number, percent , d0 number, percent , d1 number, percent , d2 number, percent , d3 number, percent , d4 number, percent
What Path
Metadata: version, coverage, downloads, validation /v1/drought-county
Versions and monthly snapshots /v1/drought-county/versions
Series and locations /v1/drought-county/locations
Percent of county area by drought category (JSON) /v1/drought-county/area/{location}.json
Percent of county area by drought category (CSV) /v1/drought-county/area/{location}.csv
Whole dataset (CSV) /v1/drought-county/download/drought-county.csv
Whole dataset (Parquet) /v1/drought-county/download/drought-county.parquet

USGS stream gages Table

Id
stream-gages
Updates
Daily
Key
site_id
Partition
region
Columns
site_id text , site_number text , name text , site_type_code text , site_type text , region text , country text , state text , county_fips text , county_name text , huc text , huc8 text , latitude number, degrees , longitude number, degrees , drainage_area number, mi^2 , contributing_drainage_area number, mi^2 , altitude number, ft , altitude_datum text , time_zone text , time_series_id text , sublocation text , daily_begin date (YYYY-MM-DD) , daily_end date (YYYY-MM-DD)
What Path
Metadata: version, coverage, downloads, validation /v1/stream-gages
Versions and monthly snapshots /v1/stream-gages/versions
Partitions /v1/stream-gages/locations
Rows for one region (JSON) /v1/stream-gages/table/{region}.json
Rows for one region (CSV) /v1/stream-gages/table/{region}.csv
All rows in one file (tables up to 50,000 rows) /v1/stream-gages/table/all.json
Whole dataset (CSV) /v1/stream-gages/download/stream-gages.csv
Whole dataset (Parquet) /v1/stream-gages/download/stream-gages.parquet

Daily streamflow Time series

Id
streamflow-daily
Updates
Daily
Series
discharge
Columns
date date (YYYY-MM-DD) , value number, ft^3/s , provisional true / false , estimated true / false , ice true / false , qualifiers text
What Path
Metadata: version, coverage, downloads, validation /v1/streamflow-daily
Versions and monthly snapshots /v1/streamflow-daily/versions
Series and locations /v1/streamflow-daily/locations
Daily mean discharge (JSON) /v1/streamflow-daily/discharge/{location}.json
Daily mean discharge (CSV) /v1/streamflow-daily/discharge/{location}.csv
Whole dataset (CSV) /v1/streamflow-daily/download/streamflow-daily.csv
Whole dataset (Parquet) /v1/streamflow-daily/download/streamflow-daily.parquet