Get_structure_by_material_id no longer works for me

from mp_api.client import MPRester

with MPRester("your_api_key_here") as mpr:
    docs = mpr.summary.search(material_ids=["mp-149"], fields=["structure"])
    structure = docs[0].structure
    # -- Shortcut for a single Materials Project ID:
    structure = mpr.get_structure_by_material_id("mp-149")

MPRestError: REST query returned with error status code 403 on URL https://api.materialsproject.org/materials/core/mp-620652/?_limit=1&_fields=structure with message:

Response {“error”: “You are using deprecated API endpoints. Please read our documentation (https://docs.materialsproject.org) and upgrade to the latest version of the mp-api client (mp-api · PyPI).”, “version”: “blocked”}

I have tried to upgrade to: pymatgen 2024.2.8 and mp-api 0.39.5

Anyone has an idea? Thanks a lot!

1 Like

same it doesn’t work for me either, i tried with pymatgen and it works on that but not mp-api. someone help us, i tried uninstalling and updating the api and everything python 3.9.

1 Like

My Python version is Python 3.10.0

I have the same proble but with mpr.get_phonon_dos_by_material_id(“mp-149”)

Please install the mp-api release candidate 0.40.0rc3. We will release a non-rc version today.

@here mp-api v0.40.0 is released and installable via pypi.

After updating to v0.40.0, it works. Thanks!