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.
There are three cases when Insycle will use Salesforce APIs:
- 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.
- When data is modified through Insycle - For example, when records are deduplicated, mass updated, imported from CSV, etc., from Insycle.
- 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
The API quota is per 24-hour period. In Insycle, you can monitor how many are available under Settings > API Usage.
For each CRM account and database, you can review details about your API usage:
- Used – Number of API calls consumed by Insycle today.
- Quota – Number of API calls allocated to Insycle.
- 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.
- Overall Used – Number of APIs consumed by all apps in your CRM database (including Insycle).
- Overall Quota – Number of API calls available to all apps.
To see how many API calls have been made in the last 24 hours, in Salesforce navigate to Setup > System Overview.
Similarly, to see the calls made by user and date for the last 7 days, go to Reports > Administrative Reports and view the "API Usage Last 7 Days" report.
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:
- Log in to Salesforce Workbench: https://workbench.developerforce.com/login.php
- Click queries, then SOQL Query.
- Issue the following query:
SELECT ApiVersion,CreatedById,CreatedDate,EventType,Id,IsDeleted,LastModifiedById,LastModifiedDate,LogDate,LogFile,LogFileContentType,LogFileFieldNames,LogFileFieldTypes,LogFileLength,SystemModstamp FROM EventLogFile
- In the LogFile column of the Query Results, double-click on the very long string to copy it to the clipboard.
- 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.
- Copy the plain text to any text editor and save it as log.csv.
- 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
You may see the following error message in Insycle when trying to run an operation, "Internal error (Quota exhausted (used=40000 quota=40000))." This indicates the API quota for the day has been used up.
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 app that you have installed 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 on a daily basis.
Check with your team to see if someone ran a big update or import in Salesforce, installed a new app, or introduced a daily script/APEX code that modifies many records automatically.
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 APIs, there are a few resolution options to consider:
- Analyze what is using the APIs. Your APIs may have been drained by a one-off spike from another app. But if this happens often and you're not sure 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. Reach out to 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 APIs become available the next day.
Information from Salesforce
- API Calls, Reports, and Limits FAQ
- Trailhead Event Monitoring
- REST API Developer Guide - Using Event Monitoring
- Salesforce's Add-On API Pricing PDF
Related Help Articles
- Link and Associate People to Companies
- Associate or Link Parent-Child Companies, Create Accounts Hierarchy, and Relationships
- Declutter and Purge Low-Quality Data
Related Blog Posts