A single Salesforce orgs can be utilized by multiple clients. If our clients are calling Salesforce APIs for data upload, data creation etc or we are calling client system to update data, org’s daily API limit consumed. This API limit should not exceed to org’s daily API limit. We should monitor API limit so that our application stay functional. This post will explain about multiple ways to get API consumption limit.
1. System Overview Page
System overview page shows usage data and limits for organization and it also displays messages when you reach 95% of your limit (75% of portal roles).
API Usage section of system overview page shows API requests usage detail of last 24 hours. This limit is aggregate of all API calls made to the organization.
2. Company Information Page
Company information page shows usages based API Request Limit per Month. This will show your org’s API calls aggregated over 30 days.
3. OrgLimits class in Apex
We can use OrgLimits class in apex to get SOAP API requests, Bulk API requests, and Streaming API limits.
This will show limit like below image.
4. Limits REST API
Limts api call will list out all limit information including APIs. For each limit, this API returns the maximum allocation and the remaining allocation based on usage.
we can check this API in workbench also.
API Limit using Limits api call
This will show result like below image. These responses can be saved/used based on limit which we want to explore.
What if API Limit Exceeded
When an org exceeds a limit, all users in that org can be temporarily blocked from making additional calls. Calls are blocked until usage for the preceding 24 hours drops below the limit.
References:
https://help.salesforce.com/articleView?id=dev_force_com_system_overview_page.htm&type=5
https://developer.salesforce.com/docs/atlas.en-us.230.0.api_rest.meta/api_rest/resources_limits.htm