# USGS Earthquakes — Real-Time & Historical (`scrapeworks/usgs-earthquakes`) Actor

Get real-time and historical earthquake data from the official USGS feed. Clean JSON with magnitude, location, depth, tsunami flags, alert levels, and a magnitude class. Filter by time, magnitude, or region.

- **URL**: https://apify.com/scrapeworks/usgs-earthquakes.md
- **Developed by:** [Nicolas van Arkens](https://apify.com/scrapeworks) (community)
- **Categories:** News, Open source
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.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.

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

## USGS Earthquakes — Real-Time & Historical 🌎

Get **real-time and historical earthquake data** from the official **USGS Earthquake Hazards Program** as clean, structured JSON. Each event comes with magnitude (and a human-readable class — Micro / Minor / Light / Moderate / Strong / Major / Great), location, depth, tsunami flag, alert level, felt reports, and intensity measures.

Use the standard USGS summary feeds (significant events of the past week, M4.5+ of the past month, etc.) or build custom queries with time, magnitude, and bounding-box filters.

### Why use it

- ⏱️ **Real-time and historical** — pull live feeds or query any date range
- 📏 **Magnitude classification** — readable class labels alongside the raw number
- 🌐 **Split coordinates** — latitude, longitude, depth as separate fields (USGS bundles them in an array)
- 🕐 **Normalized timestamps** — clean ISO 8601 UTC (USGS uses epoch milliseconds)
- 🌊 **Full event detail** — tsunami flag, alert level (green/yellow/orange/red), felt reports, CDI, MMI, significance
- 🎯 **Flexible filters** — by time, magnitude range, or geographic bounding box

### Use cases

- **News & journalism** — monitor significant events as they happen
- **Risk analysis** — insurance, infrastructure, construction
- **Research & datasets** — historical seismic data for academic work
- **Alerts & automation** — feed into Slack, email, or webhook pipelines
- **Visualizations & dashboards** — live event maps and trend charts

### Input

| Field | Description |
|-------|-------------|
| **Mode** | `summary` (standard pre-built feeds, fastest) or `query` (custom filters). |
| **Summary feed** | Which USGS summary feed (in summary mode). |
| **Start / end time** | ISO date or datetime bounds (query mode). |
| **Min / max magnitude** | Magnitude range filter (query mode). |
| **Bounding box** | min/max latitude and longitude (query mode). |
| **Maximum events** | Cap on results (USGS caps queries at 20,000). |

### Output

```json
{
  "id": "us7000abcd",
  "magnitude": 6.4,
  "magnitudeClass": "Strong",
  "magnitudeType": "mww",
  "place": "10 km E of Anchorage, Alaska",
  "time": "2024-06-09T02:26:40+00:00",
  "updated": "2024-06-09T03:00:00+00:00",
  "latitude": 61.3,
  "longitude": -149.6,
  "depthKm": 35.0,
  "tsunamiFlag": true,
  "alertLevel": "yellow",
  "feltReports": 423,
  "cdi": 5.8,
  "mmi": 6.1,
  "significance": 750,
  "eventType": "earthquake",
  "status": "reviewed",
  "url": "https://earthquake.usgs.gov/earthquakes/eventpage/us7000abcd"
}
````

Export to JSON, CSV, or Excel, or pull via the Apify API. Connect to Slack, Sheets, or webhook pipelines for live alerts.

### Notes

- Uses the official public USGS Earthquake Hazards Program feed. Independent tool, not affiliated with USGS or the US Geological Survey.
- Data is provided by USGS under their [terms of use](https://www.usgs.gov/laws/policies_notices.html).

# Actor input Schema

## `mode` (type: `string`):

Use 'summary' for the standard USGS pre-built feeds (significant, magnitude thresholds, hour/day/week/month) — the fastest option. Use 'query' for custom filtering by time, magnitude range, or geographic bounding box.

## `summaryFeed` (type: `string`):

Which USGS summary feed to fetch. 'significant\_week' is a reliable always-non-empty default.

## `startTime` (type: `string`):

Earliest event time (ISO date or datetime, e.g. '2025-01-01' or '2025-01-01T00:00:00'). Only used in query mode.

## `endTime` (type: `string`):

Latest event time (ISO date or datetime). Only used in query mode.

## `minMagnitude` (type: `string`):

Lower bound on event magnitude (e.g. '4.5'). Only used in query mode.

## `maxMagnitude` (type: `string`):

Upper bound on event magnitude (e.g. '7.0'). Only used in query mode.

## `minLatitude` (type: `string`):

Southern boundary of geographic bounding box (decimal degrees, e.g. '35.5'). Query mode.

## `maxLatitude` (type: `string`):

Northern boundary of geographic bounding box (decimal degrees, e.g. '42.0'). Query mode.

## `minLongitude` (type: `string`):

Western boundary of bounding box (decimal degrees, e.g. '-125.3'). Query mode.

## `maxLongitude` (type: `string`):

Eastern boundary of bounding box (decimal degrees, e.g. '-115.0'). Query mode.

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

Maximum number of events to return (USGS caps queries at 20,000).

## Actor input object example

```json
{
  "mode": "summary",
  "summaryFeed": "significant_week",
  "maxItems": 1000
}
```

# 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 = {};

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

# Run the Actor and wait for it to finish
run = client.actor("scrapeworks/usgs-earthquakes").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 '{}' |
apify call scrapeworks/usgs-earthquakes --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "USGS Earthquakes — Real-Time & Historical",
        "description": "Get real-time and historical earthquake data from the official USGS feed. Clean JSON with magnitude, location, depth, tsunami flags, alert levels, and a magnitude class. Filter by time, magnitude, or region.",
        "version": "0.1",
        "x-build-id": "Ce6ecPuYg9FOlNuTI"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapeworks~usgs-earthquakes/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapeworks-usgs-earthquakes",
                "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/scrapeworks~usgs-earthquakes/runs": {
            "post": {
                "operationId": "runs-sync-scrapeworks-usgs-earthquakes",
                "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/scrapeworks~usgs-earthquakes/run-sync": {
            "post": {
                "operationId": "run-sync-scrapeworks-usgs-earthquakes",
                "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": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "summary",
                            "query"
                        ],
                        "type": "string",
                        "description": "Use 'summary' for the standard USGS pre-built feeds (significant, magnitude thresholds, hour/day/week/month) — the fastest option. Use 'query' for custom filtering by time, magnitude range, or geographic bounding box.",
                        "default": "summary"
                    },
                    "summaryFeed": {
                        "title": "Summary feed",
                        "enum": [
                            "significant_hour",
                            "significant_day",
                            "significant_week",
                            "significant_month",
                            "4.5_hour",
                            "4.5_day",
                            "4.5_week",
                            "4.5_month",
                            "2.5_day",
                            "2.5_week",
                            "2.5_month",
                            "1.0_day",
                            "1.0_week",
                            "all_hour",
                            "all_day",
                            "all_week"
                        ],
                        "type": "string",
                        "description": "Which USGS summary feed to fetch. 'significant_week' is a reliable always-non-empty default.",
                        "default": "significant_week"
                    },
                    "startTime": {
                        "title": "Start time (query mode)",
                        "type": "string",
                        "description": "Earliest event time (ISO date or datetime, e.g. '2025-01-01' or '2025-01-01T00:00:00'). Only used in query mode."
                    },
                    "endTime": {
                        "title": "End time (query mode)",
                        "type": "string",
                        "description": "Latest event time (ISO date or datetime). Only used in query mode."
                    },
                    "minMagnitude": {
                        "title": "Minimum magnitude (query mode)",
                        "type": "string",
                        "description": "Lower bound on event magnitude (e.g. '4.5'). Only used in query mode."
                    },
                    "maxMagnitude": {
                        "title": "Maximum magnitude (query mode)",
                        "type": "string",
                        "description": "Upper bound on event magnitude (e.g. '7.0'). Only used in query mode."
                    },
                    "minLatitude": {
                        "title": "Min latitude (query mode)",
                        "type": "string",
                        "description": "Southern boundary of geographic bounding box (decimal degrees, e.g. '35.5'). Query mode."
                    },
                    "maxLatitude": {
                        "title": "Max latitude (query mode)",
                        "type": "string",
                        "description": "Northern boundary of geographic bounding box (decimal degrees, e.g. '42.0'). Query mode."
                    },
                    "minLongitude": {
                        "title": "Min longitude (query mode)",
                        "type": "string",
                        "description": "Western boundary of bounding box (decimal degrees, e.g. '-125.3'). Query mode."
                    },
                    "maxLongitude": {
                        "title": "Max longitude (query mode)",
                        "type": "string",
                        "description": "Eastern boundary of bounding box (decimal degrees, e.g. '-115.0'). Query mode."
                    },
                    "maxItems": {
                        "title": "Maximum events",
                        "minimum": 1,
                        "maximum": 20000,
                        "type": "integer",
                        "description": "Maximum number of events to return (USGS caps queries at 20,000).",
                        "default": 1000
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
