# USGS Streamflow Scraper (`parseforge/usgs-streamflow-scraper`) Actor

Scrapes real-time streamflow, gage height, and water measurements from USGS monitoring stations by state or keyword search. Returns each observation as a flat row with site number, value, and unit.

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

## Pricing

from $19.00 / 1,000 results

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner.jpg)](https://apify.com/parseforge?fpr=vmoqkp)

### USGS Streamflow Scraper

**Scrape real-time streamflow, gage height, and water data from any USGS monitoring site or state, up to a million measurements per run.** Every record returns the latest value, site number, and measurement unit. No API key required. Export to CSV, JSON, Excel, or XML.

The USGS Water Services API requires navigating REST endpoints and parsing time-series formats for each parameter code. This Actor reads the public Instantaneous Values feed directly, filtered by state or a site keyword, and returns each measurement in one flat row.\n\nHydrologists, emergency managers, and researchers get the latest water conditions without writing a single request.

| Who uses it | What they scrape USGS Water Services for |
|---|---|
| Hydrologists | Monitor current streamflow and gage height across a watershed for flood forecasting. |
| Emergency managers | Pull the latest river levels for every gauge in a state during a storm event. |
| Environmental researchers | Collect baseline flow data for a study reach over a dry season. |
| Water resource engineers | Check real-time reservoir inflows and downstream releases for operations planning. |

### What it does

This Actor collects real-time streamflow, gage height, and other water measurements from USGS monitoring stations by state or keyword search, and returns each observation as a flat row.

- 📍 **State-wide collection:** pull every active gauge in a two-letter state code, such as CA or TX, in one run.
- 🔍 **Keyword search:** filter sites by name, site number, or location keyword to target a specific basin or city.
- 📏 **Multi-parameter ready:** returns whatever the station reports, including streamflow, gage height, and water temperature, in a consistent schema.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with USGS Water Services data

**🌊 Flood monitoring dashboards.**

An emergency operations center runs the Actor for a state code every 15 minutes to feed a live map of river levels and gage heights.

**📊 Regional water-year summaries.**

A consulting hydrologist pulls all streamflow measurements for a state at the end of the water year to compute annual statistics.

**🔬 Field campaign planning.**

A research team checks current gage heights and flows for a set of keyword-matched sites before deploying sensors.

**🏞️ Recreation flow checks.**

A kayaking outfitter scrapes a handful of river gauges by site name to post daily runnable flows on their website.

### Why choose this scraper

|  | What you get |
|---|---|
| **No API key** | Reads the public USGS Instantaneous Values feed directly, no registration or token needed. |
| **Flat row output** | Every measurement arrives as one row with site number, datetime, value, and unit, ready for a spreadsheet. |
| **State or site scope** | Pull every gauge in a state or narrow to a single watershed with a keyword. |
| **Scalable runs** | Collect up to a million measurements per run, enough for a full state snapshot. |

### How it compares

This Actor focuses on real-time Instantaneous Values by state or keyword, while the alternative also covers historical daily data and additional parameters.

| Feature | ParseForge | Usgs Water Scraper |
|---|---|---|
| Real-time Instantaneous Values | Yes | Yes |
| State-wide collection by two-letter code | Yes | Not listed |
| Keyword search for site name or number | Yes | Not listed |
| Historical daily values | Not listed | Yes |
| Groundwater levels | Not listed | Yes |
| Precipitation data | Not listed | Yes |

### Configure the run

Drive the Actor from a US state code or a site keyword search, alone or together, and the max items limit caps how many measurements reach your dataset. The Input tab lists every parameter.

A first run with the defaults:

```json
{
  "maxItems": 10
}
```

A larger pull:

```json
{
  "maxItems": 200
}
```

### Pricing

Pay-per-result: **$0.021 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $2.10 |
| 1,000 results | $21.00 |
| 10,000 results | $210.00 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [USGS Streamflow Scraper](https://apify.com/parseforge/usgs-streamflow-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to USGS Water Services through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com/?tools=parseforge/usgs-streamflow-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check that your state code is a valid two-letter USPS abbreviation and that the query, if used, matches a real site name or number. Also try increasing maxItems in case the default 10 is too low for the number of active stations.

**Why are some values negative or zero?**

USGS reports raw sensor readings. A negative gage height means the water surface is below the station's reference datum. A zero streamflow can occur in dry channels. These are valid measurements, not errors.

**Why do I see parameter codes instead of names?**

The Actor returns the raw parameter code as provided by USGS. You can map common codes yourself: 00060 is streamflow, 00065 is gage height, and 00010 is water temperature.

**The run timed out. What should I do?**

A very large state with many stations can take time. Increase the run timeout in your Apify actor settings, or reduce the scope by adding a keyword query to target fewer sites.

**Why are some stations missing from my state run?**

The Actor returns only stations that have reported a value in the current Instantaneous Values window. Temporarily offline or seasonal stations will not appear until they transmit again.

### FAQ

| Question | Answer |
|---|---|
| What data does this Actor return? | It returns real-time instantaneous values from USGS monitoring stations. Each row includes the site number, measurement datetime, parameter code, measured value, and unit. |
| Do I need a USGS API key? | No. The Actor reads the public USGS Instantaneous Values REST endpoint, which does not require authentication or an API key. |
| How do I get all gauges for a state? | Set the state input to the two-letter postal code, such as 'ca' or 'tx', and set maxItems high enough to cover the active stations. The Actor will return the latest measurement from every site in that state. |
| Can I filter by a specific river or site number? | Yes. Use the query field with a site name, site number, or location keyword. The Actor matches against the USGS site inventory and returns only those stations. |
| What parameters are available? | The Actor returns whatever the station reports. Common parameters include streamflow (00060), gage height (00065), and water temperature (00010), but any parameter code in the Instantaneous Values service will appear. |
| How many measurements can I collect in one run? | You can set maxItems up to 1,000,000. The default is 10 for a quick test. A full state run typically returns a few thousand rows. |
| What export formats are supported? | You can export your dataset to CSV, JSON, Excel, or XML from the Apify platform, or push it to an external service via an integration. |
| How often is the data updated? | The Actor reads the live USGS feed each time it runs. Most stations report every 15 to 60 minutes, so a fresh run returns the latest available value. |
| Can I schedule this to run automatically? | Yes. Apify schedules let you run the Actor every hour, day, or on a custom cron expression to build a time series of measurements. |
| Does this include historical data? | This Actor targets the Instantaneous Values service, which returns the most recent reading. For historical daily values, you would need a different endpoint. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by U.S. Geological Survey. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

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

How many measurements to collect per run.

## `query` (type: `string`):

Keyword search

## `state` (type: `string`):

Two-letter code, e.g. ca, tx

## Actor input object example

```json
{
  "maxItems": 10,
  "state": "ca"
}
```

# Actor output Schema

## `results` (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
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/usgs-streamflow-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 }

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

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).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
}' |
apify call parseforge/usgs-streamflow-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/usgs-streamflow-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/symhGFSdvoFiOyHJi/builds/VRmkgGpty7KnQUcP4/openapi.json
