Sub topic 9
Monitoring in Setup and API usage notifications
This chapter assumes you know what the daily API request limit is, and that you have read usage from the REST Limits resource and the Sforce-Limit-Info header. Those methods are good for code. Setup pages and notifications let an administrator see usage and get warned without writing any code.
What Setup shows you
Salesforce reports API usage in a few places in Setup. Menu names and locations change between releases, so use the Quick Find box to locate them.
- System Overview shows the current API request count against the daily maximum, plus other limits such as data and file storage.
- Company Information shows the org's edition and the license-based figures that feed the API limit.
- Connected Apps OAuth Usage lists each connected app with its user count and recent use. This helps you find which integrations are active.
The System Overview figure is a quick check. It is not an alert, and it does not say who made the calls.
API usage notifications
An API usage notification is a rule that emails people when the org's API usage crosses a threshold. You set it up once and Salesforce watches the limit for you.
To create one:
- In Setup, enter API Usage Notifications in Quick Find and open it.
- Click New.
- Choose who receives the email. This can be a user or an email address.
- Pick a Usage Threshold as a percentage of the daily limit, such as 80%.
- Set how often Salesforce may send the notice, for example once per 24 hours.
- Save the notification.
You can create several rules with different thresholds. Each rule has its own recipient and threshold.
Choosing thresholds
A single notification at 100% arrives too late, because requests are already failing with REQUEST_LIMIT_EXCEEDED. Use tiers instead.
| Threshold | Purpose | Suggested recipient |
|---|---|---|
| 50% | Early signal that usage is trending high | Integration owner |
| 80% | Time to investigate and slow down | Integration owner and admin |
| 95% | Urgent, failures are close | Admin and on-call contact |
Pick values from your own normal pattern. If an org normally peaks at 40% each day, a 50% rule will fire often and people will start ignoring it.
Combining Setup with code
Setup notifications tell you that a threshold was crossed. They do not tell you which client caused it. Pair them with the tools from earlier chapters:
- A notification arrives.
- You call the Limits resource to confirm the current
Remainingvalue. - You check Connected Apps OAuth Usage to see which apps are active.
- If that is not enough, you look at event log files, covered in the next chapter.
Common errors
- No email arrives. Check that the recipient address is correct and that the notification is active. Also check spam filters, because the sender is a Salesforce system address.
- Notifications seem too late. The threshold may be set too high, or the frequency setting may be suppressing repeat emails. Add a lower tier.
- The count drops without any action. This is the rolling window. Older requests age out.
- Admin cannot find the page. The page may need a specific permission, such as View Setup and Configuration. Check the user's profile or permission sets.
Exercise
Your org's API usage normally peaks near 30% of the daily limit. A team member proposes a single API usage notification at 100%. Give two reasons this is a poor design and describe a better setup.
Show answer
At 100% the limit is already reached and requests fail with REQUESTLIMITEXCEEDED, so the warning comes too late to act on. A single rule also gives no early signal of a trend. A better setup uses several tiers, for example 50%, 80% and 95%, based on the 30% normal peak so the first rule fires only when usage is unusual. Send each tier to the right recipients, and use a shared alias for the urgent ones.