USGS Earthquake Hazards Program API

Beginner's Pick Science & Math / No Auth Required Beginner HTTPS
Free to Use
84 A
Measured Score 0 50 100 Speed 21/30 Consistency 20/20 Security 20/20 Browser access 15/15 Transparency 8/15 TESTED 2026-08-10

Overview

The USGS Earthquake Hazards Program API provides real-time and historical earthquake data from seismic monitoring stations around the world. You can query earthquakes by location, magnitude, and time range without any API key or registration. It is an excellent API for learning to work with geospatial data and building earthquake alert or visualization tools.

Beginner Tip

Start with the GeoJSON feed format — it is the most beginner-friendly output and works directly with mapping libraries like Leaflet. Try the query endpoint with a minimum magnitude filter to start with a manageable number of significant events.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=2024-01-01&endtime=2024-01-07&minmagnitude=5
Result
HTTP 200 · application/json · 20,567 bytes · compressed
Response time
144 ms (median of 3) · fastest 139 ms
Transport
TLSv1.3 · TLS_AES_128_GCM_SHA256 · certificate issued by DigiCert Inc
Browser CORS
Allowed — Access-Control-Allow-Origin: *
Served by
nginx
Recorded
2026-08-10

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
type string FeatureCollection
metadata object {6 fields}
features array [1 item]
bbox array [1 item]

Captured Response

Captured from a real request to https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=2024-01-01&endtime=2024-01-07&minmagnitude=5 on 2026-08-10. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "type": "FeatureCollection",
  "metadata": {
    "generated": 1786391608000,
    "url": "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=2024-01-01&endtime=2024-01-07&minmagnitude=5",
    "title": "USGS Earthquakes",
    "status": 200,
    "api": "2.7.0",
    "count": 28
  },
  "features": [
    {
      "type": "Feature",
      "properties": {
        "…": "(26 more fields)"
      },
      "geometry": {
        "…": "(2 more fields)"
      },
      "id": "us6000m27f"
    }
  ],
  "bbox": [
    -176.5067
  ]
}

Field Reference

features GeoJSON array of earthquake event objects matching the query filters.

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=2024-01-01&endtime=2024-01-07&minmagnitude=5";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

How This API Fails

We deliberately sent this API a broken request and recorded exactly what came back on 2026-08-10. Knowing the shape of an error before you hit it makes error handling much easier to write.

HTTP 404 Requesting a path that does not exist text/html

Returned an HTML error page rather than JSON — worth knowing if your client assumes every response can be parsed as JSON.

HTTP 400 Sending an invalid value for "format" text/plain
Error 400: Bad Request

Bad format value "!!!invalid!!!". Valid values are: "quakeml", "geojson", "csv", "kml", "kmlraw", "xml", "text", "cap".

Usage details are available from https://earthquake.usgs.gov/fdsnws/event/1

Request:
/fdsnws/event/1/query?format=%21%21%21invalid%21%21%21&starttime=

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

400 Bad Request — time range too large Requesting data without a time range limit can return millions of records which the API rejects.
Always specify both starttime and endtime parameters; limit your range to a few days and use minmagnitude to reduce result size.
No features in response No earthquakes matched the combination of filters you provided.
Broaden your filters by lowering minmagnitude or expanding the time range; try removing location filters first to confirm data exists.
Slow response time Very broad queries with low magnitude thresholds can match thousands of small earthquakes worldwide.
Add minmagnitude=2.5 or higher and restrict the geographic area using latitude/longitude bounding box parameters to speed up responses.

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 21/30
Consistency 20/20
Security 20/20
Browser access 15/15
Transparency 8/15
Endpoint Response Time 144ms

Fully tested on Aug 10, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS NO
Category Science & Math
Difficulty Beginner
Endpoint last called: 2026-08-10

Related Tags

Similar APIs

View All →