Skip to main content

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

    Join us to learn about upcoming changes to water data APIs in a public webinar designed for all interested users of USGS Water Data APIs, including USGS cooperators, partners, and the general public on Thursday May 29th at 12pm ET / 11am CT / 10am MT / 9am PT. Link to the event.

Migrating to modernized APIs

Page contents:

This guide provides resources from migrating from specific legacy APIs, hosted on waterservices.usgs.gov, to their modernized replacements on api.waterdata.usgs.gov. It will be continuously updated as additional modernized endpoints are released.

Specifically, this guide will help you move from APIs listed in the left column to their replacement listed on the right:

If you were using... Then you should use...
Latest automated measurements from https​://waterservices.usgs.gov/nwis/iv/? Not yet released
Historical automated measurements from https​://waterservices.usgs.gov/nwis/iv/? Not yet released
https​://waterservices.usgs.gov/nwis/dv/? https://api.waterdata.usgs.gov/ogcapi/v0/collections/daily
https​://waterservices.usgs.gov/nwis/gwlevels/ Not yet released
Monitoring location metadata from https​://waterservices.usgs.gov/nwis/site/? https://api.waterdata.usgs.gov/ogcapi/v0/collections/monitoring-locations
Period of record information from https​://waterservices.usgs.gov/nwis/site/? https://api.waterdata.usgs.gov/ogcapi/v0/collections/time-series-metadata

If you were using https://waterservices.usgs.gov/nwis/stats/ , more information about the modernized replacement will be available soon. If you were using https://waterdata.usgs.gov/nwis/qwdata , you should look at the documentation for the samples-data API.

The new APIs listed in the table are all hosted on https://api.waterdata.usgs.gov/ogcapi/ and implement the OGC API - Features standard. You can find an overview walking through how these APIs are structured at this link.

If you're going to make more than a few queries per hour, you'll need to provide an API key as part of your request. You can sign up for an API key here, and learn more about how to use API keys here.

This page walks through the new variable names used by the modernized APIs, listing where the variables returned by each WaterServices endpoint can now be accessed. When these variables have been intentionally discontinued, they are listed as "no longer provided". Variables which may be provided in the future are instead listed as "not currently available".

The bottom of this page additionally provides advice on how to translate common query patterns to the modernized services.

Migrating from /dv to /daily

From WaterServices JSON

The top-level metadata in the JSON object ("name", "declaredType", "scope", "nil", "globalScope", and "typeSubstituted") will no longer be returned.

The "queryInfo" block inside the top-level "value" key will no longer be returned. The "requestDT" has an equivalent in the "timeStamp" field of the /daily response object. The provisional data statement may be accessed at this link.

The remaining "timeSeries" block contains one section per time series included in the response, each of which contains a "sourceInfo" block, a "variable" block, a "values" block, and a "name" block. The "name" block combines the "agency_code" and "monitoring_location_number" fields in the /monitoring-locations endpoint with the "parameter_code" and "statistic_id" fields in the /daily endpoint. The other three blocks are represented in one of the below tables. Note that the /daily endpoint returns one feature per observation, rather than grouping per timeseries, which may require refactoring existing workflows.

The "sourceInfo" block is now provided by the /monitoring-locations endpoint. As such, the field names listed on the right side of the table below represent fields in the /monitoring-locations endpoint.

Field in the /dv "sourceInfo" block Corresponding field in the /monitoring-locations response
siteName monitoring_location_name
siteCode -> value monitoring_location_number . Included in the monitoring_location_id field in /daily.
siteCode -> agencyCode agency_code ("network" is no longer provided). Included in the monitoring_location_id field in /daily.
timeZoneInfo -> defaultTimeZone -> zoneOffset Not currently available.
timeZoneInfo -> defaultTimeZone -> zoneAbbreviation time_zone_abbreviation
timeZoneInfo -> daylightSavingsTimeZone -> zoneOffset No longer provided.
timeZoneInfo -> daylightSavingsTimeZone -> zoneAbbreviation No longer provided.
timeZoneInfo -> siteUsesDaylightSavingsTime uses_daylight_savings
geoLocation -> geogLocation -> srs All coordinates are in EPSG:4326, or use the CRS specified by the crs argument.
geoLocation -> geogLocation -> latitude Provided as part of the "geometry" object.
geoLocation -> geogLocation -> longitude Provided as part of the "geometry" object.
geoLocation -> localSiteXY No longer provided.
note No longer provided.
siteType site_type
siteProperty -> "siteTypeCd" site_type_code
siteProperty -> "hucCd" hydrologic_unit_code
siteProperty -> "stateCd" state_code
siteProperty -> "countyCd" county_code

Certain portions of the "variable" block are now provided by the /time-series-metadata endpoint. These are specifically mentioned in the table below. The "id" field in the time-series-metadata endpoint corresponds to the "time_series_id" field in the /daily endpoint, and can be used to join data from the two endpoints together.

Field in the /dv "variable" block Corresponding field in the /daily response
variableCode -> value parameter_code
variableCode -> network No longer provided.
variableCode -> vocabulary No longer provided.
variableCode -> variableID No longer provided.
variableCode -> default No longer provided.
variableName parameter in /time-series-metadata
variableDescription parameter_description in /time-series-metadata
valueType Not currently available.
unit -> unitCode unit_of_measure
options -> option -> value Currently only available through the table of statistic codes on help.waterdata.usgs.gov.
options -> option -> name No longer provided.
options -> option -> optionCode statistic_id
note No longer provided.
noDataValue No longer provided. Missing data is now represented with null values.
variableProperty No longer provided.
oid No longer provided.

Fields in the "values" block are provided by the /daily endpoint.

Field in the /dv "values" block Corresponding field in the /daily response
value -> value value
value -> qualifiers approval_status
value -> dateTime time (now an ISO8601 YYYY-MM-DD date string)
qualifier -> qualifierCode Approval status ("Approved" and "Provisional") are now called approval_status. Other qualifiers are called qualifier.
qualifier -> qualifierDescription Not currently available.
qualifier -> qualifierID Not currently available.
qualifier -> network No longer provided.
qualifier -> vocabulary No longer provided.
qualityControlLevel No longer provided.
method -> methodDescription Not currently available.
method -> methodID Not currently available.
source No longer provided.
offset No longer provided.
sample No longer provided.
censorCode No longer provided.

From WaterServices RDB

Most of the header of the RDB file is no longer provided. The provisional data statement may be accessed at this link.

The monitoring location metadata at the top of the RDB file is now available from the /monitoring-locations endpoint:

#    USGS 01094400 NORTH NASHUA RIVER AT FITCHBURG, MA

This line contains three pieces of data:

Variable documentation lines are now available either through the collection schema page or the OpenAPI documentation.

The next lines contain time series metadata now primarily available from the /time_series_metadata endpoint:

# Data provided for site 01094400
#    TS_ID       Parameter    Statistic  IV_TS_ID       Description
#    64060       00060        00003      65937          Discharge, cubic feet per second (Mean)

This line contains five pieces of information:

The remainder of the file generally contains a number of lines following the same general table structure:

agency_cd	site_no	datetime	64060_00060_00003	64060_00060_00003_cd

The first three of these columns are returned as fields in either the /daily or /monitoring-locations endpoints:

The remaining columns return metadata in their column names, which is now returned in distinct fields instead. Column names combined three pieces of metadata separated by underscores. Taking 64060_00060_00003 as an example:

Values that were under columns named following this pattern are now called "value" in the /daily endpoint.

Values that were under columns ending in _cd have been split into two fields. Values of P and A, indicating whether the data is provisional or has been approved, are now returned in the "approval_status" field of the /daily endpoint. Other values are now returned in the "qualifier" field of the /daily endpoint.

From WaterServices WaterML2

The ns1:queryInfo block is no longer provided. The ns2:note title="requestDT" field is now called "timeStamp".

We additionally no longer provide the references to XML and WaterML schemas used by the WaterML2 response object. These are not included in the table below.

Key in the /dv WaterML2 response New endpoint Corresponding field name
ns1:timeSeries name /monitoring-locations, /daily, /time-series-metadata This name object combines the agency_code and monitoring_location_number from the /monitoring-locations endpoint with the parameter_code and statistic_id returned by both the /daily and /time-series-metadata endpoints. The agency code and monitoring location number are also combined to form the monitoring_location_id in /daily and /time-series-metadata and the id field in /monitoring-locations.
ns1:siteName /monitoring-locations monitoring_location_name
ns1:siteCode /monitoring-locations monitoring_location_number
ns1:siteCode network No longer provided.
ns1:siteCode agencyCode /monitoring-locations agency_code. The agency code and monitoring location number are combined to form the monitoring_location_id in /daily and /time-series-metadata and the id field in /monitoring-locations.
ns1:timeZoneInfo siteUsesDaylightSavingsTime monitoring-locations uses_daylight_savings
ns1:defaultTimeZone zoneOffset
ns1:defaultTimeZone zoneOffset zoneAbbreviation monitoring-locations time_zone_abbreviation
ns1:daylightSavingsTimeZone zoneOffset
ns1:daylightSavingsTimeZone zoneOffset zoneAbbreviation
ns1:geogLocation srs No longer provided. All coordinates returned use EPSG:4326 as their CRS, unless you specify an alternative CRS in your query.
ns1:geogLocation latitude /daily Provided as part of the geometry field.
ns1:geogLocation longitude /daily Provided as part of the geometry field.
ns1:siteProperty name="siteTypeCd" /monitoring-locations site_type_code
ns1:siteProperty name="hucCd" /monitoring-locations hydrologic_unit_code
ns1:siteProperty name="stateCd" /monitoring-locations state_code
ns1:siteProperty name="countyCd" /monitoring-locations county_code
ns1:variable ns1:oid No longer provided.
ns1:variableCode network No longer provided.
ns1:variableCode vocabulary No longer provided.
ns1:variableCode default No longer provided.
ns1:variableCode variableID No longer provided.
ns1:variableCode /daily, /time-series-metadata parameter_code
ns1:variableName /time-series-metadata parameter
ns1:variableDescription /time-series-metadata parameter_description
ns1:valueType No longer provided.
ns1:unitCode /daily, /time-series-metadata unit_of_measure
ns1:option name="Statistic" optionCode /daily, /time-series-metadata statistic_id
ns1:option The descriptive name for each statistic_id are available through the table of statistic codes on help.waterdata.usgs.gov.
ns1:noDataValue No longer provided. Missing values are now represented as null values.
ns1:value qualifiers /daily Approval status (qualifiers "P" and "A") are now called approval_status. All other qualifiers are now called qualifier.
ns1:value dateTime /daily time
ns1:value /daily value
ns1:qualifier qualifierID No longer provided.
ns1:qualifier ns1:network No longer provided.
ns1:qualifier ns1:vocabulary="uv_rmk_cd" No longer provided.
ns1:qualifierCode /daily Approval status (qualifiers "P" and "A") are now called approval_status. All other qualifiers are now called qualifier.
ns1:qualifierDescription Not currently available.
ns1:method Not currently available.
ns1:method methodID Not currently available.
ns1:methodDescription Not currently available.

Migrating from /site to /monitoring-locations

Requests to /site which either did not include "seriesCatalogOutput" or set "seriesCatalogOutput=false" can be entirely replaced by the /monitoring-locations service.

Field name in the /site endpoint Field name in the /monitoring-locations endpoint
agency_cd agency_code
site_no monitoring_location_number
station_nm monitoring_location_name
site_tp_cd site_type_code
lat_va No longer provided.
long_va No longer provided.
dec_lat_va Provided as part of "geometry"
dec_long_va Provided as part of "geometry"
coord_meth_cd horizontal_position_method_code
coord_acy_cd horizontal_positional_accuracy
coord_datum_cd original_horizontal_datum
dec_coord_datum_cd No longer provided.
district_cd district_code
state_cd state_code
county_cd county_code
country_cd country_code
land_net_ds No longer provided.
map_nm No longer provided.
map_scale_fc No longer provided.
alt_va altitude
alt_meth_cd altitude_method_code
alt_acy_va altitude_accuracy
alt_datum_cd vertical_datum
huc_cd hydrologic_unit_code
basin_cd basin_code
topo_cd No longer provided.
instruments_cd No longer provided.
construction_dt construction_date
inventory_dt No longer provided.
drain_area_va drainage_area
contrib_drain_area_va contributing_drainage_area
tz_cd time_zone_abbreviation
local_time_fg uses_daylight_savings
reliability_cd No longer provided.
gw_file_cd No longer provided.
nat_aqfr_cd national_aquifer_code
aqfr_cd aquifer_code
aqfr_type_cd aquifer_type_code
well_depth_va well_constructed_depth
hole_depth_va hole_constructed_depth
depth_src_cd depth_source_code
project_no No longer provided.

Migrating from /site to /time-series-metadata

Requests to /site which set "seriesCatalogOutput=true" are only partially replaced by the /monitoring-locations endpoint. The fields which are now returned by the /monitoring-locations endpoint are listed below.

Field name in the /site endpoint Field name in the /monitoring-locations endpoint
agency_cd agency_code
site_no monitoring_location_number
station_nm monitoring_location_name
site_tp_cd site_type_code
dec_lat_va Provided as part of "geometry"
dec_long_va Provided as part of "geometry"
coord_meth_cd horizontal_position_method_code
coord_acy_cd horizontal_positional_accuracy
coord_datum_cd original_horizontal_datum
dec_coord_datum_cd Coordinates are now always in EPSG:4326 unless queries provide a "crs" argument.
alt_va altitude
alt_acy_va altitude_accuracy
alt_datum_cd vertical_datum
huc_cd hydrologic_unit_code

Period of record information for water quality data is now provided by the USGS samples data API /summary endpoint. Documentation for that endpoint is available here.

Period of record information for site visits are not yet available from modernized services.

Period of record information for time series data, including both instantaneous values and daily values, is available from the /time-series-metadata endpoint. You can find all time series for a given monitoring location by querying using the monitoring_location_id parameter.

Field name in the /site endpoint Field name in the /time-series-metadata endpoint
data_type_cd No longer provided. Continuous measurements have a "computation_identifier" of "Instantaneous" and a "computation_period_identifier" of "Points", while daily values have a "computation_period_identifier" of "Daily".
parm_cd parameter_code
stat_cd statistic_id
ts_id id
loc_web_ds No longer provided.
medium_grp_cd Not currently available.
parm_grp_cd Not currently available.
srs_id No longer provided.
access_cd No longer provided.
begin_date start
end_date end
count_nu Not currently available.

How can I query for multiple monitoring locations, parameter codes, time series IDs, or other parameters at once?

The modernized APIs only support one value per query parameter in most GET requests. As such, more complex filters require one of two approaches:

How can I download all the data for a HUC, basin, county, or other boundary area?

The new data endpoints do not have set arguments that let you filter down to specific areas. Instead, make two distinct queries to the APIs:

The /daily endpoint additionally supports using the bbox argument to restrict your query only to sites in a specified spatial region.