Skip to main content
Debugging API Limits
Engineering Swantide avatar
Written by Engineering Swantide
Updated over 3 months ago

Salesforce data may be accessed without utilizing the Salesforce platform itself through the use of APIs. However, the number of API queries that a Salesforce client may call is restricted. Below are steps you can take to debug any errors. If the outlined steps do not resolve your issues, you may need help from Salesforce Support.

Steps:

Step 1: Verify API Usage in System Overview

  1. Log into your Salesforce Environment and verify that the API Limits are exceeded

  2. Set Up > System Overview

  3. You should see a screen like this under API Usage

Option 1: Go to Administrative Reports in Salesforce (Only Available in Classic):

To access Administrative Reports for API calls in Salesforce, you will need to use Salesforce's built-in reporting and monitoring tools. Salesforce provides various ways to track and analyze API usage, including API usage reports and Event Monitoring. Here are the steps to access Administrative Reports for API Calls:

  1. Log into Salesforce, switch to Salesforce Classic

  2. Go to Reports

  3. Under Folders, Search Administrative Reports

  4. Select the Report that is already created called "API Usage Last 7 Days"

  5. Once in the report, click "Customize"

  6. Modify the Report as needed.

Note OOTB, the look back on the number of API calls is set to 7 Days.

If you need more extensive Data to analyze, proceed to Step 2.

Using the System Overview & Administrative Reporting Together

Here's an example of how you can use these two tools together:

  1. Assume today is Wednesday. Within the System Overview, you'll see the following:

    1. API REQUESTS, LAST 24 HOURS 25,000

  2. This means that in the last 24 hours (including today), you have used 25,000 API calls.

  3. Go to the "API Usage Last 7 days" report and see how many calls you have made on Wednesday (today) and part of yesterday (Tuesday). You are likely to see something like this:

    1. Wednesday: 15,000

    2. Tuesday: 20,000

  4. Consider that the "Tuesday" total includes all of the API calls made on Tuesday, but the System Overview total does not include all calls from Tuesday. Instead, it only includes the API calls made within the last 24 hours. So the calculation is something like this:

    1. Wednesday's calls (15,000) + calls from Tuesday taking place within the last 24 hours (10,000) = 25,000 total API calls.

Step 2: Check API Usage Counts for Connected APPs (Last 24 Hours)

To quickly gut check your API Usage Count per connected app, you can go to Setup, type in Connected App and select "Connected App OAuth Usage"

Here you will see all your Connected Apps. You can go into each Connected App and check the API Usage Count by clicking on the number under "User Count"

Once you click into the "User Count", you can see which user(s) tied to the Connected App that have made API Calls from the Connected App within the Last 24 Hours of the Last Used time.


Step 3 : Download the Event File Logs:

Step 3.1: In Salesforce - Go to Event Log File Browser

  1. In Setup, type in Event Log File Browser in the Quick Find

  2. Set an Start and End Date Interval

  3. Click Apply

  4. Once the Log Files are generated, download them as CSV, where you will use this sheet for Step 3.2 and 3.3

Can't find the Event File Logs? Try using the Heroku App

  1. Go to https://salesforce-elf.herokuapp.com/ and log via the your Salesforce Credentials

  2. Set a timeframe in which you want to view all the API calls there were being made

  3. Download the file and add it to a spreadsheet

If all else fails, contact Salesforce Support.

Step 3.2: Query the Connected App Ids:

  1. Using a tool like the Salesforce Inspector, query all the Connected Apps in your Salesforce

  2. Select, “Use Tooling API”

  3. SELECT Id, Name FROM ConnectedApplication

  4. The generated Output should look something like this

Step 3.3: Export that List and add it to a new spreadsheet in which you pasted the Event Monitoring Logs from Step 1.

  1. Since the query outputs an 18 digit Salesforce Id and the Event Monitoring Logs output a 15 Digit Id, you need to truncate the last 3 digits of the 18 digit Id that you retrieved.

  2. Add those 15 digit Ids into a new column.

  3. In the sheet where you pasted the query from Step 3, add a new column to the sheet and use the formula =LEFT(A1,LEN(A1)-3).

  4. From the sheet where you have the Event Monitoring Logs pasted in perform a vLookup against the Column that says CONNECTED_APP_ID to the sheet where the Column 15 Digit Id starts.

    1. =Vlookup(B2,'SOQL Output'!B:C,2,0)

    2. Note the SOQL Output is the sheet I named from the query generated in Step 3.

  5. Review your data and created a pivot table to get the # of API calls made from each Connected App.

Id

15 Digit Id

Name

0H44x0000002XsqCAE

0H44x0000002Xsq

CPQ Integration User Connected App

0H44x000000tHluCAE

0H44x000000tHlu

HubSpot

0H44x000000tQBQCA2

0H44x000000tQBQ

SalesforceA

0H44x000000tQBRCA2

0H44x000000tQBR

Salesforce Files

Note:

If the Connected APP ID starts with a Prefix 888 then you must contact Salesforce Support

Step 4: Create an API Usage Notification

On the API Usage Notifications page, you can supply the required values for a rate-limiting notification. The API usage notifications list includes details such as who is getting notified, how often, and at what thresholds. You can create up to ten notifications per organization. To create an API usage notification:

  1. From Setup, enter API Usage Notifications in the Quick Find box, then select API Usage Notifications.

  2. Click New.

  3. Enter the details.

    1. Notification Recipient: The Salesforce user who will receive the notifications.

    2. Threshold: The percentage of the rate limit that, once exceeded in the specified notification interval, triggers a notification to be sent to the specified user. Value must be between 0 and 100.

    3. Notification Interval (Hours): The time period for which the number of requests is measured, in hours. For example, if the interval is 24, the rate must be exceeded in the past 24 hours for a notification to be sent.

Did this answer your question?