SfSkills Domains Docs GitHub

Home / integration / api-governance-and-rate-limits

api-governance-and-rate-limits

Monitor and govern Salesforce API consumption: per-user limits, org allocation, lightning-rest limits, and backoff. NOT for designing new endpoints — use security/api-security-and-rate-limiting.

Open the skill folder on GitHub


API Governance and Rate Limits

Every org has a total inbound API request allocation per 24-hour period, set by edition and licences, plus a concurrency limit on long-running requests. The allocation is enforced against the aggregate of all API calls to the org, not per user, so one consumer's surge is every consumer's outage. This skill builds attribution (which app and user spend the allocation), a headroom gate for big jobs, a back-pressure client, and an escalation runbook.


Before Starting


Questions to Ask Before Configuring

AskWhy it mattersWhat a good answer adds
Does each integration have its own connected app and user?The allocation is org-wide; attribution needs ConnectedAppIdentifier / UserIdentifier that differ per consumer (gotcha 3).A per-consumer usage table from the first day.
Which APIs does each consumer call?REST, SOAP, Bulk API, Bulk API 2.0, and most Connect REST APIs count toward the allocation; some Salesforce connected apps don't (gotcha 1).A realistic consumption model instead of "Bulk is free".
Does any consumer use Composite Batch or loops of single-record calls?/composite counts as one call; Composite Batch counts each subrequest (gotcha 2).The right composite resource for each call pattern.
How long do the longest requests run?More than 25 concurrent requests of 20 seconds or longer in production returns REQUEST_LIMIT_EXCEEDED (gotcha 4).A concurrency cap in the middleware.
How do clients react to REQUEST_LIMIT_EXCEEDED?The same code covers exhausted daily allocation (403) and concurrency; only one of them recovers by waiting seconds (gotcha 5).A client that checks remaining allocation before retrying.
What alert thresholds and owners exist?/limits is accurate within five minutes and API Usage Notifications email at a set percentage (gotcha 6).70% / 85% alerts with a named responder.
Is the org a paid production org, a sandbox, or Developer Edition?Paid active orgs can go somewhat over the daily limit up to a hard cap; sandboxes, trials, and Developer Edition can't (gotcha 7).Test-environment budgets that don't assume overage headroom.

A governed integration estate adds per-consumer attribution, admission control for large jobs, and clients that read back-pressure, where "just raising the limit" buys more calls for the same uncontrolled consumer to burn.


Core Concepts

What the allocation is

ItemValue (Summer '26 cheat sheet)
Developer Edition total per 24 h15,000
Enterprise / Professional with API100,000 + licences × per-licence calls (Salesforce licence: 1,000) + add-ons
Unlimited / Performance100,000 + licences × per-licence calls (Salesforce licence: 5,000) + add-ons
Full sandbox (not from a template)5,000,000
Concurrent requests ≥ 20 s25 (production and sandboxes), 5 (Developer Edition and trials)
Calls with DebuggingHeaderSeparate 1,000 per 24 h

Worked example from the guide: Enterprise Edition with 15 Salesforce licences = 100,000 + 15 × 1,000 = 115,000 calls. Calls from installed managed packages count against the org.

Reading the meter

GET /services/data/v67.0/limits/ returns DailyApiRequests.Max and Remaining, accurate within five minutes; avoid rapid or concurrent polling. Every REST response carries Sforce-Limit-Info: api-usage=<used>/<limit>. For attribution, ApiTotalUsageEventLog (API 61.0+) records Platform SOAP, REST, and Bulk API requests with ConnectedAppIdentifier, UserIdentifier, ApiFamily, and IsApiLimitCounted:

SELECT ConnectedAppIdentifier, UserIdentifier, ApiFamily, COUNT(Id) calls
FROM ApiTotalUsageEventLog
WHERE IsApiLimitCounted = true AND Timestamp = LAST_N_DAYS:1
GROUP BY ConnectedAppIdentifier, UserIdentifier, ApiFamily
ORDER BY COUNT(Id) DESC
LIMIT 20

Metadata XML: not applicable — governance here is runtime configuration, queries, and client code.


  1. Answer the Questions table; give every consumer its own connected app and integration user.
  2. Schedule a daily /limits read and the ApiTotalUsageEventLog query above; chart Remaining against Max and the top consumers.
  3. Configure API Usage Notifications (Setup > API Usage Notifications) at 70% and 85% with named recipients.
  4. Fix the top consumers: Bulk API 2.0 for volume, /composite (single call) instead of Composite Batch or loops, and the headroom guard from references/examples.md before large jobs.
  5. Run python3 skills/integration/api-governance-and-rate-limits/scripts/check_api_governance_and_rate_limits.py --manifest-dir <integration-repo> — it ERRORs on REQUEST_LIMIT_EXCEEDED handling inside unbounded loops and WARNs on retry-on-429 logic, limit handling that never reads /limits, Composite Batch, and /limits polling faster than once a minute.
  6. Write the escalation runbook: who opens the circuit breaker, who talks to partners, when to buy add-ons.

Decision Guidance

SituationApproachWhy
Hundreds of thousands of rowsBulk API 2.0 jobRequests count; rows don't each cost a call
Several related writes per business event/compositeThe whole series counts as one call
Independent reads batched togetherComposite Batch only if 25 subrequests ≠ 25 separate needsEach Composite Batch subrequest counts
REQUEST_LIMIT_EXCEEDED with allocation remainingExponential backoff with jitter, boundedConcurrency clears as long requests finish
REQUEST_LIMIT_EXCEEDED with none remainingOpen the circuit breaker until the window movesNo retry can succeed

Review Checklist


Salesforce-Specific Gotchas

Full list in references/gotchas.md. The two most misunderstood:

  1. Bulk API 2.0 counts — it is in the list of APIs that count toward the allocation.
  2. The daily limit returns 403, not 429 — with error code REQUEST_LIMIT_EXCEEDED.

Output Artifacts

ArtifactDescription
Governance dashboardRemaining vs Max, top consumers by app and user
Per-consumer quotasAllocation share per integration, enforced in middleware
Headroom guardPre-flight check for large jobs
Escalation runbookThresholds, owners, circuit-breaker rules

Reference Files

FileUse it for
references/examples.mdOvernight ETL at 95% of allocation; a back-pressure-aware client
references/gotchas.mdSeven allocation behaviours with avoidance steps
references/llm-anti-patterns.mdLimit-handling mistakes AI assistants make
references/well-architected.mdPillar framing and the guide lines behind each claim
references/monitoring-queries.md/limits response shape, attribution queries, and threshold arithmetic

Package files