Get the Info of a REST API Sender

Is there a way to get the Sender info in a Rest WebService?

for example :

Part A – Sender sends this JSON Via POST Request :

Http httpProtocol = new Http();
HttpRequest request = new HttpRequest();
String url = 'https://SomeDomainURL';


String body = '[{"Name":"MyName","LastName":"MyLastName","Age":31}]';

HttpResponse response = httpProtocol.send(request);

Part B – The Receiver of the request

//How can I get here some info about the above sender? URL? Domain? etc..

Every info will be good.

The sender is sending the request from Salesforce so I want to get the URL or Domain from the org he sent the request…

I tried to use this :

RestRequest re = RestContext.request;
System.debug(re.remoteAddress); //- This is give me the IP..

But none of this gave me the URLDomain.

The reason I want to check the URL is to whitelist it, instead of using IP.

BTW – When I checked the “remoteAddress” (re.remoteAddress) I got an Ip number that does not appear over this list:

Every help will be grateful.



Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Callouts happen from IP and not from URL/Domain. Imagine doing a callout from your personal laptop or mobile device using postman or any other tool, it doesn’t have a domain. It will have IP.

Similarly, the IP of Salesforce callout server keeps on changing. I have seen it change quite frequently during the day, and hence its recommended to whitelist the range and not specific ip’s.

It can happen that the documentation is outdated, in that case, you have to raise a case with SF. They will help you valid IP range for your instance.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x