REST API is found the management port of your Splunk deployment which is 8089 by default.
If you're locally on the server you can reach it using :
Else you can replace
localhost with your IP/URL.
companyName.splunkcloud.com:8089 should do it.
But if you're using SH clustering and going through a load balancer you need to be sure that your URL allows you to use port 8089. If that's not the case you need to point directly to your search head using IP/DomainName.