Track ingest rate of data_streams by size

Hello,

We want to track ingest rate of data streams and other indices in our stack by volume (how much data in GB each data stream received e.g. daily). We are aware of various APIs that give certain information about indices or data streams:

GET /_data_stream/_stats - that gives the total size of a data stream which isn’t useful as old indices get deleted which will skew the numbers.

GET _cat/indices - gives size of primary shards but we cannot tell which indices are written to and which data stream they belong to without having to parse the actual index name .

and also found this article Elastic Support Hub but these don’t seem to be the solution in order to get a real ingest rate by size.

We’ve found this url https://[kibana_url]/s/[space]/api/index_management/indices which returns aJSON with a list of all indices and useful information that we think would give us the information we need and we would be able to filter only for indices in Hot phase, calculate the actual size (primary shards only minus replicas) etc. We would then call the url at set interval.

This is however a hack and an url we found through browser console but is there a dedicated and official API that we can use to get the same information or any other way we can achieve this?

Thanks