TWRP API to aceess TWRP from the OS? Is there any documentation for TWRP's "API" which for instance can be used to flash an OTA update from the OS? I couldn't find any information on it, but my ROM (Lineage OS) is able to reboot my phone into TWRP, making it flash an OTA update and then reboot into Android without any user interaction. 

My hope is to find some sort of API that would allow me to automatically create TRWP backups without user interaction. 

I'm not looking for for any closed source alternatives that could do the job. I'm also not looking for normal backup apps. I need full backups like the ones that TWRP can produce.
It's possible by OpenRecoveryScript

Official command guide: https://twrp.me/faq/openrecoveryscript.html

Official TWRP App, TWRP Manager and Lineage OS Updater use this approach.