Automate the initial "Onboarding" process with API calls

I’m trying to automate the initial “onboarding” process with the API. I tried doing this: sonatype - Use Nexus 3 API to change admin password - Stack Overflow

Unfortunately, this failed with a 401 http code.

I’d like to bypass the initial welcome configurations, completely.

Any help would be greatly appreciated, thanks in advance