Print this page

Can I use MyDomain URL as endpoint to login via the web-service API?

Knowledge Article Number 000044624
Description Which endpoint value do I need to use in order to login to my org via the API? Could I use the MyDomain URL instead of the generic Salesforce URL?
Resolution Salesforce does not recommend "hard-coding" the endpoint URL value into your integration code. 
The best practice would be to execute the login() command - as described here: 

This call would return a LoginResult object which has a metadataServerURL string type that holds the relevant endpoint. 
You can use this value to reset the SOAP endpoint to the returned server URL: 

Having said that, the following endpoints would also initiate a successful login.
For production instances:

For sandbox: 

Or, if MyDomain is enabled on the org, you could use: 

Note: Replace "MyDomain" with the My Domain name of your company.

promote demote