2

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.

1

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

https://api.status.salesforce.com/v1/instanceAliases/[custom-domain]

As an example, if your Salesforce instance URL is:

You can get the key at:


In JavaScript:

fetch('https://api.status.salesforce.com/v1/instanceAliases/ci')
    .then((resp) => resp.json())
    .then(function (body) {
        console.log(body.instanceKey);
    })
    .catch(function (err) {
        console.error(err)
    });

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.