The integration that trips a CRM’s daily API limit is rarely the one that spent it. The count belongs to the whole org, so the error goes to whoever calls next. That may well be the support tool, with an agent halfway through a ticket.
It’s a poor moment to learn where the calls went. Mostly they went on habit: one record per REST call, because the last project worked that way. I’d rather two numbers made the choice, rows per day and how fresh the data has to be, and I’d keep the result as a written budget with a line for every integration.
The numbers from here on belong to Calder Freight. I made the company up, and every figure with it.
Where the 240,000 comes from
Salesforce gives each org a daily allocation of API requests, counted over a rolling 24 hours. On Enterprise Edition that’s 100,000 plus 1,000 for each full user license. Calder has 140 seats, so 240,000, shared by every caller. Go far enough over and requests fail with REQUEST_LIMIT_EXCEEDED.
The org reports where it stands on every REST response:
Sforce-Limit-Info: api-usage=165360/240000
The limits resource says the same thing, and asking costs a call.
The worksheet on an ordinary day
The inventory comes first: each integration gets a row. Its owner supplies rows per day and freshness, meaning how old the data may be when somebody acts on it. Calls per day come from a week of logs, which only works if every integration signs in as its own user.
integration rows/day fresh within API today calls/day share
erp-order-sync
reads 6 objects 2 min REST poll 4,320 1.8%
writes 61,000 15 min REST, 1/row 61,000 25.4%
marketing-sync 48,000 1 hour REST, 1/row 48,000 20.0%
customer-portal 33,600 seconds REST, 1/row 33,600 14.0%
support-desk 17,400 seconds REST, 1/row 17,400 7.3%
warehouse-extract 1,900,000 next morning Bulk 2.0 1,040 0.4%
total 165,360 68.9%
Sixty-nine percent looks comfortable. It’s also an ordinary day. In the last days of each month Calder’s order updates run at about two and a half times normal, so 61,000 writes become 152,500 and the org reaches 256,860 calls. That’s 107 percent, with every integration doing exactly what it was built to do.
The bottom row is the instructive one. The warehouse extract moves more rows than everything above it combined and spends 0.4 percent: 13 query jobs a night, about 80 calls each. Volume alone doesn’t use up the allocation. The API decides how many rows ride on each call.
Reading the API off two columns
A run lasts as long as freshness lets you wait. Count the rows that pile up in that time, then read across.
| Rows per run | Fresh within | API | Cost in calls |
|---|---|---|---|
| One, with a person waiting | Seconds | Single REST call | 1 per row |
| A few related records | Seconds | Composite or Composite Graph | 1 per group |
| Up to about 2,000 | Minutes to an hour | sObject Collections | 1 per 200 rows |
| More than 2,000 | Hours | Bulk API 2.0 job | Tens per job |
| Unknown, whatever changed | Seconds to minutes | Change event subscription | None on this meter |
The 2,000 threshold is the one in Salesforce’s own documentation, and I’ve kept it. Most of the savings hide in the second column. Owners write “real time” there until someone asks what breaks at an hour, and every row further down the table is cheaper.
Two syncs learn to batch
The marketing sync carries campaign engagement, and nobody at Calder acts on that within the hour. An hourly run is about 2,000 rows, or ten calls to sObject Collections, the composite resource that takes 200 records per request. Its 48,000 calls become 240.
The ERP writes keep their 15 minutes, because account managers watch order status all day. A writer that flushes at 200 rows or 15 minutes, whichever comes first, makes 305 calls in full batches. Partial flushes add 96 at most.
The bill for batching arrives as partial failure. One response now holds 200 outcomes, and an HTTP 200 says nothing about row 117. The sync has to read every result and retry failures by row.
The poller becomes a subscriber
The ERP sync also polls six objects every two minutes. That’s 4,320 queries a day, most of them answered with nothing. It fits the table’s last row: nobody can say how many rows will change, and the ERP wants them soon. So Calder enables Change Data Capture on the six objects and the connector subscribes through the Pub/Sub API. Event delivery has its own allocation, and the 4,320 disappears from this one. Changes also arrive in seconds instead of minutes.
Subscribing has costs polling never had. An org can select five objects for change events before Salesforce asks for an add-on license. Calder needs six, so that license is part of the price. The bus keeps events for 72 hours, so the connector has to save its replay ID as it goes, and a longer outage ends in a backfill by Bulk query. I’d write that backfill before go-live.
The new total is 52,585 calls, 22 percent of the allocation. Month-end adds 458.
The file the worksheet turns into
# api-budget.yml
# Calder Freight is a made-up company. One entry per integration.
org:
daily_allocation: 240000 # rolling 24 hours
alert_at_pct: 70 # 168,000 calls
integrations:
- name: erp-order-sync
owner: order-systems
rows_per_day: 61000
freshness: 15m
api: collections # writes; reads arrive as change events
calls_per_day: 305
share_pct: 0.13
alert_at_calls: 1000
- name: marketing-sync
owner: marketing-ops
rows_per_day: 48000
freshness: 1h
api: collections
calls_per_day: 240
share_pct: 0.10
alert_at_calls: 600
- name: customer-portal
owner: web-platform
rows_per_day: 33600
freshness: 5s
api: rest
calls_per_day: 33600
share_pct: 14.00
alert_at_calls: 45000
- name: support-desk
owner: support-tools
rows_per_day: 17400
freshness: 5s
api: rest
calls_per_day: 17400
share_pct: 7.25
alert_at_calls: 24000
- name: warehouse-extract
owner: data-platform
rows_per_day: 1900000
freshness: 24h
api: bulk2
calls_per_day: 1040
share_pct: 0.43
alert_at_calls: 1600
Two fields carry the headroom. calls_per_day is what a normal day costs. alert_at_calls is where the owner wants to be told, sized from their worst day: the ERP sync’s month-end is about 860 calls with partial flushes, so its ceiling is 1,000.
The file lives in a repository with a small check on it. Shares have to match the arithmetic, and the ceilings together have to fit under the org’s alert line, which they do at 72,200 of 168,000. A new integration starts as a new entry, so somebody states rows and freshness in review, while the design is still cheap to change.
A 70 percent alert with an owner’s name on it
Every integration already gets the org’s running count back in a header. I’d have each one log it beside its own tally and point the monitor at the logs, so watching the limit costs nothing against it. Past 168,000 in the window, the alert lists the lines that are over their own ceilings.
I’d set the line at 70 because the remaining 72,000 calls are what a retry storm or a one-off data fix will eat while someone is still reading the alert.
One derived number goes on the same chart: the org’s count minus the sum of the lines’ tallies. Whatever is left over came from callers the file doesn’t know about.
Calder has 95,800 calls between its ceilings and its alert line. Whoever proposes the sixth integration will see that number before they’ve chosen an API.