[Release] MpApi: A Modern, Strongly-Typed C# / .NET SDK for Materials Project API (v2)

Hi everyone in the MatSci community,

While the Python ecosystem has fantastic official tooling like mp-api and pymatgen, developers and researchers working within the C# and .NET ecosystem (building high-performance web backends, desktop tools with WPF/Avalonia, or enterprise data pipelines) haven’t had a first-class, strongly-typed SDK for the Materials Project REST API v2.

To bridge this gap, I am excited to share MpApi — an open-source, async-first, strongly-typed .NET library for the Materials Project API.


:glowing_star: Key Highlights & Domain-Driven Design

Rather than providing a flat, monolithic client, MpApi is organized into intuitive scientific domains:

  • :microscope: Materials: Summary properties, crystal structures (Lattice, fractional/cartesian sites, CIF export), tasks, similarity matching, Chemenv coordination, and Robocrys descriptions.
  • :bar_chart: Thermodynamics: Formation energies, hull stability distance (energy_above_hull), and batch entries for constructing Phase Diagrams / Convex Hulls.
  • :high_voltage: Electronic & Optical: Band gaps across theory levels (GGA, HSE06, SCAN), electronic band structures, dielectric tensors, and magnetic ordering.
  • :triangular_ruler: Mechanical: 6x6 elasticity stiffness/compliance tensors, Voigt-Reuss-Hill moduli, piezoelectricity, and phonon vibrational dynamics.
  • :battery: Applications: Insertion electrode screening (voltages, volume changes, gravimetric capacities), epitaxial substrates matching, surfaces (Wulff shapes), and literature-extracted synthesis recipes.
  • :dna: Molecules: Non-periodic molecular summaries, redox potentials, thermo, and optical absorption.

:laptop: Quick Example

Using the client in a C# console or desktop application is as simple as:

using MpApi;
using MpApi.Domains.Applications.Batteries.Models;

// 1. Initialize client
using var client = new MpApiClient("YOUR_API_KEY");

// 2. Fetch Silicon summary properties
var silicon = await client.Materials.Summary.GetByIdAsync("mp-149");
Console.WriteLine($"Formula: {silicon?.FormulaPretty} | Band Gap: {silicon?.BandGap} eV | Stable: {silicon?.IsStable}");

// 3. Screen high-voltage Lithium battery materials
var batteryResponse = await client.Applications.Batteries.SearchAsync(new BatterySearchFilter
{
    WorkingIon = "Li",
    AverageVoltageMin = 3.5,
    Limit = 5
});