Graham Barnard

What's My Salesforce IP Address?




What's My Salesforce IP Address?

Posted by Graham Barnard on .

IP whitelisting is an effective method to help secure connections to external environments. Salesforce provides a range of IPs addresses that can be whitelisted by external systems based on your Salesforce region. Salesforce recommends whitelisting the entire set of IP ranges.

Runs this Apex code from Execute Anynomous to find your current IP adresss.

NOTE: This will only work when you add to your remote site settings.

The Code

String url = '';

// Pass in the endpoint to be used using the string url
Http h = new Http();
HttpRequest req = new HttpRequest();

// Send the request,
HttpResponse res = h.send(req);
String responseBody = res.getBody();

System.debug('Current Ip Address: ' + responseBody);

This code might help troubleshoot an issue, but you cannot guarantee that this will always be your IP address as Salesforce might randomly change it.


Graham Barnard

Senior Salesforce Developer