Reading long term energy data by calling the API

I have a solar panel installation with a Fronius inverter. I display the solar production data in the Energy Dashboard. When I read the Fronius sensor values by calling the Home Assistant API I get the correct values. When trying to read values older than 10 days I get no data, which is expected.

The Energy dashboard displays values from the beginning of my installation, so the dashboard seems to store those values as Long Term Statistics.

Does anyone know how to read those LTS values by using the API?