Apex Callout Limits and Limitations!

Here are some important points to keep in mind, To help you better understand the limitations and considerations for callouts in Apex code.

1️⃣ A single Apex transaction is limited to a maximum of 100 callouts. 

These callouts can be either to an HTTP request or API call.

2️⃣ In Developer Edition orgs, you can make up to 20 concurrent callouts to endpoints outside of your Salesforce org's domain. 

However, this limit does not apply to non-Developer Edition orgs.

3️⃣ The default timeout for a callout is set to 10 seconds. 

However, you have the flexibility to define a custom timeout for each callout. 

This custom timeout can range from a minimum of 1 millisecond to a maximum of 120,000 milliseconds. 

4️⃣ It's important to note that the cumulative timeout for callouts in a single Apex transaction is limited to 120 seconds. 

This cumulative timeout includes all callouts made within the transaction.

5️⃣ Each org has a limit on long-running requests that run for more than 5 seconds in total execution time. 

However, the processing time for HTTP callouts is not counted towards this limit. 

The timer for the callout is paused during its execution and resumed once completed. 

Refer to Execution Governors and Limits for Lightning Platform Apex limits for more details.

6️⃣ Be aware that you cannot make a callout if there are pending operations within the same transaction. 

Pending operations include DML statements, asynchronous Apex (like future methods and batch Apex jobs), scheduled Apex, or sending email. 

Make sure to perform callouts before these types of operations.

7️⃣ It's important to consider that pending operations can occur before mock callouts within the same transaction. 

To learn more about this, refer to Performing DML Operations and Mock Callouts for WSDL-based callouts or Performing DML Operations and Mock Callouts for HTTP callouts.

Lastly, when making a callout request and including the "Expect: 100-Continue" header, a timeout will occur if the external server does not return a "HTTP/1.1 100 Continue" response.

Follow these limitations and considerations when working with callouts in Apex code to ensure smooth and successful execution.

#Salesforce #Apex #Callouts #SalesforceDeveloper #sfdcsaga

Follow Us

Posted By : Sudeer Kamat Date :

view_module Related

  • Use Third-Party Web Components in LWC (Beta) In #SalesforceWinter24ReleaseUse Third-Party Web Components in LWC (Beta) In #SalesforceWinter24Release
  • Save a Flow Without Configuring Some Elements In #SalesforceWinter24ReleaseSave a Flow Without Configuring Some Elements In #SalesforceWinter24Release
  • Introducing LWC Workspace API In #SalesforceWinter24ReleaseIntroducing LWC Workspace API In #SalesforceWinter24Release
  • Introducing Selective Sandbox Access in #SalesforceWinter24ReleaseIntroducing Selective Sandbox Access in #SalesforceWinter24Release
  • Transfer Ownership of Lightning Dashboards (Beta) In #SalesforceWinter24ReleaseTransfer Ownership of Lightning Dashboards (Beta) In #SalesforceWinter24Release

label Labels

Comments 0