Skip to content

[Bug]: REST API for summary statistics "/materials/summary/stats/" is code 500 #1033

@chibisi

Description

@chibisi

Code snippet

curl -X 'GET' \
  'https://api.materialsproject.org/materials/summary/stats/?field=band_gap&num_points=100' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: MyAPIKey'

What happened?

It is likely that the "/materials/summary/stats/" REST API on https://api.materialsproject.org/docs#/Materials%20Summary/search_materials_summary_stats__get is broken. I have tried using the UI to generate curl requests, for example:

curl -X 'GET' \
  'https://api.materialsproject.org/materials/summary/stats/?field=band_gap&num_points=100' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: MyAPIKey'

and get a status 500 Internal Server Error and response header

 access-control-expose-headers: X-Api-Key 
 alt-svc: h3=":443"; ma=86400 
 cf-cache-status: DYNAMIC 
 cf-ray: 99d74f5f9ed79142-FRA 
 content-length: 21 
 content-type: text/plain; charset=utf-8 
 date: Wed,12 Nov 2025 16:12:17 GMT 
 priority: u=1,i 
 ratelimit-limit: 25 
 ratelimit-remaining: 24 
 ratelimit-reset: 1 
 server: cloudflare 
 server-timing: cfExtPri 
 vary: Origin 
 via: kong/2.8.4 
 x-kong-proxy-latency: 7 
 x-kong-upstream-latency: 572 
 x-ratelimit-limit-day: 640000 
 x-ratelimit-limit-hour: 40000 
 x-ratelimit-limit-minute: 1000 
 x-ratelimit-limit-month: 12800000 
 x-ratelimit-limit-second: 25 
 x-ratelimit-limit-year: 100000000 
 x-ratelimit-remaining-day: 639992 
 x-ratelimit-remaining-hour: 39998 
 x-ratelimit-remaining-minute: 998 
 x-ratelimit-remaining-month: 12799992 
 x-ratelimit-remaining-second: 24 
 x-ratelimit-remaining-year: 99999992 

Or a more complete query:

curl -X 'GET' \
  'https://api.materialsproject.org/materials/summary/stats/?field=band_gap&min_val=0&max_val=10&num_points=100' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: MyAPIKey'

Gets code 500 also

 access-control-expose-headers: X-Api-Key 
 alt-svc: h3=":443"; ma=86400 
 cf-cache-status: DYNAMIC 
 cf-ray: 99d80e638df29e0a-LHR 
 content-length: 21 
 content-type: text/plain; charset=utf-8 
 date: Wed,12 Nov 2025 18:22:43 GMT 
 priority: u=1,i 
 ratelimit-limit: 25 
 ratelimit-remaining: 24 
 ratelimit-reset: 1 
 server: cloudflare 
 server-timing: cfExtPri 
 vary: Origin 
 via: kong/2.8.4 
 x-kong-proxy-latency: 5 
 x-kong-upstream-latency: 1942 
 x-ratelimit-limit-day: 640000 
 x-ratelimit-limit-hour: 40000 
 x-ratelimit-limit-minute: 1000 
 x-ratelimit-limit-month: 12800000 
 x-ratelimit-limit-second: 25 
 x-ratelimit-limit-year: 100000000 
 x-ratelimit-remaining-day: 639988 
 x-ratelimit-remaining-hour: 39996 
 x-ratelimit-remaining-minute: 999 
 x-ratelimit-remaining-month: 12799988 
 x-ratelimit-remaining-second: 24 
 x-ratelimit-remaining-year: 99999988 

Adding num_samples value to the query also results in the same failure. So I think this portion of the REST API is broken. I have been able to use other parts of the API.

I have used the latest version tag on your API page, since I am running curl rather than over the Python API I don't know what version your server is running for the REST API. I hope that I am reporting this to the correct place since there is an issue tracker for the website (https://github.com/materialsproject/www-issues) but no one has updated it for 11 years and I don't know if anyone will pick this up if I raise an issue there.

Thank you

Version

v0.45.13

Which OS?

  • MacOS
  • Windows
  • Linux

Log output

access-control-expose-headers: X-Api-Key 
 alt-svc: h3=":443"; ma=86400 
 cf-cache-status: DYNAMIC 
 cf-ray: 99d74f5f9ed79142-FRA 
 content-length: 21 
 content-type: text/plain; charset=utf-8 
 date: Wed,12 Nov 2025 16:12:17 GMT 
 priority: u=1,i 
 ratelimit-limit: 25 
 ratelimit-remaining: 24 
 ratelimit-reset: 1 
 server: cloudflare 
 server-timing: cfExtPri 
 vary: Origin 
 via: kong/2.8.4 
 x-kong-proxy-latency: 7 
 x-kong-upstream-latency: 572 
 x-ratelimit-limit-day: 640000 
 x-ratelimit-limit-hour: 40000 
 x-ratelimit-limit-minute: 1000 
 x-ratelimit-limit-month: 12800000 
 x-ratelimit-limit-second: 25 
 x-ratelimit-limit-year: 100000000 
 x-ratelimit-remaining-day: 639992 
 x-ratelimit-remaining-hour: 39998 
 x-ratelimit-remaining-minute: 998 
 x-ratelimit-remaining-month: 12799992 
 x-ratelimit-remaining-second: 24 
 x-ratelimit-remaining-year: 99999992

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions