# How do administrators monitor daily API consumption metrics to prevent unexpected organization rate-limiting blocks?

**Topic:** Integration · **Difficulty:** Medium · **Tags:** Integration, API Monitoring, Usage Limits

Read it on the site: https://www.forcechallenges.com/interview-questions/how-do-administrators-monitor-daily-api-consumption-metrics-to-prevent-unexpected-organization-rate-limiting

## Answer

**Basics:** Each org has a total API request allowance over a rolling 24-hour period. When it is hit, further API calls fail. Integrations share this pool, so one runaway integration can block all of them.

**How it works:**
1. **Limits resource**: `GET /services/data/vXX.0/limits` returns `DailyApiRequests` with `Max` and `Remaining`, plus other limits (bulk, streaming, platform events).
2. **Response header**: every API response includes `Sforce-Limit-Info: api-usage=used/total`.
3. **Setup > System Overview** shows API requests used in the last 24 hours.
4. **Setup > API Usage Notifications** emails admins at thresholds you define.
5. **Apex**: `System.OrgLimits.getAll()` returns org-level limit values; `Limits` class covers per-transaction limits.
6. Event Monitoring (API Total Usage) shows which user or app consumed calls.

**Advanced / deep dive:** The base allocation depends on edition and licenses (for example, Enterprise commonly 100,000 plus per-license additions; verify current numbers). Calls made from Apex within the org do not count; calls into Salesforce APIs from outside do. Bulk API counts batches, not records, which is why bulk is cheaper. Reduce consumption with Composite and sObject Collections, event-driven subscriptions instead of polling, caching, and `If-Modified-Since`/SystemModstamp delta queries. Also watch concurrent API request limits (25 requests running over 20 seconds) and limits on platform event and streaming allocations. Dashboards on Limits data fed into external monitoring give trend alerts.

**Code / config example:**
```text
GET /services/data/v60.0/limits
Authorization: Bearer <token>

Response excerpt:
"DailyApiRequests": { "Max": 100000, "Remaining": 87450 }
```
```apex
Map<String, System.OrgLimit> lim = OrgLimits.getMap();
System.OrgLimit api = lim.get('DailyApiRequests');
Integer pctUsed = (Integer)((api.getValue() * 100.0) / api.getLimit());
```

**Hidden gotchas & must-remember points:**
- The window is a rolling 24 hours, not midnight reset.
- Exceeding the limit returns REQUEST_LIMIT_EXCEEDED to all integrations.
- Bulk API batches count against a separate batch allowance.
- Calls to your own org from Apex do not consume the daily API quota.
- Sandboxes have their own, typically lower, allocation.
- Limits resource names and values should be verified per API version.

**Best practice:** Set threshold notifications, trend usage externally, and cut chatty or polling integrations first.

---
Source: ForceChallenges · last updated 2026-11-02
