# USGS Water Services Scraper (`parseforge/usgs-water-services-scraper`) Actor

Query USGS Water Services for real time stream gauge, well, and spring data: site ID, name, latitude, longitude, state, county, parameter (flow, gauge height, temperature), value, unit, and timestamp. Export hydrology data to JSON, CSV, or Excel for environmental research and ops.

- **URL**: https://apify.com/parseforge/usgs-water-services-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Business, Other, Education
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $14.00 / 1,000 result items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

![ParseForge Banner](https://github.com/ParseForge/apify-assets/blob/ad35ccc13ddd068b9d6cba33f323962e39aed5b2/banner.jpg?raw=true)

## 🌊 USGS Water Services Scraper

> 🚀 **Export US hydrologic observations in seconds.** Pull **streamflow, gauge height, water temperature, dissolved oxygen, pH, and groundwater levels** from the National Water Information System across **~10,000 monitoring sites**. No API key, no registration, no manual CSV downloads.

> 🕒 **Last updated:** 2026-05-23 · **📊 18 fields** per record · **🌊 ~10,000 USGS sites** · **💧 3 endpoints** (iv / dv / gwlevels) · **🇺🇸 50 states**

The **USGS Water Services Scraper** exports observation records from the United States Geological Survey's National Water Information System (NWIS), the authoritative source for real-time and historical surface-water and groundwater data in the United States. Each record contains the site identifier, site name, geographic coordinates, parameter code, observed value, unit, qualifier flags, and the precise observation timestamp.

The catalog covers **streamflow gauges on every major river system, lake and reservoir levels, water-quality monitors, and groundwater wells across all 50 states**, plus territories. Pull the most-recent reading for live dashboards or a date-bounded window for trend analysis, flood-modeling, or environmental research. This Actor turns the underlying observation feed into clean CSV, Excel, JSON, or XML in under five minutes.

| 🎯 Target Audience | 💡 Primary Use Cases |
|---|---|
| Hydrologists, civil engineers, environmental scientists, irrigation operators, flood-warning teams, GIS analysts, ag-tech and water-utility companies | Streamflow monitoring, flood and drought modeling, irrigation scheduling, water-quality compliance, reservoir operations, environmental research |

---

### 📋 What the USGS Water Services Scraper does

Three endpoint modes in a single Actor:

- 💧 **Instantaneous Values (`iv`).** Sub-hourly readings from real-time surface-water gauges.
- 📅 **Daily Values (`dv`).** Daily mean / min / max statistics for long-term trend analysis.
- 🪨 **Groundwater Levels (`gwlevels`).** Discrete and continuous well-level measurements.

Filter by **USGS site codes**, **parameter codes** (00060 discharge, 00065 gauge height, 00010 water temperature, 00300 dissolved oxygen, 00400 pH, and dozens more), and an optional **date range** for historical exports.

Each record includes site metadata (code, name, state, coordinates, site type), parameter metadata (code, description, unit, statistic), the observed value, qualifier flags, agency code, and the precise observation timestamp.

> 💡 **Why it matters:** USGS NWIS is the canonical source for US streamflow and groundwater data, cited by NOAA forecasts, FEMA flood maps, state water boards, and academic hydrology. Building your own pipeline means handling WaterML and JSON variants, retry logic, and site-code lookups by hand. This Actor skips all of that.

---

### 🎬 Full Demo

_🚧 Coming soon: a 3-minute walkthrough showing how to go from sign-up to a downloaded hydrology dataset._

---

### ⚙️ Input

<table>
<thead>
<tr><th>Input</th><th>Type</th><th>Default</th><th>Behavior</th></tr>
</thead>
<tbody>
<tr><td>maxItems</td><td>integer</td><td>10</td><td>Records to return. Free plan caps at 10, paid plan at 1,000,000.</td></tr>
<tr><td>endpoint</td><td>string</td><td>"iv"</td><td>One of iv (instantaneous), dv (daily), gwlevels (groundwater).</td></tr>
<tr><td>sites</td><td>array of string</td><td>["01646500"]</td><td>USGS site identifiers (8-15 digits).</td></tr>
<tr><td>parameterCodes</td><td>array of string</td><td>["00060","00065"]</td><td>USGS parameter codes (5-digit). Empty = all parameters.</td></tr>
<tr><td>startDate</td><td>string (YYYY-MM-DD)</td><td>""</td><td>Start of the time window. Empty = latest reading only.</td></tr>
<tr><td>endDate</td><td>string (YYYY-MM-DD)</td><td>""</td><td>End of the time window. Empty = latest reading only.</td></tr>
</tbody>
</table>

**Example: latest streamflow + gauge height for the Potomac River near Washington DC.**

```json
{
    "maxItems": 50,
    "endpoint": "iv",
    "sites": ["01646500"],
    "parameterCodes": ["00060", "00065"]
}
````

**Example: 30 days of daily streamflow on the Colorado River at Lees Ferry.**

```json
{
    "maxItems": 1000,
    "endpoint": "dv",
    "sites": ["09380000"],
    "parameterCodes": ["00060"],
    "startDate": "2026-04-01",
    "endDate": "2026-04-30"
}
```

> ⚠️ **Good to Know:** USGS site codes range from 8 to 15 digits. Find sites on the [USGS Water Data interface](https://waterdata.usgs.gov/nwis/rt) or via the USGS site-search tool. Common parameters: `00060` discharge (cfs), `00065` gauge height (ft), `00010` water temperature (C), `00300` dissolved oxygen, `00400` pH.

***

### 📊 Output

Each observation record contains **18 fields**. Download the dataset as CSV, Excel, JSON, or XML.

#### 🧾 Schema

| Field | Type | Example |
|---|---|---|
| 🆔 `siteCode` | string | `"01646500"` |
| 🏷️ `siteName` | string | `"POTOMAC RIVER NEAR WASH, DC LITTLE FALLS PUMP STA"` |
| 🏛️ `stateCode` | string | `"VA"` |
| 📍 `latitude` | number | `38.94977778` |
| 📍 `longitude` | number | `-77.12763889` |
| 🌊 `siteType` | string | `"ST"` |
| 🔢 `parameterCode` | string | `"00060"` |
| 🏷️ `parameterName` | string | `"Discharge"` |
| 📖 `parameterDescription` | string | `"Discharge, cubic feet per second"` |
| 📏 `unit` | string | `"ft3/s"` |
| 📊 `statisticCode` | string | null | `"00003"` |
| 📈 `value` | number | `3210` |
| 🚩 `qualifiers` | array | null | `["P"]` |
| 🕒 `dateTime` | ISO 8601 | `"2026-05-23T12:00:00.000-04:00"` |
| 🎯 `endpoint` | string | `"iv"` |
| 🔬 `methodDescription` | string | null | `""` |
| 🏛️ `agencyCode` | string | `"USGS"` |
| 🕒 `scrapedAt` | ISO 8601 | `"2026-05-23T16:00:00.000Z"` |

#### 📦 Sample records

<details>
<summary><strong>🌊 Real-time discharge: Potomac River near Washington DC</strong></summary>

```json
{
    "siteCode": "01646500",
    "siteName": "POTOMAC RIVER NEAR WASH, DC LITTLE FALLS PUMP STA",
    "stateCode": "VA",
    "latitude": 38.94977778,
    "longitude": -77.12763889,
    "siteType": "ST",
    "parameterCode": "00060",
    "parameterName": "Discharge",
    "parameterDescription": "Discharge, cubic feet per second",
    "unit": "ft3/s",
    "statisticCode": null,
    "value": 3210,
    "qualifiers": ["P"],
    "dateTime": "2026-05-23T12:00:00.000-04:00",
    "endpoint": "iv",
    "methodDescription": "",
    "agencyCode": "USGS",
    "scrapedAt": "2026-05-23T16:00:00.000Z"
}
```

</details>

<details>
<summary><strong>📅 Daily mean discharge: Colorado River at Lees Ferry</strong></summary>

```json
{
    "siteCode": "09380000",
    "siteName": "COLORADO RIVER AT LEES FERRY, AZ",
    "stateCode": "AZ",
    "latitude": 36.86472222,
    "longitude": -111.5875,
    "siteType": "ST",
    "parameterCode": "00060",
    "parameterName": "Discharge",
    "parameterDescription": "Discharge, cubic feet per second (Mean)",
    "unit": "ft3/s",
    "statisticCode": "00003",
    "value": 9760,
    "qualifiers": ["A"],
    "dateTime": "2026-04-15T00:00:00.000-07:00",
    "endpoint": "dv",
    "methodDescription": "",
    "agencyCode": "USGS",
    "scrapedAt": "2026-05-23T16:00:00.000Z"
}
```

</details>

<details>
<summary><strong>🪨 Groundwater level: well in California Central Valley</strong></summary>

```json
{
    "siteCode": "365613119242601",
    "siteName": "020S041E10K001M",
    "stateCode": "CA",
    "latitude": 36.93694444,
    "longitude": -119.4072222,
    "siteType": "GW",
    "parameterCode": "72019",
    "parameterName": "Depth to water level",
    "parameterDescription": "Depth to water level, feet below land surface",
    "unit": "ft",
    "statisticCode": null,
    "value": 142.55,
    "qualifiers": null,
    "dateTime": "2026-05-10T08:30:00.000-07:00",
    "endpoint": "gwlevels",
    "methodDescription": "Steel-tape measurement",
    "agencyCode": "USGS",
    "scrapedAt": "2026-05-23T16:00:00.000Z"
}
```

</details>

***

### ✨ Why choose this Actor

| | Capability |
|---|---|
| 🌊 | **National coverage.** ~10,000 active USGS monitoring sites across all 50 states and territories. |
| 💧 | **Three endpoints.** Instantaneous, daily, and groundwater levels covered by a single mode switch. |
| 🔬 | **Multi-parameter.** Streamflow, gauge height, temperature, dissolved oxygen, pH, conductance, and more. |
| 📅 | **Historical + real-time.** Date-bounded windows or just-the-latest reading, your choice. |
| ⚡ | **Fast.** Hundreds of observations in seconds, thousands in minutes. |
| 🚫 | **No authentication.** Works with public USGS Water Services. No login, no API key. |
| 🔁 | **Always fresh.** Every run pulls the latest observations available at run time. |

> 📊 USGS Water Services data underpins NOAA flood forecasts, FEMA flood maps, state-level drought monitoring, and the daily operations of every major US water utility.

***

### 📈 How it compares to alternatives

| Approach | Cost | Coverage | Refresh | Filters | Setup |
|---|---|---|---|---|---|
| **⭐ USGS Water Services Scraper** *(this Actor)* | $5 free credit, then pay-per-use | **~10,000 sites** | **Live per run** | site, parameter, date | ⚡ 2 min |
| Direct USGS WaterML feed | Free | National | Live | Hand-built filters | 🐢 Hours |
| Commercial hydrology APIs | $$$/month | Regional, bundled | Vendor cycle | Vendor-defined | ⏳ Days |
| Manual NWIS CSV downloads | Free | Per-site, one at a time | Manual | Web UI | 🕒 Variable |

Pick this Actor when you want server-side multi-site batching, clean structured output, and no parser maintenance.

***

### 🚀 How to use

1. 📝 **Sign up.** [Create a free account with $5 credit](https://console.apify.com/sign-up?fpr=vmoqkp) (takes 2 minutes).
2. 🌐 **Open the Actor.** Go to the USGS Water Services Scraper page on the Apify Store.
3. 🎯 **Set input.** Pick endpoint (iv / dv / gwlevels), list site codes, optionally narrow by parameter codes and a date range.
4. 🚀 **Run it.** Click **Start** and let the Actor collect your data.
5. 📥 **Download.** Grab your results in the **Dataset** tab as CSV, Excel, JSON, or XML.

> ⏱️ Total time from signup to downloaded dataset: **3-5 minutes.** No coding required.

***

### 💼 Business use cases

<table>
<tr>
<td width="50%" valign="top">

#### 🌊 Flood Warning & Hydrology

- Real-time stage and discharge for warning systems
- Rating-curve calibration with historical pulls
- Multi-gauge dashboards for river basins
- Cross-reference with NOAA precipitation feeds

</td>
<td width="50%" valign="top">

#### 🌾 Agriculture & Irrigation

- Surface-water availability for diversion decisions
- Reservoir-level dashboards for irrigation districts
- Groundwater trend monitoring for well operators
- Drought-index calculation with daily means

</td>
</tr>
<tr>
<td width="50%" valign="top">

#### 🏛️ Utilities & Compliance

- Source-water quality monitoring for drinking-water plants
- Wastewater receiving-stream baseline tracking
- NPDES permit compliance baselines
- Reservoir-operation decision support

</td>
<td width="50%" valign="top">

#### 🌎 Environmental Research

- Stream-temperature time series for fisheries studies
- Long-term groundwater-decline analyses
- Watershed health indicators at scale
- ML training sets for hydrologic models

</td>
</tr>
</table>

***

### 🔌 Automating USGS Water Services Scraper

Control the scraper programmatically for scheduled runs and pipeline integrations:

- 🟢 **Node.js.** Install the `apify-client` NPM package.
- 🐍 **Python.** Use the `apify-client` PyPI package.
- 📚 See the [Apify API documentation](https://docs.apify.com/api/v2) for full details.

The [Apify Schedules feature](https://docs.apify.com/platform/schedules) lets you trigger this Actor on any cron interval. Hourly real-time pulls keep dashboards live, while daily refreshes keep long-term archives in sync.

***

### 🌟 Beyond business use cases

Hydrologic data powers more than commercial workflows. The same structured records support research, education, civic transparency, and personal initiatives.

<table>
<tr>
<td width="50%">

#### 🎓 Research and academia

- Stream-discharge datasets for hydrology dissertations
- Long-term trend analysis for climate impact studies
- Reproducible water-quality research with cited dataset pulls
- Coursework on watershed modeling and GIS

</td>
<td width="50%">

#### 🎨 Personal and creative

- River-runner planning dashboards for paddlers
- Fishing-condition forecasts based on stage and temperature
- Side projects visualizing local stream health
- Hobbyist weather-and-water mashups

</td>
</tr>
<tr>
<td width="50%">

#### 🤝 Non-profit and civic

- Riverkeeper organizations tracking water quality
- Civic-tech projects mapping drought conditions
- Investigative journalism on water-rights disputes
- Local-government dashboards for transparency

</td>
<td width="50%">

#### 🧪 Experimentation

- Train hydrologic ML models on real observation feeds
- Build flood-prediction prototypes with historical data
- Prototype agents that summarize watershed conditions
- Test ETL pipelines on multi-site time-series data

</td>
</tr>
</table>

***

### 🤖 Ask an AI assistant about this scraper

Open a ready-to-send prompt about this ParseForge actor in the AI of your choice:

- 💬 [**ChatGPT**](https://chat.openai.com/?q=How%20do%20I%20use%20the%20USGS%20Water%20Services%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🧠 [**Claude**](https://claude.ai/new?q=How%20do%20I%20use%20the%20USGS%20Water%20Services%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🔍 [**Perplexity**](https://perplexity.ai/search?q=How%20do%20I%20use%20the%20USGS%20Water%20Services%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)
- 🅒 [**Copilot**](https://copilot.microsoft.com/?q=How%20do%20I%20use%20the%20USGS%20Water%20Services%20Scraper%20by%20ParseForge%20on%20Apify%3F%20Show%20me%20input%20examples%2C%20output%20fields%2C%20common%20use%20cases%2C%20and%20how%20to%20integrate%20it%20into%20a%20workflow.)

***

### ❓ Frequently Asked Questions

#### 🧩 How does it work?

Pick an endpoint (`iv`, `dv`, `gwlevels`), list one or more USGS site codes, optionally filter by parameter codes and a date range, and click Start. The Actor pulls observations directly from the USGS National Water Information System and emits one structured record per reading.

#### 📏 How accurate is the data?

This Actor mirrors USGS NWIS exactly. Values, qualifier flags, and timestamps come straight from the upstream observation feed. Real-time `iv` readings are typically provisional (qualifier `"P"`) until USGS hydrographers review them; daily values are approved (`"A"`) once reviewed.

#### 🔁 How often is the dataset refreshed?

USGS instantaneous values update every 15 to 60 minutes depending on the gauge. Daily values refresh once per day. Groundwater levels refresh on each scheduled measurement. Every run of this Actor pulls the most recent data available.

#### 🌊 Which parameter codes are most useful?

`00060` discharge (cfs), `00065` gauge height (ft), `00010` water temperature (C), `00300` dissolved oxygen (mg/L), `00400` pH, `00095` specific conductance. Leave the parameter list empty to return every parameter available at the site.

#### 🗺️ How do I find USGS site codes?

Browse the official [USGS Water Data dashboard](https://waterdata.usgs.gov/nwis/rt), or use the USGS site-search tool to filter by state, county, or river basin. Site codes range from 8 to 15 digits.

#### ⏰ Can I schedule regular runs?

Yes. Use Apify Schedules to trigger hourly pulls for real-time dashboards or daily pulls for long-term archives. Webhooks can push fresh observations straight into Slack, your warehouse, or a downstream alerting service.

#### ⚖️ Is this data legal to use?

USGS data is in the public domain in the United States. You can use, redistribute, and embed it in your own products without restriction. Attribution to USGS is appreciated but not required.

#### 💼 Can I use this data commercially?

Yes. USGS data is public-domain, so commercial use is permitted without licensing fees.

#### 💳 Do I need a paid Apify plan to use this Actor?

No. The free Apify plan is enough for testing and small runs (10 records per run). A paid plan lifts the limit and gives you access to scheduling, higher concurrency, and larger datasets.

#### 🔁 What happens if a run fails or gets interrupted?

Apify automatically retries transient errors. If a run still fails, you can inspect the log in the Runs tab, fix the input, and re-run. Partial datasets from failed runs are preserved so you never lose progress.

#### 🆘 What if I need help?

Our support team is here to help. Contact us through the Apify platform or use the Tally form linked below.

***

### 🔌 Integrate with any app

USGS Water Services Scraper connects to any cloud service via [Apify integrations](https://apify.com/integrations):

- [**Make**](https://docs.apify.com/platform/integrations/make) - Automate multi-step workflows
- [**Zapier**](https://docs.apify.com/platform/integrations/zapier) - Connect with 5,000+ apps
- [**Slack**](https://docs.apify.com/platform/integrations/slack) - Get real-time observation alerts
- [**Airbyte**](https://docs.apify.com/platform/integrations/airbyte) - Pipe hydrology data into your warehouse
- [**GitHub**](https://docs.apify.com/platform/integrations/github) - Trigger runs from commits and releases
- [**Google Drive**](https://docs.apify.com/platform/integrations/drive) - Export datasets straight to Sheets

You can also use webhooks to trigger downstream actions when a run finishes. Push fresh stage readings into your flood-warning system, or alert your operations team in Slack when a threshold is crossed.

***

### 🔗 Recommended Actors

- [**🌡️ NOAA Weather Scraper**](https://apify.com/parseforge/noaa-weather-scraper) - Official US weather observations and forecasts
- [**🌍 EPA Air Quality Scraper**](https://apify.com/parseforge/epa-air-quality-scraper) - US air-quality monitor data
- [**🏛️ ourairports Scraper**](https://apify.com/parseforge/ourairports-scraper) - Global airport reference dataset
- [**🗺️ Nominatim OSM Scraper**](https://apify.com/parseforge/nominatim-osm-scraper) - Geocode addresses via OpenStreetMap
- [**📊 World Bank Indicators Scraper**](https://apify.com/parseforge/world-bank-indicators-scraper) - Global development indicators

> 💡 **Pro Tip:** browse the complete [ParseForge collection](https://apify.com/parseforge) for more reference-data scrapers.

***

**🆘 Need Help?** [**Open our contact form**](https://tally.so/r/BzdKgA) to request a new scraper, propose a custom data project, or report an issue.

***

> **⚠️ Disclaimer:** this Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by the US Geological Survey or the Department of the Interior. All trademarks mentioned are the property of their respective owners. Only publicly available USGS data is collected.

# Actor input Schema

## `maxItems` (type: `integer`):

Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000

## `endpoint` (type: `string`):

Which USGS Water Services data product to query. iv = instantaneous values, dv = daily values, gwlevels = groundwater levels.

## `sites` (type: `array`):

List of USGS site identifiers (8-15 digit numbers). Example: '01646500' (Potomac River near Washington DC). Find sites at https://waterdata.usgs.gov/nwis/rt.

## `parameterCodes` (type: `array`):

USGS parameter codes (5-digit). Common: '00060' discharge (cfs), '00065' gauge height (ft), '00010' water temperature (C), '00300' dissolved oxygen, '00400' pH. Leave empty to return all parameters.

## `startDate` (type: `string`):

Start of the time window in ISO format (YYYY-MM-DD). Leave empty for most recent readings only.

## `endDate` (type: `string`):

End of the time window in ISO format (YYYY-MM-DD). Leave empty for most recent readings only.

## Actor input object example

```json
{
  "maxItems": 10,
  "endpoint": "iv",
  "sites": [
    "01646500"
  ],
  "parameterCodes": [
    "00060",
    "00065"
  ]
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "maxItems": 10,
    "endpoint": "iv",
    "sites": [
        "01646500"
    ],
    "parameterCodes": [
        "00060",
        "00065"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/usgs-water-services-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "maxItems": 10,
    "endpoint": "iv",
    "sites": ["01646500"],
    "parameterCodes": [
        "00060",
        "00065",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/usgs-water-services-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "maxItems": 10,
  "endpoint": "iv",
  "sites": [
    "01646500"
  ],
  "parameterCodes": [
    "00060",
    "00065"
  ]
}' |
apify call parseforge/usgs-water-services-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=parseforge/usgs-water-services-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "USGS Water Services Scraper",
        "description": "Query USGS Water Services for real time stream gauge, well, and spring data: site ID, name, latitude, longitude, state, county, parameter (flow, gauge height, temperature), value, unit, and timestamp. Export hydrology data to JSON, CSV, or Excel for environmental research and ops.",
        "version": "1.0",
        "x-build-id": "vm7yGTFLa6VFmAwHp"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/parseforge~usgs-water-services-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-parseforge-usgs-water-services-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/parseforge~usgs-water-services-scraper/runs": {
            "post": {
                "operationId": "runs-sync-parseforge-usgs-water-services-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/parseforge~usgs-water-services-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-parseforge-usgs-water-services-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000"
                    },
                    "endpoint": {
                        "title": "Service",
                        "enum": [
                            "iv",
                            "dv",
                            "gwlevels"
                        ],
                        "type": "string",
                        "description": "Which USGS Water Services data product to query. iv = instantaneous values, dv = daily values, gwlevels = groundwater levels."
                    },
                    "sites": {
                        "title": "USGS Site Codes",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "List of USGS site identifiers (8-15 digit numbers). Example: '01646500' (Potomac River near Washington DC). Find sites at https://waterdata.usgs.gov/nwis/rt.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "parameterCodes": {
                        "title": "Parameter Codes",
                        "type": "array",
                        "description": "USGS parameter codes (5-digit). Common: '00060' discharge (cfs), '00065' gauge height (ft), '00010' water temperature (C), '00300' dissolved oxygen, '00400' pH. Leave empty to return all parameters.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "startDate": {
                        "title": "Start Date",
                        "type": "string",
                        "description": "Start of the time window in ISO format (YYYY-MM-DD). Leave empty for most recent readings only."
                    },
                    "endDate": {
                        "title": "End Date",
                        "type": "string",
                        "description": "End of the time window in ISO format (YYYY-MM-DD). Leave empty for most recent readings only."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
