[SalesForce] Is Salesforce API limit on outbound or inbound

Does the Salesforce API limit apply on outbound API requests or only on the inbound API requests?

From this Knowledge article:

  1. What counts towards my API limit?

SOAP (https://www.salesforce.com/developer/docs/api/Content/sforce_api_calls_list.htm) and REST API calls (which include Bulk API calls) are counted against an organization API call limit.

This appears to be an inbound call that will be counted against the API. But it's quite strange when I tried it out in my developer org:

  1. I got a new developer edition.
  2. Logged in and navigated to Company Information and the API calls are at 0, as I would expect
  3. I went to developer console, and executed the following script that makes an API callout to GitHub API. It'd fail as it wouldn't have authentication, but it'd make the API callout alright. (I've also added it in remote site settings)

Http h = new Http();
HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setEndpoint('https://api.github.com/users/mralexgray/repos');
HttpResponse response = h.send(req);
System.debug(LoggingLevel.INFO, 'response :' + response);

When I executed this script once and checked the API calls, I expected it to remain at 0. But for some reason, it's 31 calls! which is a weird number.

I've executed that in a for-loop for 10 times and the API calls grew to 60 and I now have no idea if my external callouts are being included in the API limits.

Anyone else noticed this? Would love to hear your thoughts, thanks!

P.S: I've also checked this question, which I thought has the right answer until my own test.

Best Answer

Unfortunately your test is flawed. What you're missing here is that using the Developer Console uses API calls to the Tooling API (it's a little crazy that these are counted, I know)!

The API call limit includes inbound calls only. Outbound calls (i.e. callouts) are only governed by the per transaction and maximum timeout limits.

The Salesforce Developer Limits Quick Reference should contain all the information you need.

Related Topic