Can I get the "Decomposes To" property through API?

Hi. Can I get the “Decomposes To” property in the “Material Details” tab of Materials Project site through API?
I asked because there is no description of “Decomposes To” property in the API documentation.
I would like to get information only on whether each material is “Stable” or not.

You can! It is available under the decomposes_to field of a material document. Using pymatgen's MPRester.query (a wrapper around the /rest/v2/query API endpoint):

from pymatgen import MPRester
mpr = MPRester()
results = mpr.query(
    {"e_above_hull": 0, "decomposes_to": {"$exists": True}},
    ["material_id", "e_above_hull", "decomposes_to"]
len(results) # 6

results2 = mpr.query(
    {"decomposes_to": {"$exists": False}},
    ["material_id", "e_above_hull"]
all(r['e_above_hull'] == 0 for r in results2) # True

The above assumes you have your API key e.g. set via a pymatgen configuration file.

Also, note above that simply filtering for energy above hull (e_above_hull) equal to zero does not ensure that all returned materials are stable. Ensuring that the decomposes_to field is not present in a material document is more reliable. This seems like an issue of numerical imprecision, where the energy above hull is “very close” to zero.

I noticed that the decomposes_to field is missing from the API documentation repository, so I added an issue to ensure that it will be added.