17

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.

  • Both inbound and outbound calls are counted against Daily API Call limits – C0DEPirate Feb 18 '16 at 11:46
16

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.

| improve this answer | |
  • Ah, that makes total sense! Developer console uses API calls to the Tooling API. Thanks @Alex. I'll write a class and run it to count the API calls. – Rohit Kunal Feb 18 '16 at 12:23
  • 2
    I have written a class and scheduled it for 5 mins later, closed all other browser windows including developer console, scheduled job monitoring and kept only the Company Information window open. It still takes about 20 calls or so each time the job runs. Not able to understand why. The Limits quick reference doc does not explicitly specify if the outbound calls are included or not. Would love it if they clarified it in the doc. – Rohit Kunal Feb 18 '16 at 15:28
  • Do we have definitive confirmation of this? There are conflicting reports here (whether or not outbound calls count), and it sounds like @Rohit Kunal, who accepted the answer, seems to have found differently? – Bow-chicawow-ers Jul 25 at 17:56
1

Looking again about this Salesforce Developer Limits Quick Reference Summer '17, page 34.

Total API Request Limits (here total number of APIs) are inferred based in edition and license type, and also is stated:

Limits are enforced against the aggregate of all API calls made by the org in a 24-hour period. Limits are not on a per-user basis. When an org exceeds a limit, all users in the org can be temporarily blocked from making additional calls. Calls are blocked until usage for the preceding 24 hours drops below the limit

So, not really clear API limits apply only to inbound messages

| improve this answer | |
0

The documentation is in the process of being updated to say “made to the org” instead of “made by the org.”

Only inbound count in this context

| improve this answer | |
  • 2
    Do you have a source that you can link to that supports this - or an ETA for the documentation update? – Dave Humm Nov 28 '17 at 11:38
0

Any action that sends a call to the API counts toward usage limits, except the following :-

  • Outbound messages
  • Apex callouts
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.