# USGS Earthquake Data Scraper - Magnitude, Location, Depth (`ahmdshrif/usgs-earthquake-data-scraper`) Actor

Fetches earthquake events from the official USGS FDSN GeoJSON API and exports flat, normalized records with magnitude, location, depth, timing, tsunami and alert data.

- **URL**: https://apify.com/ahmdshrif/usgs-earthquake-data-scraper.md
- **Developed by:** [Ahmed](https://apify.com/ahmdshrif) (community)
- **Categories:** News, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.05 / 1,000 run starteds

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?

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

## USGS Earthquake Data Scraper - Magnitude, Location, Depth

Fetches earthquake events from the official USGS FDSN GeoJSON API and exports flat, normalized records with magnitude, location, depth, timing, tsunami, and PAGER alert data. Built for anyone monitoring seismic activity — researchers, news teams, insurance risk analysts, and developers feeding earthquake alerts into dashboards or apps — who wants clean JSON instead of parsing GeoJSON themselves.

### Why this scraper

- Reads the same official FDSN GeoJSON endpoint that API-based competitors use, so it inherits the source data's full completeness rather than a scraped subset.
- Flattens all 26 available properties into a single-level schema, including station/quality fields (`nst`, `dmin`, `rms`, `gap`) and `sources`/`significance` that many exports leave out.
- Priced at $0.00005 per run regardless of how many events are returned, matching the lowest tier on the store instead of per-result or higher flat-rate pricing for the same or fewer fields.

### Output fields

| Field | Type | Description |
|---|---|---|
| id | string | USGS unique event identifier |
| magnitude | number | Earthquake magnitude |
| magType | string | Magnitude scale used (e.g. md, ml, mww) |
| place | string | Human-readable location description |
| time | string | Event occurrence time, ISO 8601 UTC |
| updated | string | Last update time, ISO 8601 UTC |
| timezone | string | Local timezone offset for the event, if known |
| url | string | USGS event page URL |
| felt | integer | Number of felt reports submitted (DYFI) |
| cdi | number | Maximum reported intensity (Community Decimal Intensity) |
| mmi | number | Maximum estimated instrumental intensity |
| alert | string | PAGER alert level (green, yellow, orange, red) |
| status | string | Review status (automatic or reviewed) |
| tsunami | boolean | Whether a tsunami warning was associated with the event |
| significance | integer | USGS significance score of the event |
| network | string | Contributing seismic network code |
| code | string | Event code assigned by the contributing network |
| sources | string | Comma-separated list of contributing data sources |
| nst | integer | Number of seismic stations used to locate the event |
| dmin | number | Horizontal distance to nearest station in degrees |
| rms | number | Root-mean-square travel time residual |
| gap | number | Largest azimuthal gap between stations in degrees |
| type | string | Event type (earthquake, quarry blast, etc.) |
| title | string | Full summary title of the event |
| longitude | number | Epicenter longitude |
| latitude | number | Epicenter latitude |
| depthKm | number | Depth of the event in kilometers |

### Input

```json
{
  "startUrls": [
    { "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50" }
  ],
  "maxItems": 50
}
```

### Output

```json
{
  "id": "aka2026rxarpv",
  "magnitude": 3,
  "magType": "ml",
  "place": "24 km ENE of Beluga, Alaska",
  "time": "2026-09-09T18:35:04.816000+00:00",
  "updated": "2026-09-09T18:36:03.915000+00:00",
  "timezone": "",
  "url": "https://earthquake.usgs.gov/earthquakes/eventpage/aka2026rxarpv",
  "felt": null,
  "cdi": null,
  "mmi": null,
  "alert": "",
  "status": "automatic",
  "tsunami": false,
  "significance": 138,
  "network": "ak",
  "code": "a2026rxarpv",
  "sources": "ak",
  "nst": 42,
  "dmin": 0.5,
  "rms": 0.7,
  "gap": 43,
  "type": "earthquake",
  "title": "M 3.0 - 24 km ENE of Beluga, Alaska",
  "longitude": -150.672,
  "latitude": 61.243,
  "depthKm": 57.6
}
```

### Pricing

Pay per event: **$0.00005 per Actor run started**, charged once regardless of how many earthquakes the run returns. A typical run pulling 50 events costs $0.00005 total — the same as a run pulling 1 event.

### Use cases

- Feeding a Slack or PagerDuty alert bot that flags any event with `alert` set to "orange" or "red" for a disaster-response team.
- Backfilling a research dataset on regional seismicity by filtering `magnitude`, `depthKm`, and `place` for a specific fault zone over time.
- Powering a live earthquake map widget on a news site using `latitude`, `longitude`, and `title` for the last 50 events.

# Actor input Schema

## `startUrls` (type: `array`):

Pages to export.

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

Stop after this many records.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50"
    },
    {
      "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50&minmagnitude=5"
    },
    {
      "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50&minmagnitude=3"
    }
  ],
  "maxItems": 50
}
```

# Actor output Schema

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

One structured record per input URL.

# 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 = {
    "startUrls": [
        {
            "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50"
        },
        {
            "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50&minmagnitude=5"
        },
        {
            "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50&minmagnitude=3"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ahmdshrif/usgs-earthquake-data-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 = { "startUrls": [
        { "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50" },
        { "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50&minmagnitude=5" },
        { "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50&minmagnitude=3" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ahmdshrif/usgs-earthquake-data-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 '{
  "startUrls": [
    {
      "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50"
    },
    {
      "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50&minmagnitude=5"
    },
    {
      "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=50&minmagnitude=3"
    }
  ]
}' |
apify call ahmdshrif/usgs-earthquake-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ahmdshrif/usgs-earthquake-data-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/wvAfU7MMgtfGYYbfT/builds/BVeysartkwzsIfih2/openapi.json
