Codementor Events

How to check the ip address of the salesforce org?

Published Jan 31, 2024Last updated May 29, 2024

You must have seen a situation in the salesforce ecosystem where you need to integrate with the external application and that system has security concern over who can access their application publically even though they are authenticated, so in that case they would ask for the IP(Internet Protocol) Address.

1 . Salesforce Trust Center:

  • This is the most official and reliable way to obtain your org’s IP address ranges.
  • Visit the Salesforce Trust Center (https://trust.salesforce.com/) and search for “IP address ranges.”
  • You’ll find a list of subnets for different Salesforce regions.
  • Note:  This method provides a range of IP addresses, not the specific IP for your instance.

2 . Hitting the external api in execute anonymous
This is quick way to identify your orgs ip address by using the below apex code that we can run in the execute annonymous and we can get the results.

Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://api.ipify.org');
request.setMethod('GET');
HttpResponse response = http.send(request);
String responseBody = response.getBody();
System.debug(responseBody);

Note : this is not 100% sure shot for longer term and may be not secure way. So better to raise a case with Salesforce and get the public IP from them for
the org(Production or sandbox) org that you want to find the ip address.

Here's a demo video for handson experience.

How to find ip address of Salesforce org

Peace ✌️

Discover and read more posts from Sunil Kumar
get started