Callouts and Callbacks: Limits and Usage
Limits and best approaches for callbacks and callouts to and from External Services.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions |
- External service callouts aren’t allowed when there are pending, uncommitted
transactions.
- In Flow, close your transaction, and resume Flow using the flow element Pause.
- In Apex, perform the callout before any DML statement such as inserting, updating, or deleting objects. See Callout Limits and Limitations in Apex Developer Guide.
- Callouts to External Services time out after 120 seconds.
External Services Asynchronous Callbacks
The timeout duration of a callback operation is configured in the Apex client, and can be set for a maximum of twenty-four hours.
Accepted callback HTTP methods are PUT and POST. All other methods are ignored.
One callback parameter must contain only one callback operation, as a one-to-many relationship isn’t supported. If one-to-many is detected, only the first callback operation under the callback parameter is processed.
In Example API Specification With Callback Operation, the first callback parameter
is applicationOutcomeApproved. It contains one
callback operation #ref/…/ApplicationApproved.
The third callback parameter is applicationError. It contains one callback operation "{$request.query.callbackUrlForErrorCases}": {"post":
{.....}}} 3.3. We ignore the callback operation response declaration
and always send 200, 404, 408 (timeout), or 500 HTTP response to the callback
sender.
A callback URL can be defined as a query parameter or added to the request body parameter. A callback URL can be:
- a string type
- a property of an object type
- an element of an array
Some valid callback URL expression formats are:
-
'{$request.query.callbackUrl}' -
'{$request.body#/callbackUrl}' -
'{$request.body#/callbackUrl/1}'
Other complex expressions aren't currently supported. For example, expressions with static text combined with variable references, or expressions that have multiple variable references. In these unsupported cases, the callback is considered invalid and the operation is attempted as a synchronous callout with a 120-second time out.
A callback operation can define an operationId. For example, in the Example API Specification With Callback Operation, see:
"operationId": "approvedCallback”
This operationId can’t be duplicated with any
other operationId – with a regular top-level
operation
"operationId": "SubmitApplication”
or any other callback operationId.
If a callback operation doesn’t declare an operationId, Salesforce uses its callback component reference name as
the operationId - in this case - ApplicationRejected.
If the callback operation is declared inline, then its operationId is constructed as
parentAsyncOperationId_CB_callbackParameterName
For example, SubmitApplication_CB_applicationError.

