Earthquakes
Earthquakes worldwide from the USGS catalogue (minutes after they happen, back to the 1900s): id, magnitude and type, place, time, position, depth, PAGER alert, tsunami flag, significance, felt reports, intensity (CDI, MMI), review status, network and link. Filter by dates (default last 7 days), magnitude, depth, alert level and distance from a place or a latitude/longitude rectangle (bbox); sort by time or magnitude. Pass next_page back as page; null on the last page.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
start_date | string | From (YYYY-MM-DD, default 7 days before end_date). |
end_date | string | To (YYYY-MM-DD, default today). |
min_magnitude | number | Minimum magnitude (default 2.5 without a location). Example: 5 |
max_magnitude | number | Maximum magnitude. |
min_depth_km | number | Minimum depth in km. |
max_depth_km | number | Maximum depth in km. |
alert | green | yellow | orange | red | PAGER alert level. |
lat | number | Latitude of a centre point (with lon and radius_km); or use q / postal_code. |
lon | number | Longitude. |
q | string | Place name for the centre point, e.g. Tokyo, Los Angeles. |
postal_code | string | Postal code for the centre point, with country. |
country | string | Country for q / postal_code. |
radius_km | number | Radius around the place in km (default 300). |
sort | newest | oldest | magnitude | magnitude-asc | newest (default), oldest, magnitude, magnitude-asc. |
limit | integer | Per page (default 100, max 1000). |
page | integer | Page (default 1). |
bbox | string | Rectangle to search: min_lat,min_lon,max_lat,max_lon, e.g. 30,-125,50,-110 (instead of a centre point and radius). |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/hazards/v1/earthquakes" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/hazards/v1/earthquakes",
params={},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/hazards/v1/earthquakes");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).