# USGS Earthquake Catalog Search (`atesen-software/usgs-earthquake-search`) Actor

Query public USGS historical earthquake catalog records by dates, magnitude and bounding box. Returns event times, coordinates, depth and source links for research and human analysis. No alerts or emergency guarantees.

- **URL**: https://apify.com/atesen-software/usgs-earthquake-search.md
- **Developed by:** [Atesen Software](https://apify.com/atesen-software) (community)
- **Categories:** Developer tools, Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.80 / 1,000 earthquake records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Earthquake Catalog Search

Query public earthquake catalog metadata from the official U.S. Geological Survey FDSN Event API. Filter by UTC date range, magnitude and an optional bounding box. Export event IDs, origin times, magnitude, depth, coordinates, place, catalog review status, network and USGS event-page links for research and human analysis.

This Actor queries catalog data. Catalog entries can be preliminary, revised, deleted or delayed. It does not provide earthquake prediction, emergency alerts, safety instructions or guaranteed real-time coverage. For real-time display applications USGS recommends its dedicated GeoJSON feeds instead of repeated catalog queries.

### Example

```json
{"startDate":"2024-01-01","endDate":"2024-01-02","minMagnitude":5,"maxResults":1,"maxRequests":2}
```

Dates must be valid `YYYY-MM-DD` UTC dates with the end after the start, at most 366 days apart. Without dates the Actor queries the previous seven days up to midnight UTC today. USGS includes the start boundary and may include the exact end boundary. Magnitudes range from -2 to 10. To select an area, supply all four `minLatitude`, `maxLatitude`, `minLongitude`, `maxLongitude` numbers. Minimums must be strictly below maximums; split regions crossing the antimeridian into separate runs.

### Bounds and completion

The Actor uses only `https://earthquake.usgs.gov/fdsnws/event/1/query`, requests earthquake events ordered by descending origin time, makes serial pages of at most 20 events, deduplicates by USGS event ID, and caps output at 100 events and external requests at five including retries. No login, API key, browser, proxy, attachments or follow-up event-detail downloads are used. It rejects arbitrary URLs and unknown input fields. Responses are limited to 2 MiB and requests to 20 seconds; redirects are rejected. Concurrent catalog revisions can affect offset pagination: results are a bounded query rather than a reproducible catalog snapshot.

429/503 receive at most one retry within the total request cap. A numeric or HTTP-date `Retry-After` greater than three seconds stops the run with a clear status instead of retrying early. Missing retry headers use a one-second delay. Network errors receive at most one retry. Other HTTP failures, malformed JSON/GeoJSON and unexpected storage errors never become a successful zero-event result. Only a validated empty collection or HTTP 204 means no matching events.

Dataset rows use `recordType: "earthquake"` for results and `recordType: "status"` for a free run summary. `OUTPUT` in the key-value store has `status`, `resultRows`, `requests` and `message`. Check it before treating a run as complete. `request_limit`, `rate_limited`, `upstream_error`, `pagination_stalled` or unexpected errors can leave partial rows and fail the run. Input errors and budget limits have explicit statuses. A genuine empty query completes with zero paid events.

### Output and pricing

Each earthquake contains `eventId`, `time` (UTC ISO), `magnitude` (nullable if absent in USGS), `magnitudeType`, `depthKm`, `latitude`, `longitude`, `place`, `status`, `network`, `updatedAt`, `sourceUrl`, `attribution` and `queriedAt`. Negative depth values, where supplied by USGS, are preserved. `status` is the source catalog review status, not a safety assessment. Dataset and summary counters refer only to stored earthquake records.

Each saved earthquake record triggers one `result` event. See the Store pricing tab for the current rate. Status rows, no-match results and invalid inputs have no named result charge. Apify platform usage may apply separately. The Actor checks available result budget before making any external request and before storing each record. With zero result budget it makes no USGS request. The named result event's before/after counter is used because SDK 3.7.2 can aggregate a synthetic dataset event in `chargedCount`.

### Local use

Requires Node.js 22 or later.

```bash
npm ci --ignore-scripts
npm test
LOCAL_MODE=1 OUTPUT_DIR=data INPUT_PATH=input.example.json npm start
```

PowerShell:

```powershell
$env:LOCAL_MODE='1'; $env:OUTPUT_DIR='data'; npm start
```

Local mode writes `dataset.json` and `OUTPUT.json` without an Apify account and does not simulate cloud billing. `npm test` is deterministic and offline. Cloud SDK version is pinned to 3.7.2, with basic-ftp 6.2.3 override.

### Sources and attribution

- [Official USGS FDSN Event API documentation](https://earthquake.usgs.gov/fdsnws/event/1/)
- [Official USGS GeoJSON event fields](https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php)
- [USGS information policies](https://www.usgs.gov/information-policies-and-instructions)

Source: U.S. Geological Survey, Earthquake Hazards Program. No endorsement by USGS is implied. Retain source links and attribution when using or redistributing records. Respect service availability and avoid repetitive catalog polling.

### Use via API

One request runs the Actor, waits for it and returns the dataset items as JSON. Send your token in the `Authorization` header, not in the URL:

```bash
curl -X POST "https://api.apify.com/v2/acts/atesen-software~usgs-earthquake-search/run-sync-get-dataset-items?timeout=120" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startDate":"2024-01-01","endDate":"2024-01-07","minMagnitude":5,"maxResults":20}'
```

The synchronous endpoint waits up to 300 seconds. For longer jobs start a run with `POST https://api.apify.com/v2/acts/atesen-software~usgs-earthquake-search/runs` and read the dataset when it finishes.

**JavaScript** (`npm install apify-client`):

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('atesen-software/usgs-earthquake-search').call({ startDate: "2024-01-01", endDate: "2024-01-07", minMagnitude: 5, maxResults: 20 });
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### Use with AI agents (MCP)

Claude Desktop, Cursor, VS Code and other MCP clients can call this Actor as a tool through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp). Load only this Actor with:

```text
https://mcp.apify.com?tools=atesen-software/usgs-earthquake-search
```

Client config (sign in with Apify OAuth when the browser opens, or add an `Authorization: Bearer <APIFY_TOKEN>` header instead):

```json
{
  "mcpServers": {
    "apify": { "url": "https://mcp.apify.com?tools=atesen-software/usgs-earthquake-search" }
  }
}
```

Then ask in plain words, for example: "List earthquakes of magnitude 5 or more between 1 and 7 January 2024 with place, depth and time." The agent fills the same input fields you see on the Input tab, and runs are billed to your Apify account at the prices on the Pricing tab.

### Related actors

- [Annual Country Indicators: GDP & Population](https://apify.com/atesen-software/world-bank-indicators)
- [EU Fuel Prices: Spain & France Gas Station Prices](https://apify.com/atesen-software/eu-fuel-prices)
- [Canada Job Postings Open Data (Monthly, Salary & NOC)](https://apify.com/atesen-software/canada-job-bank-jobs)

# Actor input Schema

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

Inclusive YYYY-MM-DD; defaults to seven days before today. Maximum window is 366 days.

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

YYYY-MM-DD after the start date. Defaults to today at midnight UTC. USGS may include events exactly on this boundary.

## `minMagnitude` (type: `number`):

USGS lower magnitude filter, from -2 to 10.

## `maxMagnitude` (type: `number`):

USGS upper magnitude filter, from -2 to 10, at least the minimum magnitude.

## `minLatitude` (type: `number`):

Optional bounding box: provide all four coordinates. Range -90 to 90.

## `maxLatitude` (type: `number`):

Greater than south latitude. Range -90 to 90.

## `minLongitude` (type: `number`):

Range -180 to 180. Boxes crossing the antimeridian are unsupported.

## `maxLongitude` (type: `number`):

Greater than west longitude. Range -180 to 180.

## `maxResults` (type: `integer`):

Maximum unique paid catalog records, from 1 to 100.

## `maxRequests` (type: `integer`):

Includes retries. Serial pages contain at most 20 events; maximum five requests.

## Actor input object example

```json
{
  "startDate": "2024-01-01",
  "endDate": "2024-01-02",
  "minMagnitude": 0,
  "maxMagnitude": 10,
  "maxResults": 20,
  "maxRequests": 5
}
```

# Actor output Schema

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

Earthquake records and free status rows

## `summary` (type: `string`):

Query completion and limits

# 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 = {
    "startDate": "2024-01-01",
    "endDate": "2024-01-02"
};

// Run the Actor and wait for it to finish
const run = await client.actor("atesen-software/usgs-earthquake-search").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 = {
    "startDate": "2024-01-01",
    "endDate": "2024-01-02",
}

# Run the Actor and wait for it to finish
run = client.actor("atesen-software/usgs-earthquake-search").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 '{
  "startDate": "2024-01-01",
  "endDate": "2024-01-02"
}' |
apify call atesen-software/usgs-earthquake-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,atesen-software/usgs-earthquake-search"
        }
    }
}
```

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/xrdovQuptxc6tOcCJ/builds/FLiUCqowVcTE687BX/openapi.json
