Science & Math — entry 026 of 28
USGS Earthquake Hazards Program
The USGS Earthquake Hazards Program's FDSNWS Event Web Service is a keyless REST API for querying the agency's global earthquake catalog by region, time window, magnitude, or depth, returning real-time and historical seismic event data. Requests default to QuakeML XML but can also return GeoJSON, CSV, or KML via a format parameter, and the whole service is free and unauthenticated, run directly by the federal government.
The USGS Earthquake Hazards Program's FDSNWS Event Web Service is a keyless REST endpoint over the agency's real-time and historical earthquake catalog. A single `/query` route answers everything — filter by time, region, magnitude, or depth via query parameters, and pick the response shape with `format`, which defaults to QuakeML XML if you don't set it.
GreatAPIs Score
Auth quickstart
- No account or key is required — every request below is a public, unauthenticated GET, reconfirmed live this run.
Your key is stored only in this browser (localStorage) and sent directly to the API — never to greatapis.
Fetch the most recent earthquake as GeoJSON
GEThttps://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=1
{"type":"FeatureCollection","metadata":{"generated":1785107298000,"url":"https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&limit=1","title":"USGS Earthquakes","status":200,"api":"2.7.0","limit":1,"offset":1},"features":[{"type":"Feature","properties":{"mag":1.2,"place":"21 km SSE of Chickaloon, Alaska","time":1785106968924,"updated":1785107037987,"tz":null,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/aka2026osgqai","detail":"https://earthquake.usgs.gov/fdsnws/event/1/query?eventid=aka2026osgqai&format=geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":22,"net":"ak","code":"a2026osgqai","ids":",aka2026osgqai,","sources":",ak,","types":",origin,phase-data,","nst":10,"dmin":0.2,"rms":1,"gap":63,"magType":"ml","type":"earthquake","title":"M 1.2 - 21 km SSE of Chickaloon, Alaska"},"geometry":{"type":"Point","coordinates":[-148.321,61.616,5]},"id":"aka2026osgqai"}]}Captured byte-for-byte from this run's live probe, no truncation — the single returned event (a magnitude 1.2 near Chickaloon, Alaska) is whichever quake was most recent in the USGS catalog at probe time, not a curated pick.
Developer reference
https://earthquake.usgs.gov/fdsnws/event/1Gotchas & limits
- `format` defaults to QuakeML XML, not JSON — confirmed live this run: the same `/query?limit=1` call with no `format` parameter returned `content-type: application/xml; charset=utf-8` and a `<q:quakeml>` document instead of JSON. Always set `format=geojson` (or another explicit value) rather than relying on the default.
- An invalid `format` value doesn't silently fall back — it returns a real HTTP 400 with a plain-text body naming every accepted value. Confirmed live this run with `format=bogus`: `Error 400: Bad Request / Bad format value "bogus". Valid values are: "quakeml", "geojson", "csv", "kml", "kmlraw", "xml", "text", "cap".`
- CORS is wide open: a live probe with `Origin: https://example.com` returned `access-control-allow-origin: *` on the same GeoJSON query, alongside `access-control-allow-methods: GET, OPTIONS` — safe to call directly from browser JS.
- A separate `/count` route (not `/query`) answers just the match total as plain text, no JSON wrapper — confirmed live this run: `GET /count?format=text&starttime=2026-07-01&endtime=2026-07-26` returned a bare `8849` body. Use it instead of paging through `/query` just to size a result set.
- Filters compose as expected on `/query`: a live probe with `minmagnitude=6&orderby=time` returned only magnitude-6-or-greater events sorted by time, confirming both parameters are honored together rather than one silently overriding the other.