---
schema_version: "1"
id: 40246302dad9112040f21ad967d22c4d1600ed0450f784c47cd8118f7dc2869e
title: Asynchronous Callback Operations Using Apex
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/external_services_async_ops.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.external_services_async_ops.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: dc4fbd358601a7c9ed41dfd3d611dac0963e339c5ce9103664c5bfbae5e300fc
description: Use Apex to create, test, and monitor asynchronous callbacks. Callbacks are right for integrations that require potentially delayed responses of more than 120 seconds from an external source. For example, a mortgage application API, a shipping notification API, or a payment confirmation API.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Asynchronous Callback Operations Using Apex

Use Apex to create, test, and monitor asynchronous callbacks. Callbacks are right for integrations that require potentially delayed responses of more than 120 seconds from an external source. For example, a mortgage application API, a shipping notification API, or a payment confirmation API.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_note.png)

Note External Services' asynchronous callback operations are supported in Apex but not in Flow.

- **[How External Services Asynchronous Callbacks Work](https://help.salesforce.com/s/articleView?id=platform.external_services_async_ops_example.htm&release=264.0.0&type=5)**  
    External Services asynchronous operations are described in an OpenAPI 3.x compliant specification with a callback operation. Asynchronous operations are registered by the system as a special type of invokable action that allows for longer response times. In contrast, External Services synchronous operations time out after 120 seconds. With asynchronous operations, you use Apex to define the callback and the time out for the delayed asynchronous response.
- **[Validate Support for Callback URL Expressions](https://help.salesforce.com/s/articleView?id=platform.external_services_async_ops_validate_support.htm&release=264.0.0&type=5)**  
    Verify that your callback URL expression is supported and registered by External Services as an asynchronous action.
- **[Use Apex to Create an Asynchronous Callout to an External Service](https://help.salesforce.com/s/articleView?id=platform.external_services_async_ops_create.htm&release=264.0.0&type=5)**  
    When you register a schema containing a callback, External Services creates an invocable Apex operation with an automatically generated Apex class. Salesforce creates a callback URL on the asynchronous callout (initial callout) that’s read-only. Create an Apex client that’s capable of handling the callback by using the generated Apex interfaces. The client waits for an asynchronous response from the external system for an extended time (up to twenty-four hours).
- **[Edit an Asynchronous Callout Class Definition](https://help.salesforce.com/s/articleView?id=platform.external_services_async_ops_edit.htm&release=264.0.0&type=5)**  
    To edit an External Services asynchronous callback class, a related background operation job can't be running.
- **[Create Unit Testing for Asynchronous Callouts](https://help.salesforce.com/s/articleView?id=platform.external_services_aysnc_ops_testing.htm&release=264.0.0&type=5)**  
    You can use the `ExternalServiceTest` method to mock callback and asynchronous responses.
- **[Monitor and Debug Asynchronous Callouts](https://help.salesforce.com/s/articleView?id=platform.external_services_async_ops_monitor.htm&release=264.0.0&type=5)**  
    Asynchronous callouts are monitored as jobs using the Background Operations app or with Apex log lines in the Developer Console. To debug your code at runtime, use Apex log lines.