Analyze API Usage in Salesforce

API usage in Salesforce

How to Review and Troubleshoot Salesforce API Usage

Understanding your Salesforce API usage is critical for ensuring that your data automation continues to run. At times you'll want to understand in detail how various apps use the Salesforce API. This article explains how to do that step-by-step.

For more about managing Salesforce API, see our article How to Create a Detailed Salesforce API Usage Report and Manage Your API Calls.

When Insycle Uses Salesforce APIs

There are three cases when Insycle will use Salesforce APIs:

  1. During initial data onboarding - That is, right after trial signup - Insycle will consume APIs proportional to the number of accounts, contacts, leads, and opportunities in the database.
  2. When data is modified through Insycle - Such as when records are deduplicated, bulk updated, imported from CSV, or when Recipes are executed, etc., it is processed by Insycle.
  3. During regular data sync - Data is synced between Salesforce and Insycle on an ongoing basis. The sync is efficient and only looks for modified records. That is, if no record was modified, Insycle wouldn't sync any record and won't consume any APIs. However, even when you don't make updates in Insycle, it will still consume APIs based on the number of records that were modified directly in Salesforce by (i) users, (ii) automations, or (iii) other apps, as those changes need to be synced back to Insycle.

Reviewing API Usage

Insycle's API Usage Page

The API quota is per 24-hour period. In Insycle, you can check what's available under Settings > API Usage.

For each CRM account and database, you can review details about your API usage:

  1. Used – Number of API calls consumed by Insycle today.
  2. Quota – Number of API calls allocated to Insycle.
  3. Watermark – Minimum number of APIs that need to be available. If the remaining APIs are below that value, Insycle will pause and not consume APIs.
  4. Overall Used – Number of APIs consumed by all apps in your CRM database (including Insycle).
  5. Overall Quota – Number of API calls available to all apps.

api-usage-w-numbered-headings.png

Get a Basic Overview of API Usage from Salesforce

To see how many API calls have been made in the last 24 hours, in Salesforce navigate to Setup > Environments > System Overview

setup-system-overview-api-use.png

You can also review API calls made by user and date for the last 7 days; you'll need to switch to Salesforce Classic mode as it is not available in Lightning.

Navigate to Reports > Administrative Reports and find the “API Usage in the Last 7 Days” report. This report shows the API usage and API requests by users for the last 7-days, including the current day. This is useful for staying within your API limit and monitoring usage.

salesforce-classic-reports-API-usage.png

These reports offer a good start and provide a way to monitor overall usage.

Get a Breakdown of API Usage by App from Salesforce Workbench

You can use the event logging in Salesforce Workbench to get granular API usage information by app. 

Follow these steps to get detailed API usage data:

  1. Log in to Salesforce Workbench: https://workbench.developerforce.com/login.php 
  2. Click queries, then SOQL Query.SOQL Query Workbench Salesforce
  3. Select the EventLogFile Object
  4. Issue the following query:

    SELECT ApiVersion,CreatedById,CreatedDate,EventType,Id,IsDeleted,LastModifiedById,LastModifiedDate,LogDate,LogFile,LogFileContentType,LogFileFieldNames,LogFileFieldTypes,LogFileLength,SystemModstamp FROM EventLogFile

    salesforce-workbench-query.png

  5. In the LogFile column of the Query Results, double-click on the very long string to copy it to the clipboard.
  6. Paste the entire string into a decoding tool such as Base64 decoder and click Decode to translate the string into a plain text CSV format.
    base64-decoder.png
  7. Copy the plain text to any text editor and save it as log.csv.
  8. Open the log.csv in Excel or a similar application to aggregate and analyze API calls by date, time, and SOURCE_IP. The last column, SOURCE_IP is the IP of the app that made the API call. Once you connect your IPs to apps, you have a full breakdown of which apps and integrations made what API calls and when. 

Troubleshooting API Issues

If you see the following error message in Insycle, "Internal error (Quota exhausted (used=40000 quota=40000))," this indicates the API quota for the day has been used up.

Causes for Sudden Spike in Salesforce API Usage

If you see a sudden sharp increase in Salesforce API usage after Insycle's initial onboarding sync, there are several possible causes:

  • Someone in your company did a big import or bulk update directly in Salesforce. This affected numerous records, and as a result, Insycle had to consume APIs to sync and stay current with the changed records.
  • Another installed app did a big import or bulk update directly in Salesforce. As a result, Insycle had to sync to stay current with the changed records, which consumed APIs.
  • A Salesforce admin introduced a daily script or APEX code that modifies the records automatically every day. Therefore, instead of syncing only the net user-modified records, Insycle has to consume many APIs to sync back the automatically changed records daily.

Troubleshooting Tip

Check with your team to see if anyone:

  • Ran a big update or import in Salesforce
  • Installed a new app
  • Created a new Flow that regularly modifies large numbers of records
  • Introduced a daily script/APEX code that automatically modifies numerous records
Options When Out of API Calls

When you run out of your allotted API calls on Salesforce, Insycle operations will not be able to run.

If you find that you are running out of calls, there are a few resolution options to consider: 

  • Analyze what is using the APIs. Your API calls may have been drained by a one-off spike from another app. But if this happens often and you're unsure which other app is consuming Salesforce APIs, you can generate a report of API usage across all apps using the steps detailed above.
  • Buy more APIs from Salesforce. If you need more, you can buy Salesforce API add-ons directly from Salesforce. The price of additional APIs is $25/month per 10K APIs. See Salesforce's Add-on Pricing PDF for details.
  • Request an Insycle API allocation change. Contact Insycle support to ask about modifying the Insycle APIs quota allocation. If it's available for your account, there is no cost to change these controls.
  • Request a temporary daily API limit increase from Salesforce. Contact your SFDC Account Executive and ask for a temporary, complimentary daily API limit increase. See the Salesforce help article, Temporary Daily API Request Limit Increase for Emergencies.
  • Wait for your API allotment to refresh. Because the limits are set daily, you also have the option to wait until more API calls become available the next day. 

Additional Resources

Information from Salesforce

Related Help Articles

Related Blog Posts