Open Astronomy Catalog API v1.0
API usage over the last 7 days:
The Open Astronomy Catalog API (OACAPI) offers a lightweight, simple way to access data available via the Open Astronomy Catalogs (e.g. the Open Supernova, Tidal Disruption, Kilonova, and Fast Stars Catalogs). The API is accessible via a route that works via any of the catalog domains,
where the only difference is preference in catalog when returning items that appear on multiple catalogs. For the examples below we will (usually) use the api.astrocats.space route. By default, all returned values are provided in JSON format, unless a
format= URL variable is provided.
The pattern for the API is one of the domains listed above (e.g.
https://api.astrocats.space) followed by
OBJECT is set to a transient's name,
QUANTITY is set to a desired quantity to retrieve (e.g. redshift),
ATTRIBUTE is a property of that quantity, and the
ARGUMENT variables allow to user to filter data based upon various attribute values. The
ARGUMENT variables can either be used to guarantee that a certain attribute appears in the returned results (e.g. adding
&time&e_magnitude to the query will guarantee that each returned item has a
e_magnitude attribute), or used to filter via a simple equality such as
telescope=HST (which would only return
QUANTITY objects where the
telescope attribute equals
"HST"), or they can be more powerful for certain filter attributes (examples being
dec for performing cone searches).
Key names that are usable in API calls can be found in the OAC schema. Below, we provide some example queries that demonstrate the API's capabilities.
There are a few arguments that have special meaning and are only a part of the API, not the schema:
closest: Return the quantities with the closest value to the specified attributes. If multiple attributes are specified, the closest to each will be returned (e.g.,
magnitude=15&time=56789&closestwould return both the observation with magnitude closest to 15 and time closest to 56789.
complete: Return only quantities containing all of the requested attributes.
first: Return only the first of each of the listed quantities.
format=x: Return data in the specified format
x, currently supports
tsv. Any other format specification will return
item=n: Return only the
nth item of each of the listed quantities.
radius=r: Return objects within a distance
r(in arcseconds) of a given set of
deccoordinates. Note that this disables exact matches for
width=w: Return objects within a distance
w(in arcseconds) of a given
ravalue (for box searches).
height=h: Return objects within a distance
h(in arcseconds) of a given
decvalue (for box searches).
sortby=s: Sort the returned array by the attribute
s(only works when returning results in
Return basic information about the API service (and a link back to this README)
Return all objects within a 2" cone about a set of coordinates
Return all supernova metadata in CSV format
By default, queries such as the two above will return the catalog entries for objects that satisfy the search conditions. To return data from a specific catalog when searching by a criterion such as position, the user should insert
catalog/ into the URL before the rest of the query of the specific catalog they are interested in, as shown in the example below:
Redshifts of all supernovae with a redshift reported within 5° of a coordinate, in CSV format
If the user instead wishes to return info on all objects across all catalogs, the
all/ route should be used instead (any URL can be used with this route):
Redshifts of all objects with a redshift reported within 5° of a coordinate, in CSV format
Individual object queries can return more-detailed information about each object, including datafiles such as spectra. Below, we show some examples of this in action:
Get the available redshift values for an object
Select the first (preferred) value of the redshift
https://api.astrocats.space/SN2014J/redshift?first, or https://api.astrocats.space/SN2014J/redshift?item=0
Return all photometric observations with at least one of the
Return the above in CSV format
Only return observations that contain all requested attributes
Sort the returned photometry by magnitude
Return observations for multiple objects at once, in CSV format
Return only observations whose attributes include the listed keys (
Return only observations matching given criteria, in this case band = B
In the following example, we filter upon the
claimedtype, but note that this filters
lumdist as well, since the
value filter applies to both:
Luminosity distances and claimed types of all objects with luminosity distance and claimed type equal to Ia (probably not what you intend!)
Note that the above returns an empty result. Instead, we want to do:
Luminosity distances and claimed types of all objects with an available luminosity distance and "Ia" listed as a type, in TSV format
Regular expressions are also supported in the
ARGUMENT fields, allowing users to perform more sophisticated matches to attribute values:
Claimed types of all objects with a typing that has a prefix matching "Ia-", in TSV format
Note that many regular expression symbols must be URL-encoded to be passed properly to the API.
Return the spectrum closest to the listed MJD
catalog/ route (combined with filtering) can also return data from the individual object files if data isn't contained within the main OAC catalog files (i.e. the data that is visible on the main pages of the Open Supernova Catalog, etc.). Because these queries are expensive (the full dataset must be loaded for each object), they have some numeric limits to prevent overloading the server.
Return all photometry in a 2" radius about a coordinate, in CSV format
Return the instruments used to produce spectra within a 5° of a given coordinate, in CSV format