Restore the last_state_down after a new installation

We have a system which we deploy from scratch via ansible. We do a periodic backup of all comments/downtimes/scheduled downtimes via api and replay them after a new installation.

What is still missing is the possibility to backup (and restore) the information about the last_state_down of a host/service (the colleagues from service would like to see in icingaweb2 the “real” time since when a host was down, not since we newly deployed).

As far as I could see, there is no api that supports this (and I imagine that it will not be implemented - if at all - in the foreseeable future).
I would give it a shot to modify it per script in icinga2.state directly, would like to know if the file format is documented somewhere (I am fully aware that this might break the system since it is not meant to be used like this and it should not be done, but am willing to spend 1-2 days to try it out).

We are on the latest released icinga2 version running on ubuntu 18.04