Any way to obtain entity statistics data from the REST api?

According to the documentation (REST API | Home Assistant Developer Docs) an endpoint exists for the history of an entity state, but unfortunately I verified that this only pulls the data from the states table, thus limiting to the db flush period.

Is there any api endpoint to query the data from the statistics as well in order not to be limited to the db flush period?

I know that I can read directly the DB but I would like to let home assistant directly handle the querying of the data in order not to mess up the db while the application is running. Plus, this way I can query data wherever I am by just accessing the home assistant external URL.

In general what would be the easiest way of programmatically requesting the entire history of a specific entity? I just want to make some analysis in Python.