I’ll setup a test install and see if I can replicate the issue. It’s my understanding the API and GUI share most of if not all the same code, so both should work without issue. The GUI does do a lot of the heavy lifting like providing the required fields and values, perhaps when executed on CLI you are missing something.
To solve this, simply remove /usr/sbin/virtualmin file by running rm -f /usr/sbin/virtualmin comman, then go to Virtualmin UI and re-check configuration (by clicking on System Settings -> Re-Check Configuration link) to regenerate Virtualmin API helper command.