Hello,
The default certificate file is stored in /etc/uhttpd.crt file on the router. There could be many ways to replace it, but the easiest would most likely be for your application to connect to your device using SFTP, delete the original certificate, and replace it with yours. A router reboot would most likely be required as well afterward.
However, as I do not have any certificates to test this with, I'd recommend testing this on your side and letting me know if any issues occur.
For example, if you're using Python to automate the process, pysftp seems to be an ideal library for this, as only with a few lines of code you can connect to the device and replace the uhttpd file. Then you could SSH into the router and reboot it with the command reboot.
Let me know how it goes!
Best regards,
DaumantasG