Thank for your suggestion.
Got it to work this way.
I had to process 100 vhosts. (all vhosts on one webserver)
So my script sent 200 api calls (100 to make a temporary change and 100 to revert the change) resulting in 200 apache reloads.
Do you agree it might be a good idea if I post a feature request to add a function to be able to re-generate all vhosts config files after a template change and only reload apache once?
Such function might also become useful when a future ISPconfig software update needs to change global settings on already generated config files or file structures.