2

My org has some callouts to another server. but the server requires to add IP address to whitelist. So I need to know how many IP addresses does each org have and how can I get it through coding or something else.

1

2 Answers 2

2

Salesforce's IP ranges can be found on this page - https://help.salesforce.com/articleView?id=000003652&type=1. Your particular org can possibly attempt external connections from any IP address in that range, although as the answer linked in comments notes, you can use nslookup to find the IP range of your particular pod, at the risk of that range being subject to change without notice.

1
  • Thanks for your answer. Can we get IP address by apex code?
    – Gary Chen
    Commented Jun 19, 2017 at 6:54
2

How to check your SF IP address: Add remote site setting - This endpoint https://salesforcelwc.herokuapp.com Use this script to access to that endpoint:

HTTP h = new HTTP();
HTTPRequest req = new HTTPRequest();
req.setEndPoint('https://salesforcelwc.herokuapp.com/myip');
req.setMethod('GET');
HTTPResponse res = h.send(req);
System.debug(res.getBody());

In the debug log you'll see the IP in this format: enter image description here

2
  • 1
    Salesforce orgs do not have single, static IP addresses. This may give you one IP that the org's pod is currently using, but that is subject to change at any time including on the next request.
    – David Reed
    Commented May 30, 2022 at 14:44
  • As we occasionally get requests for specific IPs, I had used this solution before. I tried to run it today and am getting a response that the app doesn't exist anymore. Just as a general FYI.
    – JRiffe
    Commented May 17, 2023 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .