System Notice: The NASA Exoplanet Archive will be unavailable on Thursday, June 20 from 4:30-5:00pm PDT.
The Exoplanet Archive data are accessed primarily through a Web interface, but users who have some programming knowledge may write scripts that automate specific search queries. These queries must follow a structure that is compatible with the Exoplanet Archive's application programming interface (API). This page provides information on using the API to automate data retrieval.
Skip to:
Data Available Through the API
Currently, the Exoplanet Archive allows the following data tables to be accessed through the API:
| Data and Common Names | Table Name (What to use in queries) |
Data Column Definitions | Click to download all default columns |
|---|---|---|---|
| All confirmed planets (and hosts) in the archive ("Confirmed Planets") |
"exoplanets" |
documentation | |
| Kepler Objects of Interest ("Cumulative") |
the delivery name, e.g."cumulative"
| documentation | |
| Kepler Objects of Interest ("Q1 thru Q6 Kepler Candidates") |
the delivery name, e.g."q1_q6_kepler_candidates"
| documentation | |
| Kepler Objects of Interest ("Q1 thru Q8 KOI") |
the delivery name, e.g."q1_q8_koi"
| documentation | |
| Kepler Objects of Interest ("Q1 thru Q12 KOI") |
the delivery name, e.g."q1_q12_koi"
| documentation | |
| Threshold-Crossing Events (Threshold-Crossing Events) |
"tce" |
documentation | |
| Kepler Numbers, KOI Numbers and KIC Identifiers Table ("Kepler Names") |
"keplernames" |
documentation | |
| Kepler Stellar Table ("Kepler Stellar") |
"keplerstellar" |
documentation | |
| Kepler Time Series Table ("Kepler Time Series") |
"keplertimeseries"Also the quarter must be specifed, eg. "keplertimeseries |
documentation |
We recommend you use wget calls to retrieve Kepler time series data - browsers can time out when the data sets are large. See Examples of Valid Queries, below, for examples of wget commands that retrieve Kepler time series. |
The Exoplanet Archive's API is based on the Structured Query Language (SQL), but only a subset of the SQL functionality is available to the user. Specifically, the user supplies fragments of a simple SQL SELECT statement and the full query is constructed from these (after syntax/content checking). These fragments are given as standard HTTP Web service parameter values, as described below.
An Exoplanet Archive API query can be submitted through a Web browser or entered as a wget command in a command-line interface (CLI). All queries must begin with the following base URL:
http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?
Additional search parameters are appended to the base URL and can be customized to specify the type of information to be returned. The parameters are structured in a keyword-value pair format and separated by an ampersand (&). Parameters may be listed in any order, and all are optional except the table parameter.
The following table describes the allowed parameters and their usage:
| Keyword | Description | Value Syntax and Examples |
|---|---|---|
| Table | Specifies which table to query (see the table above for a full list of tables) Note: This is a required parameter. |
For Confirmed Planets: &table=exoplanetsFor Kepler Stellar, : &table=keplerstellarFor Threshold-Crossing Events: &table=tce |
| Columns | Specifies which columns within the chosen table to return. Columns must use a valid column name. |
One column: Multiple columns:
To return all possible columns for the specified table, use Note: Column name text is not case-senstive. For example, "dec," "DEC," "Dec" and "dEC" are all acceptable. |
| Where | Specifies which rows to return. Use this to search for a range of values, such as rows with a declination greater than 0. Parameters must use a valid column name. |
Only return rows with a parameter greater than a given value:
Only return rows with a parameter less than a given value:
Only return rows containing a specific string of text:
Note: If you are searching for
|
| Order | Controls the order the rows are returned. |
Acceptable keywords are order, order_by, and orderby, followed by the column names in your preferred order. Separate column names with commas.
Rows are listed in ascending order by default, based on the values within the row. For example, if the column Dec is selected, the rows with the lowest Dec values are always at the top of the list. To list results in descending order, add a plus (+) and
|
| File Format | Specifies the preferred file format of the output file. There are four options:
|
For IPAC Table Format/ASCII, any of the following entries are allowed and return the same results:
For bar/pipe delimited:
For XML/VOTable:
Note: File format names are not case-sensitive, so |
The following procedure will build a query to return Exoplanet Archive data from a Web browser.
http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?
exoplanets table:
http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets
pl_hostname), RA (ra) and Dec (dec). Note the separator between the table and column parameters is an ampersand (&).
http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&select=pl_hostname,ra,dec
http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&select=pl_hostname,ra,dec&order=dec
http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&select=pl_hostname,ra,dec&order=dec&format=ascii
wget, put double quotation marks (") around the URL, add -O, and then the name of the output file (also in double quotations). In the example below, the output file will be named planets.txt. To learn more about wget, see the wget help document.
wget "http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&select=pl_hostname,ra,dec&order=dec&format=ascii" -O "planets.txt"The columns of each table are listed and described in the following documents:
Confirmed Planets (exoplanets table)
Kepler Numbers, KOI Numbers and KIC Identifiers Table (keplernames table)
Kepler Stellar Table (keplerstellar table)
TCE (tce table)
Here are some additional examples of working queries.
The following is an example of a Web-based query:
http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&select=hd_name,st_mass&format=ascii
The following are examples of valid wget queries:
wget "http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&format=csv" -O "defaults.csv"
wget "http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=keplertimeseries&quarter=14&format=ipac" -O "Qtr14.tbl"
Note: Due to the large amount of metadata with Kepler releases, Kepler queries must specify a quarter. Each quarter is approximately 170 MB.
The Exoplanet Archive's API is based on the Structured Query Language (SQL), so make sure your queries follow some basic guidelines, including:
&)&). Instead, use plus signs (+) as separators.delete, drop, select and ; (semicolon)."%25".
http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&format=ipac&where=pl_hostname+like+'Kepler%25'&order=pl_hostnameexoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=q1_q8_koi&select=kepoi_name,koi_vet_date&format=ipac&where=koi_vet_date%3Eto_date%28%272013-02-10%27,%27yyyy-mm-dd%27%29&order=koi_vet_date
Here are some additional issues you may encounter and their suggested fixes:
Problem: The output is delivered in CSV format instead of the specified file format.
Possible Solution: Check that there are no spaces before the &format= parameter, which invalidates the statement and thus returns the default file format, which is CSV.
Problem: You receive the following error message: ERROR Error Type: UserError - "table" parameter Message: "" is not a valid table.
Possible Solution: Your query doesn't specify which data table—all Confirmed Planets (exoplanets), all Kepler Objects of Interest (koi), or the Threshold Crossing Events table (tce). Add the appropriate parameter, beginning with &table=. Also, check that the parameter doesn't have a typo, such as "tble" vs. "table."
Problem:You receive the following error: ERROR Error Type: SystemError Message: -201:0:A syntax error has occurred.
Possible Solution: Check that the values for &select= are separated by commas, and not spaces. For example, uniqueid ra dec is invalid, and uniqueid,ra,dec is valid. Also, if you are selecting all columns, check that the parameter is select=* and not select=select*.
Problem: Your query works in a Web browser, but not when submitted on the command line as a wget command.
Possible Solution: Make sure the query (the URL and appended parameters) is contained by double quotation marks ("). For example:
wget "http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=koi&format=csv" -O "defaults.csv"wget http://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=koi&format=csv -O "defaults.csv"