API and test for the new stats API ready