Earthquake feed API: recent quakes as JSON
Dashboards, travel agents and incident bots often just need to know whether the ground moved nearby recently. This is a small, filterable feed of USGS events.
The problem
USGS publishes real-time GeoJSON feeds, but they come in fixed buckets (past hour, day, week) and fixed magnitude floors, with all the geometry and metadata of each event. To answer "any magnitude 4.5 or higher within 300 km of Lisbon in the past three days?" you must pick the right feed, filter by time, compute distances and sort.
How /earthquakes answers it
GET /earthquakes accepts minMagnitude (default 4.5), hours (1-168, default 24) and, optionally, lat, lon and radiusKm (default 500). It picks the matching USGS feed, filters by time and distance, and returns events with time, magnitude, place, coordinates, depthKm, a tsunami flag, the USGS PAGER alert level when one exists, the number of felt reports and a link to the USGS event page. Without a location, results are sorted by magnitude, strongest first. With a location they are sorted by distance and include distanceKm. Up to 100 events are returned, and truncated tells you if there were more.
Request and response
Example: magnitude 5 and above in the past 72 hours, worldwide.
$ curl -i "https://skyfeed.imac2014ville.workers.dev/earthquakes?minMagnitude=5&hours=72"
HTTP/2 402
payment-required: eyJ4NDAyVmVyc2lvbiI6Mi4uLn0= # base64 JSON: scheme "exact", network eip155:8453,
# asset USDC, amount 3000 (= $0.003)
# An x402 client signs the payment, then retries with a PAYMENT-SIGNATURE header.
The paid response (abridged to two events at the time of capture):
{
"ok": true,
"query": { "minMagnitude": 5, "hours": 72 },
"count": 12,
"earthquakes": [
{ "time": "2026-10-08T09:00:07.768Z", "magnitude": 6.3, "place": "102 km NE of Norsup, Vanuatu",
"lat": -15.5411, "lon": 168.1889, "depthKm": 10, "tsunami": false, "alert": "green",
"url": "https://earthquake.usgs.gov/earthquakes/eventpage/us6000u0xi" },
{ "time": "2026-10-09T14:49:41.714Z", "magnitude": 5.9, "place": "west of Macquarie Island",
"lat": -60.9758, "lon": 154.4619, "depthKm": 10, "tsunami": false, "alert": "green" }
],
"source": "USGS Earthquake Hazards Program (public domain)"
}
JavaScript with @x402/fetch
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";
const signer = privateKeyToAccount(process.env.PRIVATE_KEY); // wallet holding USDC on Base
const pay = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(signer) }],
});
const res = await pay("https://skyfeed.imac2014ville.workers.dev/earthquakes?minMagnitude=4&hours=72&lat=38.72&lon=-9.14&radiusKm=300");
const { count, earthquakes } = await res.json();
if (count) console.log(earthquakes[0].place, earthquakes[0].magnitude, earthquakes[0].distanceKm);
Pricing
/earthquakes costs $0.003 per call. Planning a trip? /travel-check bundles weather, holidays and nearby quakes for $0.01. There is no API key and no account: each request is paid in USDC on Base over x402. Malformed input returns 400 and failed lookups return a non-2xx status, so those are not charged.
Limitations
- The window is limited to the past 7 days (168 hours), because the underlying USGS summary feeds cover the past hour, day and week.
- The feed is cached for about five minutes and event details are revised by USGS after the fact, especially the first minutes after a large quake.
- This is not an early-warning system. For emergencies follow official USGS and local civil protection channels.
More guides
SkyFeed overview/openapi.jsonllms.txt
Sister services
- BaseLens: Base chain tools: tx explainer, wallet snapshot, x402 endpoint check, web-to-markdown
- DepVet: npm and PyPI package vetting before install
- TokenGuard: honeypot and rug pull checks for Base tokens, plus pre-screened new launches
- MacroLens: country macro statistics and company registries (Norway, France)
- ChainRead: gas, balances, ENS and Basename resolution on Base and Ethereum