USGS Water Services API

Free to Use
75 B
Measured Score 0 50 100 Speed 17/30 Consistency 17/20 Security 18/20 Browser access 15/15 Transparency 8/15 TESTED 2026-08-10

Overview

USGS Water Services provides real-time and historical data on streamflow, water levels, and water quality for thousands of monitoring stations across the United States. The API is free and requires no authentication, offering data in multiple formats including JSON, CSV, and XML. It is a valuable resource for hydrology projects, flood monitoring apps, or environmental data analysis.

Beginner Tip

Use the Instantaneous Values service with a USGS site number to get current streamflow data — find site numbers at waterdata.usgs.gov/nwis. Specify format=json to get a structured response that is easiest to parse programmatically.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://waterservices.usgs.gov/nwis/iv/?format=json&sites=01646500&parameterCd=00060&period=P1D
Result
HTTP 200 · application/json · 24,163 bytes · compressed
Response time
223 ms (median of 3) · fastest 210 ms
Transport
TLSv1.2 · ECDHE-RSA-CHACHA20-POLY1305 · certificate issued by DigiCert Inc
Browser CORS
Allowed — Access-Control-Allow-Origin: *
Served by
Apache
Recorded
2026-08-10

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
name string ns1:timeSeriesResponseType
declaredType string org.cuahsi.waterml.TimeSeriesResponseType
scope string javax.xml.bind.JAXBElement$GlobalScope
value object {2 fields}
nil boolean false
globalScope boolean true
typeSubstituted boolean false

Captured Response

Captured from a real request to https://waterservices.usgs.gov/nwis/iv/?format=json&sites=01646500&parameterCd=00060&period=P1D on 2026-08-10. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "name": "ns1:timeSeriesResponseType",
  "declaredType": "org.cuahsi.waterml.TimeSeriesResponseType",
  "scope": "javax.xml.bind.JAXBElement$GlobalScope",
  "value": {
    "queryInfo": {
      "queryURL": "http://waterservices.usgs.gov/nwis/iv/format=json&sites=01646500&parameterCd=00060&period=P1D",
      "criteria": {
        "…": "(3 more fields)"
      },
      "note": [
        {
          "…": "(2 more fields)"
        }
      ]
    },
    "timeSeries": [
      {
        "…": "(4 more fields)"
      }
    ]
  },
  "nil": false,
  "globalScope": true,
  "typeSubstituted": false
}

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://waterservices.usgs.gov/nwis/iv/?format=json&sites=01646500&parameterCd=00060&period=P1D";
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.

How This API Fails

We deliberately sent this API a broken request and recorded exactly what came back on 2026-08-10. Knowing the shape of an error before you hit it makes error handling much easier to write.

HTTP 400 Sending an invalid value for "format" text/html

Returned an HTML error page rather than JSON — worth knowing if your client assumes every response can be parsed as JSON.

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

Empty time series in response The parameterCd does not match data collected at the requested site.
Look up which parameters a site collects at waterdata.usgs.gov; for streamflow use 00060, for gage height use 00065.
XML response instead of JSON The format parameter was not set to json, returning an XML response instead.
Always include format=json in your query string; the default response format is WATERML2.0 XML.
Site not found error The site number is incorrect, incomplete, or the station has been decommissioned.
Verify site numbers at waterdata.usgs.gov/nwis/rt and ensure you pad site numbers to 8 digits.

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 17/30
Consistency 17/20
Security 18/20
Browser access 15/15
Transparency 8/15
Endpoint Response Time 223ms

Fully tested on Aug 10, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS NO
Category Science & Math
Difficulty Beginner
Endpoint last called: 2026-08-10

Related Tags

Similar APIs

View All →