Endpoint: earthquakes

The earthquake data set provides information on US and international earthquakes, including location, mangnitude, depth and more.

https://api.aerisapi.com/earthquakes/

Data CoverageGlobal

Included With API Developer,  API Premium

Supported Actions

The following actions are supported with the earthquakes endpoint:

:id Requesting data by using the :id action is used for returning data for a particular item that has an ID associated with it. This is the primary method for requesting general weather information for a single location (observations, forecasts, advisories, etc.) as the location's name or a zip code serves as the id. Other endpoints may expect a certain value for the ID, such as storm cells whose ID value is a combination of the radar site identifier and unique identifier assigned to every storm cell. Refer to an enpoint's detailed documentation for specific information regarding how to use the :id action.
closest The closest action will query the API for data that is closest to the requested place and return the results, if any, in order from closest to farthest. If no limit is provided in the request, then only the closest single result will be returned.

If your request does not return results, you may try setting or increasing the radius being used.
within The within action allows for returning data within a variety of different geometrical regions. Currently supported geometries include a circle (requires a center point and radius), square (requires two coordinate points defining the top-left and bottom-right corners) and polygon (requires at least three coordinate points). Unlike the closest action, the results will not be returned in any particular order based on distance.
search The search action is used as a more general query method and expects the query to be defined with the custom query for the request. Unlike the closest action, results will not be returned in any particular order.
affects The affects action requests all places affected by a particular type of event, such as earthquake or storm cell. The query for places affected is unique for each endpoint it belongs to and can be a polygon (e.g., storm cell forecasts or warnings) or a circle with the center being the location of the event (e.g., earthquakes or fires). Instead of returning an array of objects specific to the endpoint, the affects action will always return an array of place objects in the same format as the within action on the places endpoint.

Note: Not all endpoints support this action, so refer to each endpoint's complete documentation to determine if supported and its usage.

Supported Parameters

The following parameters are options unless otherwise noted:

p p=:place Defines the location to query data for. Refer to the list of supported place value formats.
limit limit=:total The total number of results to return as an integer. Each endpoint may have a set maximum for this value depending on usage.

The default limit is 1 if not specified.
filter filter=:string Predefined filters for limiting the results. The filter value can be a single, comma-delimited or a semicolon delimited string of filter names.
query query=:string Used to filter results based on certain fields in the data set. See Advanced Queries for more details.
radius radius=:distance:unit When requesting the closest results within a circle, the radius determines how far from the specified location to search. A valid unit value must be included in your radius value, e.g., "5mi", "10km", "50miles". If no unit is provided, your value is assumed to be in meters by default.

The default radius is 50 miles if not specified within the endpoint description.
sort sort=:string Used to sort results based on certain fields in the data set. See Sorting for more details.
callback callback=:functionName Used with JSONP implementation.

Defines the callback function to use for the response. The response will be enclosed as C(response), where C is the callback function provided.
fields fields=:string Provides a comma separated list of values for the API to return. This parameter is often used to limit the amount of data returned. See Reducing Output.
from from=:string Returns the results starting form the value specified.

Supports a UNIX timestamp or a specific date string. Alternatively, common date formats supported by the PHP strtotime() function will be accepted; however, commas are not accepted.

Examples:
from=tomorrow
from=friday
from=1302883980
from=7/10/2011
from=2011/07/10
from=+2hours
from=2017-02-27 5:00 PM
to to=:string Returns the results between now and the value specified. When used in conjunction with the from parameter, the value of to will be relative to the value of from, not relative to the current time.

Supports a UNIX timestamp or a specific date string. Alternatively, common date formats supported by the PHP strtotime() function will be accepted; however, commas are not accepted.

Examples:
to=+6hours
to=+5days
to=1302883980
to=7/10/2011
to=2011/07/10
to=2017-02-27 5:00 PM
skip skip=:number Used to skip over a specific number of results in the data set.

Supported Filters

The following filters can be passed to the filter parameter to reduce the results that are returned:

mini Return earthquakes with a magnitude of less than 3.0
minor Return earthquakes with a magnitude between 3.0 and 3.9
light Return earthquakes with a magnitude between 4.0 and 4.9
moderate Return earthquakes with a magnitude between 5.0 and 5.9
strong Return earthquakes with a magnitude between 6.0 and 6.9
major Return earthquakes with a magnitude between 7.0 and 7.9
great Return earthquakes with a magnitude of 8.0 or greater
shallow Return earthquakes with a depth of less than 70km

Supported Query Properties

Use the following supported property keys when creating custom queries for your requests:

id Query on the USGS earthquake ID.
mag Query based on the magnitude of the earthquake.
depth Query based on the depth of the earthquake in kilometers.
state Query based on the state the earthquake occurred.
name Query based on the location name of where the earthquake occurred.
country Query based on the country the earthquake occurred.

Sortable Fields

You can use the following fields to sort the data returned in your response:

dt Sort based on the date/time of the earthquake.
id Sort based on the USGS earthquake ID.
mag Sort based on the earthquake magnitude.
depth Sort based on the earthquake depth.
state Sort based on the state that the earthquake occurred in.
name Sort based on the name of the closest location to the earthquake.
country Sort based on the country the earthquake occurred.
region Sort based on the general region of the earthquake.

Examples

Return closest/nearby earthquake to the specified location.
/earthquakes/closest?p=74640

Returns all earthquakes within a rectangle defined by the coordinates specified in the point parameter. The points should be: top latitude, left longitude, bottom latitude, right longitude.
/earthquakes/within?p=:top,:left,:bottom,:right
/earthquakes/within?p=45.25,-95.25,35.25,-85.25

Returns all earthquakes within a circle with its center at the specified latitude/longitude point and a radius distance from that center.
NOTE: This functionality is similar to the closest search, but does not include a distance or sorting. It is a faster query.
/earthquakes/within?p=:lat,:lon&radius=:distance
/earthquakes/within?p=44,-93&radius=25miles

Response

The following is an example of what each object in the response will consist of. Depending on your requested action, the response may contain multiple instances of this object within an array.


{
  "loc": {
    "long": -97.7082,
    "lat": 36.6157
  },
  "report": {
    "id": "us10002cjn",
    "timestamp": 1432733579,
    "dateTimeISO": "2015-05-27T08:32:59-05:00",
    "mag": 2.6,
    "type": "mini",
    "depthKM": 6.113,
    "depthMI": 3.8,
    "region": "21km S of Medford, Oklahoma",
    "location": "21km S of Medford, Oklahoma"
  },
  "place": {
    "name": "town of hunter",
    "state": "ok",
    "country": "us"
  },
  "profile": {
    "tz": "America/Chicago"
  },
  "relativeTo": {
    "lat": 36.56364,
    "long": -97.66116,
    "bearing": 324,
    "bearingEng": "NW",
    "distanceKM": 7.152,
    "distanceMI": 4.444
  }
}
								

Response Properties

The following properties will be provided in every response object:

report.id (string) The USGS earthquake ID.
report.timestamp (number) UNIX timestamp when the event took place.
report.dateTimeISO (string) ISO 8601 date of the date/time of the event.
report.mag (number) The magnitude of the earthquake.
report.type (string) The earthquake category:
- mini: 0 - 2.9
- minor: 3 - 3.9
- light: 4 - 4.9
- moderate: 5 - 5.9
- strong: 6 - 6.9
- major: 7 - 7.9
- great: 8.0+
report.depthKM (number) The depth of the earthquake in kilometers.
report.depthMI (number) The depth of the earthquake in miles.
report.region (string) The USGS region that the event occurred.
report.location (string) The brief description of the location, usually contains the location or relative distance from a city.
loc.long (number) The longitude coordinate of the record.
loc.lat (number) The latitude coordinate of the record.
place.name (string) The place or nearest place to the record.
place.state (string) The state abbreviation in which the record is located. This may be null depending on the country.
place.country (string) The country abbreviation in which the record is located.
profile.tz (string) The timezone name association with the record's location.
relativeTo.lat (number) Latitude coordinate of the location used for the request. This may be different than the record's loc.lat value if there was no record exactly at the request location.
relativeTo.long (number) Longitude coordinate of the location used for the request. This may be different than the record's loc.long value if there was no record exactly at the request location.
relativeTo.bearing (number) Bearing in degrees of the record's location relative to the location used for the request.
relativeTo.bearingEng (string) Cardinal direction of the record relative to the location used for the request.
relativeTo.distanceKM (number) Distance, in kilometers, from the requested location to the record's actual location.
relativeTo.distanceMI (number) Distance, in miles, from the requested location to the record's actual location.