# USGS Water Services API

> Returns USGS water monitoring sites and their instant values, daily means and long-term daily statistics.

Category: Government & Open Data. Region: US. 7 endpoints at `https://api.hoshime.com/v1/usgswater/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/usgswater
## GET /v1/usgswater/instantValues

The measurements of a site over the last hours, every 5 to 60 minutes.

Scope: `social:read` · Units: 1 · Cached: 5 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `site` | string | yes | USGS site number, such as 01646500 (Potomac River near Washington, DC). (e.g. 01646500) |
| `parameter` | string | no | USGS parameter: 00060 discharge (ft3/s), 00065 gage height (ft) or 00010 water temperature (C). (one of 00060, 00065, 00010; default 00060) |
| `hours` | integer | no | Hours back from now, from 1 to 120. (default 2) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `items` (Reading[]), `items[].measuredAt` (string), `items[].qualifiers` (string[]), `items[].value` (number (double)), `parameter` (string), `site` (string), `siteName` (string), `unit` (string), `variable` (string)

```bash
curl "https://api.hoshime.com/v1/usgswater/instantValues?site=01646500" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/usgswater/dailyValues

The daily mean of a site between two dates.

Scope: `social:read` · Units: 1 · Cached: 360 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `site` | string | yes | USGS site number, such as 01646500 (Potomac River near Washington, DC). (e.g. 01646500) |
| `parameter` | string | no | USGS parameter: 00060 discharge (ft3/s), 00065 gage height (ft) or 00010 water temperature (C). (one of 00060, 00065, 00010; default 00060) |
| `startDate` | string | yes | First day, YYYY-MM-DD. (e.g. 2023-01-01) |
| `endDate` | string | yes | Last day, YYYY-MM-DD. (e.g. 2023-01-07) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `items` (Reading[]), `items[].measuredAt` (string), `items[].qualifiers` (string[]), `items[].value` (number (double)), `parameter` (string), `site` (string), `siteName` (string), `unit` (string), `variable` (string)

```bash
curl "https://api.hoshime.com/v1/usgswater/dailyValues?site=01646500&startDate=2023-01-01&endDate=2023-01-07" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/usgswater/sites

The active USGS monitoring sites of a US state: rivers, lakes, wells and others, with their position.

Scope: `social:read` · Units: 1 · Cached: 1440 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `state` | string | yes | Two-letter state code, such as DC or CA. (e.g. DC) |
| `limit` | integer | no | Items per page, 1 to 500. (default 50; e.g. 5) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `agency` (string), `category` (string), `id` (string), `latitude` (number (double)), `longitude` (number (double)), `name` (string)

```bash
curl "https://api.hoshime.com/v1/usgswater/sites?state=DC&limit=5" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/usgswater/sitesNear

The active USGS monitoring sites around a point, nearest first, with their distance: rivers, lakes, wells and weather stations.

Scope: `social:read` · Units: 1 · Cached: 1440 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `lat` | string | yes | Latitude of the point, -90 to 90. (e.g. 38.8894) |
| `lon` | string | yes | Longitude of the point, -180 to 180. (e.g. -77.0352) |
| `radiusKm` | integer | no | Search radius in kilometres, 1 to 100. Sites in the square around the point are listed. (default 25) |
| `limit` | integer | no | Items per page, 1 to 100. (default 20; e.g. 5) |
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `agency` (string), `category` (string), `distanceKm` (number (double)), `id` (string), `latitude` (number (double)), `longitude` (number (double)), `name` (string)

```bash
curl "https://api.hoshime.com/v1/usgswater/sitesNear?lat=38.8894&lon=-77.0352&limit=5" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/usgswater/site

One USGS monitoring site by its number: name, type, agency and position.

Scope: `social:read` · Units: 1 · Cached: 1440 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `site` | string | yes | USGS site number, such as 01646500 (Potomac River near Washington, DC). (e.g. 01646500) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `agency` (string), `category` (string), `id` (string), `latitude` (number (double)), `longitude` (number (double)), `name` (string)

```bash
curl "https://api.hoshime.com/v1/usgswater/site?site=01646500" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/usgswater/dailyStats

Long-term statistics of one site for each day of the year: the min, mean, median and max of all past years.

Scope: `social:read` · Units: 1 · Cached: 1440 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `site` | string | yes | USGS site number, such as 01646500 (Potomac River near Washington, DC). (e.g. 01646500) |
| `parameter` | string | no | USGS parameter: 00060 discharge (ft3/s), 00065 gage height (ft) or 00010 water temperature (C). (one of 00060, 00065, 00010; default 00060; e.g. 00060) |
| `limit` | integer | no | Items per page, 1 to 366. (default 366; e.g. 7) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `beginYear` (integer (int64)), `count` (integer (int64)), `day` (integer (int64)), `endYear` (integer (int64)), `max` (number (double)), `maxYear` (integer (int64)), `mean` (number (double)), `median` (number (double)), `min` (number (double)), `minYear` (integer (int64)), `month` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/usgswater/dailyStats?site=01646500&parameter=00060&limit=7" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/usgswater/peakFlows

The highest streamflow of each year at a river site since its records began, newest first: flood history.

Scope: `social:read` · Units: 1 · Cached: 1440 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `site` | string | yes | USGS site number, such as 01646500 (Potomac River near Washington, DC). (e.g. 01646500) |
| `limit` | integer | no | Items per page, 1 to 100. (default 20; e.g. 5) |
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `date` (string), `dischargeCfs` (number (double)), `gageHeightFeet` (number (double)), `qualifier` (string), `time` (string)

```bash
curl "https://api.hoshime.com/v1/usgswater/peakFlows?site=01646500&limit=5" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
