The only way to do it is via DB.
There is no API endpoint.
In the classes documentation https://docs.atlassian.com/software/jira/docs/api/8.0.0/allclasses-noframe.html there is only reset login page class defined.
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events