Platform
Too many callouts: 101 in Apex
Fix Apex callout limits by reducing requests or splitting work into bounded transactions with safe retries and reconciliation.
One HTTP request per record reaches the callout ceiling quickly during a bulk import. Count the complete integration path before changing its batch size.
The Apex governor reference permits 100 callouts per transaction in both synchronous and asynchronous Apex. A Queueable job doesn’t raise that count. Authentication calls, pagination and retries can consume additional requests beyond the one you expected for each record.
Build the request budget from the worst case
Suppose an operation may use two requests per record plus one shared authentication request. Processing 50 records could require 101 requests. That arithmetic is a planning example, not a benchmark or a recommendation to run at the ceiling.
Ask whether the destination offers a bulk endpoint. Sending a bounded group of records in one request may reduce callouts, but its response must identify which items succeeded. An HTTP success code alone cannot establish that every item was accepted.
For diagnosis, record the callout counters around the integration boundary:
System.debug(LoggingLevel.WARN,
'Callouts: ' + Limits.getCallouts() +
'/' + Limits.getLimitCallouts());
Keep the record-to-request mapping in your investigation notes. Log correlation identifiers, not authorization headers or full customer payloads.
Split work into recoverable transactions
Batch Apex gives each execute scope a transaction. A batch that makes callouts implements Database.AllowsCallouts; its scope must account for requests per record and other limits, including the cumulative timeout.
A Queueable design can also process a bounded set and schedule its continuation. Persist enough progress to resume safely. Avoid putting a list of thousands of records into one job and assuming that asynchronous execution makes the list safe.
The difficult case is an uncertain response. If the remote system accepted a request but the response was lost, a blind retry can duplicate the operation. Use a destination-supported idempotency key or reconcile by a stable operation identifier before retrying.
Test failure paths with the request count
Use HttpCalloutMock in Apex tests to simulate normal responses, rejection, timeout handling and a partially successful bulk response. Assert which records are marked complete and which are eligible for retry.
Test at the chosen scope size with its worst expected request count. Include pagination and token refresh if your implementation performs them. Keep an operator-visible failure queue rather than silently skipping records when the budget is nearly exhausted.
If the same transaction also writes Salesforce records, check callout and DML ordering. Solving the request count doesn’t solve transaction-ordering errors.