The Materials Project also makes available its data and scientific analysis through the open Materials Application Programming Interface (API) and the open-source Python Materials Genomics (pymatgen) materials analysis package. While the web front end provide user-friendly interfaces for the majority of users, the Materials API and pymatgen package provide the means for users to efficiently obtain large data sets and develop new analyses.
The Materials API (MAPI) is an open API for accessing Materials Project data based on REpresentational State Transfer (REST) principles. In a RESTful system, information is organized into resources that can be uniquely identified via a uniform resource identifier (URI).
While the MAPI is designed to be code base agnostic and can conceivably be used with any programming language supporting basic http requests, a convenient wrapper to MAPI has been implemented in the Python Materials Genomics (pymatgen) library to facilitate researchers in using the MAPI. Please see the pymatgen wrapper section.
To use the MAPI, you need to first have an API key. Generate yours by logging in to materialsproject.org, going to your dashboard and clicking "Generate API Key".
The following represents a simple example of a MAPI URL:
The initial part of the URL (https://www.materialsproject.org/rest/v2/) is a preamble. Note that the request must be performed via secure http, as indicated by the https in the url.The next part of the URL ("materials") specifies the kind of information or operation being requested. The above URL is a request for information on materials. Other supported operations include "tasks", "battery", etc.
Next, we have an identifier ("Fe2O3") for the specific information requested. The URL above indicates a request for all materials having the formula Fe2O3. Finally, the "vasp" portion of the URL indicates the type of information requested, which in this case are calculated information.
However, the above url will not work if an API key is not supplied. API keys must be supplied as GET/POST parameters or as an x-api-key header (preferred method).
You will need to login into the Materials Project and generate your API key before we can generate a clickable REST url.
With the Materials API, you may write your own programs in a programming language of your choice to query for data from the Materials Project. We highly recommend the use of our open source python materials genomics package, which includes a more user-friendly high-level interface to the Materials API and other useful analysis tools.