API Endpoints
RESTful API v1 · all data is programmatically accessible
Overview
The HEAS Data Platform provides a RESTful API for programmatic access to all platform material data. All endpoints return JSON; these public API endpoints require no API KEY or authentication. When requests are made and processed, the system logs API requests; these logs help us with error troubleshooting, security monitoring and service operations. Related data will also be shared, within a reasonable scope, with all partner institutions of this project.
Rate limit: the same IP may make at most
200
requests within
a sliding window of any 60 seconds
; beyond that, requests from that IP are not executed for
300
seconds (the Retry-After response header gives the remaining seconds).
Web pages and the API share one set of rate-limit rules.
Two searchable datasets are available, selected with the db parameter (list / search endpoints) or inferred from the material ID prefix (detail / CIF / XRD endpoints):
mp-* for Materials Project (HEA / TRA / ELA source collections, deduplicated by mp_id) and
agm* for Alexandria. Both share the same response envelope; field differences are listed in the
Property Reference.
Endpoint Overview
| Endpoint | Description |
|---|---|
| GET /api/v1/materials | Material list: pagination / filtering / sorting |
| GET /api/v1/materials/:id | Material detail (mp-\* → MP, agm\* → Alexandria) |
| GET /api/v1/materials/:id/cif | CIF crystal structure (JSON / plain text) |
| GET /api/v1/materials/:id/xrd | Diffraction pattern (MP only; 404 for Alexandria) |
| GET /api/v1/xrd | Unified endpoint: peak matching / pattern / catalog browse |
| GET /api/v1/search | Lightweight keyword search (autocomplete-friendly) |
| GET /api/v1/stats | Platform statistics |
/api/v1/materials
Fetch the material list, with pagination, filtering and sorting support.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| page | int | 1 | Page number (from 1, max 100000) |
| per_page | int | 20 | Records per page (1-100) |
| db | string | mp | Dataset: mp (Materials Project) or alex (Alexandria). Invalid values fall back to mp |
| type | string | - | Type filter (MP dataset only): HEA, TRA or ELA |
| q | string | - | Keyword search (chemical formula or MP-ID). Only letters, digits, parentheses (), - . , and spaces are supported; special characters such as Chinese are ignored |
| crystal_system | string | - | Crystal system (case-insensitive): Cubic / Tetragonal / Orthorhombic / Hexagonal / Trigonal / Monoclinic / Triclinic |
| is_stable | bool | - | Stability: true/false (also accepts 1/0/yes/no; applies to the MP dataset) |
| has_xrd | bool | - | Return only materials with a precomputed XRD pattern (1; applies to the MP dataset) |
| min_energy | float | - | Minimum formation energy (eV/atom, -1000 ~ 1000) |
| max_energy | float | - | Maximum formation energy (eV/atom, -1000 ~ 1000) |
| elements | string | - | Element filter, exact match on the element composition (comma-separated standard element symbols, e.g. Fe,Cr; case-insensitive, at most 10). Matched against the elements actually present in the chemical formula, so Si does not match CsI |
| sort | string | - | Sort field, with the - prefix for descending order. Allowed: mp_id / type / formula / crystal_system / space_group / formation_energy_per_atom / is_stable / density / nelements; defaults to mp_id ascending, NULLs last |
Element Filter Notes
| Rule | Description |
|---|---|
| Match mode | Exact match on the real element set parsed from the chemical formula, not substring matching: Si only matches silicon-containing materials and will not mistakenly match CsI; C also will not match NaCl |
| Separators | Supports ,, spaces, ;, 、; case-insensitive (fe,cr is equivalent to Fe,Cr) |
| Fault tolerance | Non-element symbols are ignored; at most 10 elements |
| Recommended usage | The query page provides a periodic-table picker; using it to build conditions is recommended |
curl "https://heas.labs.gt.ac.cn/api/v1/materials?type=HEA&per_page=5&sort=-formation_energy_per_atom"
{
"success": true,
"data": {
"items": [
{
"mp_id": "mp-1",
"type": "TRA",
"formula": "Cs",
"crystal_system": "Cubic",
"space_group": "Im-3m",
"space_group_num": 229,
"formation_energy_per_atom": 0.01934,
"is_stable": false,
"density": 1.80193,
"nelements": 1
},
{
"mp_id": "mp-10",
"type": "TRA",
"formula": "As",
"crystal_system": "Cubic",
"space_group": "Pm-3m",
"space_group_num": 221,
"formation_energy_per_atom": 0.1124,
"is_stable": false,
"density": 6.29491,
"nelements": 1
}
],
"pagination": {
"current_page": 1,
"per_page": 2,
"total_items": 170157,
"total_pages": 85079
}
},
"meta": {
"query_time_ms": 173.48,
"cached": false,
"source": "sqlite_index"
}
}
Without a type filter the list is deduplicated by mp_id across datasets (a material recorded in HEA / TRA / ELA is returned once, highest priority first: HEA → TRA → ELA), and
pagination.total_items counts the deduplicated rows.
Alexandria list items carry the fields
mp_id / formula / crystal_system / space_group / space_group_num / formation_energy_per_atom / nelements
(the mp_id column is the Alex-ID). Each Alex-ID occupies a single index row, so no cross-dataset deduplication applies:
curl "https://heas.labs.gt.ac.cn/api/v1/materials?db=alex&crystal_system=Triclinic&per_page=5"
{
"success": true,
"data": {
"items": [
{
"mp_id": "agm000999956",
"formula": "Cs(BC)3",
"crystal_system": "Cubic",
"space_group": "Pm-3n",
"space_group_num": 223,
"formation_energy_per_atom": -5.91264449,
"nelements": 3
},
{
"mp_id": "agm000999957",
"formula": "Rb(BC)3",
"crystal_system": "Cubic",
"space_group": "Pm-3n",
"space_group_num": 223,
"formation_energy_per_atom": -6.229015762142857,
"nelements": 3
}
],
"pagination": {
"current_page": 1,
"per_page": 2,
"total_items": 5777914,
"total_pages": 2888957
}
},
"meta": {
"query_time_ms": 41.98,
"cached": false,
"source": "sqlite_index"
}
}
/api/v1/materials/:id
Fetch the full details of a single material, including basic information, elasticity, electronic and magnetic properties, and references.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | Material ID: mp- prefix + digits (Materials Project, e.g. mp-2866) or agm + digits (Alexandria, e.g. agm000999965) |
curl "https://heas.labs.gt.ac.cn/api/v1/materials/mp-2866"
{
"success": true,
"data": {
"mp_id": "mp-2866",
"type": "HEA",
"datasets": ["HEA", "TRA", "ELA"],
"summary": {
"formula": "Yb(FeSi)2",
"mp_id": "mp-2866",
"nelements": 3,
"is_stable": false,
"nsites": 5,
"density": 7.92825,
"volume": 71.40033,
"a": 5.41767,
"b": 5.41767,
"c": 5.41767,
"alpha": 137.62961,
"beta": 137.62961,
"gamma": 61.47074,
"space_group": "I4/mmm",
"space_group_num": 139,
"crystal_system": "Tetragonal",
"formation_energy_per_atom": -0.50214,
"energy_per_atom": -17.08288,
"energy_above_hull": 0.00216,
"point_group": "4/mmm",
"Bravais_Lattice": "Tetragonal I",
"packing_fraction": 0.74,
"uncorrected_energy_per_atom": -17.08288,
"volume_per_atom": 14.280066,
"c_over_a": 1,
"b_over_a": null,
"poisson_ratio": 0.25211,
"Is_FCC": 0,
"Is_BCC": 0,
"Is_HCP": 0
},
"elasticity": {
"k_vrh": 119.518,
"g_vrh": 70.986,
"E_Calc(GPa)": 177.764,
"homogeneous_poisson": 0.252,
"Vickers_Hard_Est(GPa)": 10.16,
"universal_anisotropy": 0.058,
"Lame_Lambda(GPa)": 72.194,
"Pugh_Ratio(K/G)": 1.6836841067252697,
"Ductility": "Ductile",
"bulk_modulus": 119.518,
"shear_modulus": 70.986,
"debye_temperature": 516.2,
"sound_velocity": 3322.8,
"homogeneity": 0.252
},
"electronic": {
"is_metal": true,
"band_gap": 0,
"is_gap_direct": false,
"cbm": null
},
"magnetic": {
"is_magnetic": false,
"total_magnetization": 0.0019,
"ordering": "NM",
"num_magnetic_sites": 0,
"total_mag_norm_vol": 3.0e-5
},
"refs": {
"mp_url": "https://materialsproject.org/materials/mp-2866",
"mp_task_ids": ["aaadmivi", "aaaeukef", "aaafawbu", "aaafbyfu", "aaahbakp"]
},
"xrd": {
"by_target": {
"AgKa": {"radiation": "AgKa", "wavelength": 0.5608, "n_peaks": 97, "three_strong": [13.5346, 13.2397, 8.9119]},
"CoKa": {"radiation": "CoKa", "wavelength": 1.7903, "n_peaks": 16, "three_strong": [44.187, 28.7163, 43.1799]},
"CrKa": {"radiation": "CrKa", "wavelength": 2.2897, "n_peaks": 10, "three_strong": [57.5433, 37.0047, 56.183]},
"CuKa": {"radiation": "CuKa", "wavelength": 1.5406, "n_peaks": 23, "three_strong": [37.8013, 24.6635, 36.9514]},
"MoKa": {"radiation": "MoKa", "wavelength": 0.7093, "n_peaks": 94, "three_strong": [17.1749, 16.7997, 11.2997]}
}
}
}
}
datasets lists the datasets this mp_id actually exists in (priority order HEA → TRA → ELA); type is the highest-priority one.
The detail endpoint embeds the material's XRD three-strongest peak values in the xrd field, organized by target (radiation) as a by_target structure
(each entry carries radiation, wavelength, n_peaks and three_strong; every precomputed target is returned).
For the full diffraction peak list and raw xy data, use the pattern endpoint in the XRD Diffraction Matching documentation.
The detail endpoint publishes only a public-field whitelist; the platform's self-developed feature data (features) is not exposed. The elasticity block of the ELA dataset additionally returns
bulk_modulus, shear_modulus, debye_temperature, sound_velocity, homogeneity
and other elasticity-specific fields (null in HEA / TRA).
Alexandria details use the field set
mat_id / formula / summary / energy / electronic / magnetic / structure / meta / composition,
in the same envelope as MP details (success + data). Field meanings are listed in the
Property Reference.
| Field | Type | Description |
|---|---|---|
| mat_id | string | Alexandria entry ID (agm + digits) |
| formula | string | Reduced standard formula |
| summary | object | Structure summary: formula / spg (space-group number) / spg_symbol / crystal_system (lowercase) / point_group / nsites / n_elements / elements |
| energy | object | Energy: e_above_hull (eV/atom) / e_form (formation energy, eV/atom) / energy_corrected / energy_total |
| electronic | object | Electronic structure: band_gap_ind (indirect gap, eV) / band_gap_dir (direct gap, eV) / dos_ef (DOS at the Fermi level) |
| magnetic | object | Magnetism: total_mag (total magnetic moment, µB) |
| structure | object | Unit cell: a / b / c (Å), alpha / beta / gamma (°), volume (ų), n_sites |
| meta | object | Source metadata: prototype_id / decomposition / run_timestamp |
| composition | object | Element → atom-count composition map |
{
"success": true,
"data": {
"mat_id": "agm005737469",
"formula": "Sr(Cd5Rh)2",
"summary": {
"formula": "Sr(Cd5Rh)2",
"spg": 69,
"spg_symbol": "Fmmm",
"crystal_system": "orthorhombic",
"point_group": "mmm",
"nsites": 13,
"n_elements": 3,
"elements": ["Sr", "Cd", "Rh"]
},
"energy": {
"e_above_hull": 0.048583876,
"e_form": -0.14619106,
"energy_corrected": -27.528517,
"energy_total": -27.52851763
},
"electronic": {"band_gap_ind": 0, "band_gap_dir": 0.0354, "dos_ef": 6.4979},
"magnetic": {"total_mag": 1.0e-7},
"structure": {
"a": 5.816792152520879,
"b": 7.682452622621729,
"c": 7.5348373597126574,
"alpha": 81.59739539125536,
"beta": 67.29457994421465,
"gamma": 67.75446032577233,
"volume": 287.4972511054037,
"n_sites": 13
},
"meta": {
"prototype_id": "AB2C10_0_spg69",
"decomposition": " Cd41Rh8 Sr3Cd11 SrCd3Rh2 ",
"run_timestamp": "2023-07-01 14:25:20.425723"
},
"composition": {"Sr": 1, "Cd": 10, "Rh": 2}
}
}
/api/v1/materials/:id/cif
Fetch the material's CIF (Crystallographic Information File) crystal-structure data. Two ID families are supported: mp-* returns the structure file stored by Materials Project; agm* returns the CIF generated from the Alexandria entry's structure data (the first line names the source entry). The format values behave identically for both ID families.
| Parameter | Type | Default | Description |
|---|---|---|---|
| id (path) | string | - | Material ID: mp-2866 (MP) or agm005737469 (Alexandria) |
| format (query) | string | json | json or raw |
The JSON format returns a unified envelope (identical fields for both ID families); format=raw returns the CIF as plain text (Content-Type: text/plain). Response structure example:
{
"success": true,
"data": {
"mp_id": "<material ID>",
"cif_content": "# generated using pymatgen\n..."
}
}
curl "https://heas.labs.gt.ac.cn/api/v1/materials/mp-2866/cif"
curl "https://heas.labs.gt.ac.cn/api/v1/materials/mp-2866/cif?format=raw"
curl "https://heas.labs.gt.ac.cn/api/v1/materials/agm005737469/cif"
curl "https://heas.labs.gt.ac.cn/api/v1/materials/agm005737469/cif?format=raw"
/api/v1/materials/:id/xrd
Fetch the full diffraction pattern of one material (every peak's 2θ / intensity / hkl / d-spacing). Applies to MP materials (mp-*); Alexandria entries (agm*) return 404 with the message XRD data is not available for the Alexandria dataset.
| Parameter | Type | Default | Description |
|---|---|---|---|
| id (path) | string | - | Material ID (mp-*; agm* returns 404) |
| target | string | CuKa | Target (radiation); the parameter name type is also accepted (compatibility alias). Unknown targets fall back to CuKa |
| format | string | json | json or raw (plain text xy: 2θ intensity hkl, with radiation info and the # generated using pymatgen comment) |
curl "https://heas.labs.gt.ac.cn/api/v1/materials/mp-2866/xrd?target=CuKa"
curl "https://heas.labs.gt.ac.cn/api/v1/materials/mp-2866/xrd?format=raw"
XRD diffraction patterns are provided by Materials Project only; Alexandria has no such endpoint (returns 404).
/api/v1/search
Quickly search materials, matching chemical formula or MP-ID. Returns a lightweight result list, suitable for autocomplete scenarios. When q itself is a single element symbol (e.g. Fe, si), matching is by exact element.
| Parameter | Type | Default | Description |
|---|---|---|---|
| q | string | - | Search keyword (required) |
| db | string | mp | Dataset: mp or alex |
| type | string | - | Type: HEA, TRA or ELA (MP dataset only) |
| limit | int | 20 | Number of results (1-50) |
curl "https://heas.labs.gt.ac.cn/api/v1/search?q=Fe&type=HEA&limit=5"
{
"success": true,
"data": [
{"mp_id": "mp-1001571", "type": "HEA", "formula": "CaFeO3"},
{"mp_id": "mp-1001606", "type": "HEA", "formula": "LuFeC2"}
]
}
The response structure is identical to MP (a lightweight data array); only mp_id becomes an agm*-style Alex-ID. Example:
curl "https://heas.labs.gt.ac.cn/api/v1/search?q=Fe&db=alex&limit=5"
/api/v1/stats
Fetch platform statistics, including the total material count, per-type counts and index build time.
curl "https://heas.labs.gt.ac.cn/api/v1/stats"
{
"success": true,
"data": {
"generated_at": "2026-10-23T15:22:25+00:00",
"built_at": "2026-10-23T15:22:25+00:00",
"total": 170157,
"counts": {"HEA": 150100, "TRA": 16712, "ELA": 3345},
"meta": {
"pagination": {"current_page": 1, "per_page": 20, "total_items": 170157, "total_pages": 8508}
}
}
}
Error Handling
The API uses standard HTTP status codes to express request results; error responses return a JSON body for programmatic judgment and user display:
Error Response Structure
| Field | Type | Description |
|---|---|---|
| success | bool | Always false. Note: 405 / 429 responses produced by the routing layer are plain {"error": "..."} without success — rely on the HTTP status code |
| error | string | Human-readable error description |
HTTP Status Codes
| Status Code | Meaning |
|---|---|
| 200 | Request succeeded |
| 400 | Invalid request parameters (e.g. malformed material ID) |
| 404 | Resource not found (material / CIF / XRD pattern does not exist; the XRD pattern endpoint returns 404 for Alexandria entries) |
| 405 | Request method not allowed (this platform's API supports GET only) |
| 429 | Too many requests; the Retry-After header gives the remaining seconds before retrying, and the response carries Cache-Control: no-store |
| 457 | Region restriction; the current IP's region is outside the allowed access range |
| 503 | Service temporarily unavailable (e.g. the index is being rebuilt); please retry later |
Example Error Responses
{
"success": false,
"error": "Invalid material ID format"
}
{
"success": false,
"error": "Material not found"
}
{
"error": "Method not allowed"
}
{
"error": "Rate limit exceeded; please retry after 300s. See /document/api for the rate-limit policy."
}
{
"success": false,
"error": "In mainland China, only Guizhou Province is permitted to request the service",
"region": {
"country": "中国",
"province": "江苏省",
"city": "南京市",
"isp": "移动",
"code": "CN"
}
}
{
"success": false,
"error": "Service temporarily unavailable"
}