You are here:
Configure an HTTP Callout Action
HTTP Callout guides you through entering the details about the HTTP web-based service or REST API endpoint that you're connecting to. After you complete the configuration, you invoke the action in a flow. HTTP Callout assumes that you're familiar with the API that you want to call.
Required Editions
| Available in: Lightning Experience |
| View supported editions. |
| User Permissions Needed | |
|---|---|
| To open, edit, create, activate or deactivate a flow using all flow types, elements, and features available in Flow Builder, including Einstein and Agentforce for Flow: | Manage Flow |
| To create an external credential, a named credential, and an HTTP callout action: | Customize Applications |
Before you configure an HTTP callout action:
- Create an external credential and a named credential so that the external service can connect to the API. See Guidelines for Authenticating HTTP Callout Actions.
- Prepare a sample API response in JSON format. If a sample doesn't exist in the API's documentation, you can use a third-party API platform to retrieve a response.
- Start with an API that's well documented. If details such as field requirements or definitions are inaccurate or outdated, it can take time to debug.
-
Open the Flows list view.
- From Setup, in the Quick Find box, enter Flows, and then select Flows.
- From the Automation app, select the Flows tab.
- From the Flows tab in any Lightning app, click the actions menu and select Open Flow.
- Open an existing flow that you want to use the callout in or create one.
- Add an Action element to the flow and click Create HTTP Callout.
-
Configure the external service that connects Salesforce to the HTTP-based API.
- Enter a name for the external service, such as ConnectToMaps. The name must begin with a letter and contain only alphanumeric characters without spaces.
- For reference, enter a description of what the external service is connected to.
-
Select the named credential that you created for this external service.
The URL associated with the credential is autopopulated.
- Click Next.
-
Configure the invocable action that you can use in Flow Builder or across
Salesforce.
- For Label, enter the action that the callout performs, for example, Connect to Maps.
-
Select the operation or method required by the API that you're calling.
Generally, GET brings in external data. The rest of the methods modify data in an external system. The functionality depends on the API.
- Enter a description of the API performing the operation, and include a link to the API document so that you can reference it if you change the callout.
-
Add the URL endpoint for the request.
The base URL shows the Named Credential URL for the external service. If you can't see the entire URL, click the field.
-
Enter the URL path for the endpoint that starts with a slash (/) and doesn't
contain a question mark (?).
The supported characters for a URL path include alphanumeric characters, underscores, slash, and curly brackets.
- If you have path variables, place them in curly brackets, and select the variable's data type. Path variables can contain only alphanumeric characters and underscores.
- Enter the variable's description, including usage details.
-
Enter the URL path for the endpoint that starts with a slash (/) and doesn't
contain a question mark (?).
-
Add query parameter keys if the API you're calling has them. When you use this action
in a flow, you input values for the defined keys.
- Click + Add Key.
- Enter the key value and select the data type.
- To require a value when the action is invoked in a flow, select Require.
- Enter the query parameter key's description, including usage details.
-
For POST, PUT, PATCH, and DELETE, provide a sample API request body. Salesforce
generates a data structure from the sample request.
- Click New.
- Paste a sample JSON request.
- Click Review and confirm that the Apex data structure is correct.
- To make changes, edit the text in Sample JSON Request or select data types from the data structure.
- Click Review.
- Click Done.
-
Provide a sample API response body. Salesforce generates a data structure from the
sample response.
- Click New.
- Paste a sample JSON response.
- Click Review and confirm that the Apex data structure is correct.
- To make changes, edit the text in Sample JSON Response or select data types from the data structure.
- Click Review.
- Click Done.
-
Click Save.
Flow Builder creates the action and external service. The action is available in the Actions window in the flow.
-
For POST, PUT, PATCH, and DELETE, set the body for the flow by creating a resource and
selecting the Apex class for the external server's body.
- For body, select New Resource.
- Enter an API name for the new resource.
-
Enter a description that describes the variable and how it's used.
The data type and Apex class are set for you. The Apex class for the HTTP callout action uses this naming convention: ExternalServiceName__HTTP Callout Label_IN_body. For example, if the external service name is MyCustomES and the label for the new HTTP Callout is Get Accounts, then the Apex class is MyCustomES_Getx20Accounts_IN_body, where x20 represents a space in the label.
- Click Done.
- For body, select the Apex-defined variable that you created.
- Click Done.
To transform the data between Salesforce and the external system in the flow, use the Transform element. For POST, PUT, PATCH, and DELETE methods, you then add an Assignment element before the HTTP callout action. In the Assignment element, assign values for each of the fields on the Apex-defined variable. The HTTP callout action references the Apex-defined variable as the input to create the data in the external server.
Flow Builder creates Apex classes automatically from the inferred data structures to store data that's transferred between Salesforce and the external server. The Apex class naming convention for HTTP callout actions that use the GET method is ExternalServiceName__HTTP Callout Label_OUT_2XX. For example, if the external service name is MyCustomES and the label for the new HTTP Callout is Get Accounts, then the Apex class is MyCustomES_Getx20Accounts_OUT_2XX. To delete an Apex class, delete the external service associated with the Apex class. For more information, see Delete an External Service.

