Is there a way to get the instance name of a Salesforce organisation (like na41) via the REST API in a reliable way? I've looked at existing resources available and they do not seem to expose that. I also considered parsing it out of the instance_url value, but it could vary if the org is using a custom domain.


With a little bit of reverse engineering, it seems like we can get the instance key using this REST endpoint:


As an example, if your Salesforce instance URL is:

You can get the key at:

In JavaScript:

    .then((resp) => resp.json())
    .then(function (body) {
    .catch(function (err) {
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.