# USGS NWIS Instantaneous Water Values Scraper (`plainkitbin/usgs-water-instantaneous-values`) Actor

Fetch instantaneous streamflow and other water measurements for chosen USGS gauge sites as structured JSON rows. Not affiliated with USGS National Water Information System (NWIS) Instantaneous Values Service.

- **URL**: https://apify.com/plainkitbin/usgs-water-instantaneous-values.md
- **Developed by:** [PlainKit bin](https://apify.com/plainkitbin) (community)
- **Categories:** Developer tools, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.48 / 1,000 usgs water measurement rows

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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## USGS NWIS Instantaneous Values Scraper

### Introduction

Hydrologists, flood-risk analysts, water-utility planners, and students who work with river data need the measured values of a gauge station as plain rows. The USGS water data service publishes these values, but a raw response nests each measurement several levels deep, with site codes, parameter codes, units, and qualifiers spread across separate objects. This Actor flattens that structure into one JSON row per measured value.

One run asks the service for the sites you name, for the parameter codes you choose (00060 is discharge, the streamflow in cubic feet per second), and for a look-back window of one to seven days. It returns one row per measurement with the site number, site name, coordinates, parameter, value, unit, timestamp, and qualifiers. Every field is copied from the response as text, so you can check each row against the source.

Use it to build a daily streamflow table for a basin, to compare gauges over the same window, or to feed a spreadsheet or dashboard that tracks water levels.

This Actor is an independent tool and is not affiliated with USGS National Water Information System (NWIS) Instantaneous Values Service. It reads only from waterservices.usgs.gov.

### Input and output examples

Each delivered row looks like this:

```json
{
  "date_time": "2026-11-16T13:00:00.000-05:00",
  "latitude": "38.94977778",
  "longitude": "-77.12763889",
  "parameter_code": "00060",
  "parameter_name": "Streamflow, ft&#179;/s",
  "qualifiers": "P",
  "site_name": "POTOMAC RIVER NEAR WASH, DC LITTLE FALLS PUMP STA",
  "site_number": "01646500",
  "unit": "ft3/s",
  "value": "1600"
}
```

The field `qualifiers` carries the USGS qualifier codes for the value, for example `P` for provisional data that the agency may revise. The `parameter_name` and `value` fields keep the text as the service sent it.

If the service refuses the request (HTTP 401, 403, or 429), the run ends with one reason row, `{"reason_code": "USGS_API_REFUSED", "http_status": "429"}`, and that row is not charged.

### Tutorial

1. Open the Actor in Apify Console and enter one or more site numbers in `sites`. The Potomac River example uses `01646500`.
2. Leave `parameter_codes` at `00060` for streamflow, or add other 5-digit codes separated by commas.
3. Choose a `period` from `P1D` to `P7D`.
4. Set `max_items` to the number of rows you want, up to 1000.
5. Start the run and download the dataset as JSON, CSV, or Excel.

A run that is restarted by the platform does not deliver or charge a row twice. The Actor recognises rows already in the dataset by site number, parameter code, and timestamp.

### Pricing

- Pricing model: Apify Pay-Per-Event
- Event name: `usgs-water-value`, charged once per pushed measurement row
- Tier prices:
  - FREE tier: $0.005 per row
  - BRONZE: $0.0045 per row
  - SILVER: $0.004 per row
  - GOLD: $0.003484 per row
  - PLATINUM: $0.003484 per row
  - DIAMOND: $0.003334 per row

Each row is pushed first and charged right after the push. A refused charge stops the run and that row stays delivered but uncharged. A refused USGS request charges nothing.

### Actor recommendations

If you need a different measurement family from the same service, such as groundwater levels or daily statistics, use a separate Actor built for that endpoint. Compare the parameter codes you need in the USGS parameter list before you choose one.

### FAQ and support

**Does the Actor fix or estimate missing values?** No. Each value is copied as the service returned it. Qualifiers tell you about the state of a value.

**Why are some rows missing?** A row without a site number, parameter code, or timestamp cannot be identified, so it is not delivered. The run status reports how many such rows were skipped.

**Why are there fewer rows than I asked for?** The service may hold fewer values for the period you chose. Try a longer period or another site.

**How do I report a problem?** Write to support@example.com with the run ID and the input you used.

### Configuration

| Field | Type | Description | Default |
| --- | --- | --- | --- |
| `sites` | String | Comma-separated USGS site numbers, 8 to 15 digits each, up to 50. Required. | `01646500` |
| `parameter_codes` | String | Comma-separated 5-digit USGS parameter codes. | `00060` |
| `period` | String | ISO 8601 look-back window, `P1D` to `P7D`. | `P1D` |
| `max_items` | Integer (1-1000) | Maximum total measurement rows to output in one run. | `10` |

#### Example input

```json
{
  "sites": "01646500",
  "parameter_codes": "00060",
  "period": "P1D",
  "max_items": 5
}
```

# Actor input Schema

## `sites` (type: `string`):

Comma-separated USGS site numbers, 8 to 15 digits each (up to 50). Example: 01646500.

## `parameter_codes` (type: `string`):

Comma-separated 5-digit USGS parameter codes. 00060 is discharge (streamflow). Leave empty for 00060.

## `period` (type: `string`):

ISO 8601 duration of days back from the present, P1D to P7D. Leave empty for P1D.

## `max_items` (type: `integer`):

Maximum total measurement rows to output (1 to 1000).

## Actor input object example

```json
{
  "sites": "01646500",
  "parameter_codes": "00060",
  "period": "P1D",
  "max_items": 10
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items produced by this run.

# 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 = {
    "sites": "01646500",
    "parameter_codes": "00060",
    "period": "P1D",
    "max_items": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("plainkitbin/usgs-water-instantaneous-values").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 = {
    "sites": "01646500",
    "parameter_codes": "00060",
    "period": "P1D",
    "max_items": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("plainkitbin/usgs-water-instantaneous-values").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 '{
  "sites": "01646500",
  "parameter_codes": "00060",
  "period": "P1D",
  "max_items": 10
}' |
apify call plainkitbin/usgs-water-instantaneous-values --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,plainkitbin/usgs-water-instantaneous-values"
        }
    }
}
```

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/i19BfkAgCQefbuh0x/builds/skGajyRj2e3Jh0xxT/openapi.json
