Many MAST data holdings can be searched using the MAST Discovery Portal API.
This API allows for programmatic access to all
data available through the MAST Discovery Portal (mast.stsci.edu).
API documentation is found at https://mast.stsci.edu/api.
MAST data holdings can also be searched
using MAST classic HTTP GET requests. The GET request
allows the search parameters to be included in the URL.
As such, they can be called from within programs to automate data
searches. The results can be returned in a variety of formats including
HTML, VOTable XML format, excel spreadsheet, and
comma-separated values which can simplify ingesting results into
user-written programs. In addition, submitting GET requests can
bypass restrictions currently placed on the web search
forms (e.g., restrictions on the max_records value).
Unfortunately, there has been little
documentation on how the GET requests are formulated.
This document will summarize the services currently available
from MAST and give examples showing how they can be used.
Remember, when creating URLs, special characters must
URLs may only use alphanumerics [0-9a-zA-Z], the characters
"$-_.+!*'()," and special reserved characters.
The characters "<" and ">" must be specified as "%3C" and "%3E"
respectively. For example, to specify a parameter such as
RA > 120, the GET request parameter would be RA=%3E120. Blanks
can be specified using the "+" character. Nulls can be specified
Scripts for retrieving MAST search results can be written
in many programming languages. Basically you just need to
download and extract information from a web page.
A few simple examples are shown below. We welcome more examples
where [data set] is the MAST-defined acronym for a particular
set of data (listed below), and params is the list of search
parameters as defined below. This does not apply to Kepler or K2 however so
the correct values for [data set] are shown in parentheses below.
Note that "action=Search" is a required parameter for all mission search requests.
For the pointings search however, action may equal either "Search+Pointings"
The current list of data sets, links to mission-specific search fields, and
search general parameters are shown in the following list:
In general, any parameter listed on the HTML search
form can be specified in a GET request. If you are parsing
the results, it would be easier and probably faster, to request
the search results in CSV or VOTable format using the "outputformat" parameter.
Mission search examples:
Search the HST archive for observations within the specified radius
(in arcminutes), centered on the given RA and Dec values (in decimal
degrees), allow a maximum of 1000 records, and output the default columns
as comma-separated values:
Search the Kepler archive for the first 1000 files (sorted by Kepler ID) that have become public in 2009, that was part of the
EX program, and output comma-separated values with RA in decimal hours:
Do similiar cone search for XMM-OM data with a search radius of 5 arcminutes
show sql query, sexigesimal coordinates, and output results in HTML (this type of request
is good for testing)
Search the Kepler/GALEX cross match catalog for nuvg_color values between 0.0 and 0.5.
Use the kggoldstandard version for more accurate matches.
Search the Kepler target search form for entries where fuvnuv is not null,
the number of seasons on CCD = 4, and the effective temperature is > 10,000.
Search the Kepler Objects of Interest table for confirmed planets. Return all (139) columns
(i.e., not just defaults) with coordinates in decimal degrees and output in pipe-separated format
(note some columns contains commas, so don't use CSV format):
Search the EPIC table for the top 100 extended sources (by EPIC id)
and remove any null columns.
Search the HST archive for pep_id 9293, allow a maximum of 1000 records, and output results
as comma-separated values:
Search HST as above, but return results in VOTable format
Search the HSC summary table for matchid < 20, return all non-null columns in VOTable format
Search HUT database for observations of M81 and M31, and return only columns for target name and data id:
Search for HST ACS data taken with the F814W filter and within the specified search area.
Return up to 5000 records containing data set name, RA and Dec in CSV format.
Search the ACS Pointings table for the target "M 81" with output format = "CSV",
and greater than 2 exposures in the U band:
Be sure to include "action=Search" (with capital S) in the mission searches,
but not for SCS or SIAP requests.
Parameter order is not important.
For HST searches, sci_aec is set to "S" by default.
This will return Science (S) but not Calibration (C) data.
If both are desired, add the param sci_aec=%.
Use a comma separated list for selected columns with the
selectedColumnsCsv parameter, and specify all column names in lower case.
Don't use selectedColumnsList as seen from the search form.
Parameters such as resolver=don'tresolve should probably
be encoded to be resolve=don%27tresolve. It seems to work without it
though. (See PHP command called urlencode).
There is currently a 300 second execution time limit on archive.stsci.edu
which can cause large search requests to abort. Contact MAST if you run
into this problem.
Specifying an output format to download results as a file (e.g., outputformat=CSV_File)
may avoid browser memory limitations that could cause a large request to fail.
This however may require user-interaction.
MAST missions can also be searched using the
Simple Cone Search protocol (SCS).
The base url is the same as for MAST mission searches
without the "action=Search" parameter.
The search radius parameter "SR" must be included in the URL
for the cgi script to recognize a simple cone search is being requested.
Besides the search radius in decimal degrees, RA and DEC parameters are also
required to perform a cone search. The results are returned in VOTable format.
The SCS protocol can be used with any MAST mission and the
general MAST parameters can be included as well.
Find archived Kepler observations at RA,Dec = 290.985,43.388 and a search radius = 0.02 degrees
(Note not all listed data sets may be public, see release date field.)
To search the Hubble Source Catalog (HSC) Summary table at RA,Dec = 53.084,-27.873
with a search radius = 0.01 degrees (returns about 200 entries)
To do the same search on the HSC Detailed Search, use:
This example will return about 50 HST observations (in VOTable format) at RA,Dec = 53.084,-27.873
and a search radius = 0.01 degrees
Same as above except use a larger search radius (0.02) but only allow a maximum of
100 records to be returned
To find all high level science products at the same coordinates:
Many MAST missions and High Level Science Products (HLSPs)
can also be searched using the
Simple Image Access protocol (SIAP).
The base URL is https://archive.stsci.edu/siap/search.php
followed by the SIAP parameters.
There are two exceptions. Tthe HST Press Release images SIAP service
which has a base url:
and the GOODS cutout service which has the base url:
By default, up to 2000 entries will
be returned but specifying max_records=nnn can override the default.
Adding the parameter "representative=y" will return only "representative"
images as defined for the MAST scrapbook tool.
Note some missions and particularly HLSPs, cover small areas of the sky.
Currently the list of instruments, and
High Level Science Products (HLSPs) that can be queried using the SIAP
WFPC - HST Wide Field Planetary Camera
WFPC2 - HST Wide Field Planetary Camera 2
NICMOS - HST Near Infrared Camera and Multi Object Spectrometer
STIS - Space Telescope Imaging Spectrograph
FOC - HST Faint Object Camera
ACS - HST Advance Camera Survey
UIT - Ultraviolet Imageing Telescope
VLA-FIRST - VLA Faint Images of the Radio Sky at 20 cm
Find WFPC2 observations at RA,Dec = 53.084,-27.873, format = GIF,
and a rectangular search area 0,05 degrees wide:
Find "representative" WFPC2 observations as above:
Search for data from the HIPPIES HLSP:
Create cutouts from the GOODS HLSP images at ra,dec of 189.194,62.159
with a width of about 4":
MAST spectral missions can now be searched using the VO
Simple Spectral Access Protocol (SSAP). It is similiar to the
SIAP standard in that it returns a VOTable-format file with links to
(spectral) data sets. Note the MAST SSAP services, like the SIAP and cone search
services, were written using VOTable version 1.0 and are now (hopefully)
updated to version 1.1. The latest VOTable standard however is version 1.3.
All the VO standards (e.g., VOTable, SSAP, SIAP, etc.) evolve independently.
The current list of missions with SSAP services include:
hst (to include all instruments)
The SSAP standard itself has evolved over the last several years,
and the MAST services have not been updated for ahwhile.
There were 2 main versions
implemeted so far:
The original standard, known as version 0.4 in the VAO registry,
was never officially approved
but was adopted by several data centers before the official version
We were supporting SSAP version 0.4 services up until last year for
HUT, FUSE, EUVE, WUPPE, IUE, HPOL, and HST.
The first officially-approved standard is now available and is known as
version 1.0 (actually the latest version is 1.1?).
Currently all MAST spectral missions support version 1.02.
(see SSAP paper
and Spectral Data
Model papers for description of protocol).
The examples below
describe version 1 services.
Search for FUSE spectra at RA+151.0, Dec=+69.0 and a search area of 2.0 degrees:
Search all MAST spectral missions for spectra of the planet Mars:
Display all spectra with an object name of gamma * and display the results
as an HTML table:
Search for all MAST spectra at RA+151.0, Dec=+69.0 and a search area of 0.5 degrees:
Search for FOS spectra at RA+151.0, Dec=+69.0 and a search area of 2.0 degrees:
We currently have two RSS services: the RSS news service,
and the HST Press Release images service.
The first examples show how to list our most recent news
items in either HTML or RSS XML-format:
shows last 10 entries (by date) in html with descriptions
shows same in rss xml format
summary in html of last 10 (no descriptions)
show entry 25 in html
Here are examples using the HST press release RSS service:
https://archive.stsci.edu/stpr/search.php?ra=149.0&dec=69.0&radius=300&action=Search&outputformat=RSS Find press release images within a 300 arcminute circle of RA,Dec 149.0,69.0
https://archive.stsci.edu/stpr/search.php?action=Search&format=image/tiff&outputformat=RSS Find all press release images available in tiff format
There is currently a service to return footprints using the VO STC-S
convention. It returns a simple xml file.
The service accepts 2 parameters, 'dsn' for specifying the MAST data set name, and 'table'
for specifying the source of the footprint. Valid table values currently include
caom, obscore_images, and obscore.
The CAOM is the most complete source. Note that CAOM footprints repeat the first vertice
at the end of the list, so for example, a rectangular footprint will be described
with 5 vertices.
https://archive.stsci.edu/footprint.php?dsn=z3ddb205t&table=caom To retrieve the GHRS footprint for z3ddb205t from the CAOM table