Skip to main content

Create the Credentials

Learning Objectives

In this project, you'll:

  • Define settings for requesting data from an external source.
  • Create and assign a permission set that allows users to request external data.
  • Build a flow that requests data from an external source.

Think of a time when you wanted to access data from another source inside your Salesforce org. With all the technicalities around finding an application programmer interface (API), setting up logins, getting access tokens, configuring the communication, and so on, it could be a daunting proposition. Fortunately, there's a feature in Flow Builder that enables admins to request external data declaratively.

The HTTP Callout Action

With the HTTP Callout action, you provide a few details and voilà! External data appears in your org. What are those details, you ask? Well, it varies from one data source to another, but generally speaking, you need the location (URL) for the external data and access to the external data (which usually requires some form of authentication).


In this badge, you learn how to provide the information needed by the HTTP Callout action and how to use the HTTP Callout action in a flow. We'll walk through the steps together and we'll provide the information you need. Outside this badge, the information you need is often on the API provider's web site if the API is public.

How It Works

Here's a high-level overview of how a flow interacts with external data.

  1. The flow sends a request for data (that's the HTTP callout) to the external data source. The request contains the named credential.
  2. The credentials in the request are authenticated by the external data source.
  3. The external data source returns the data (in a response) to the flow that requested it.

Diagram of the HTTP callout process described in the preceding numbered steps.

How to Set It Up

To make all this possible, you define the information needed by the external data source. Later, your flow sends that information in the HTTP callout.

In your org, you define these settings.

  • The named credential, which contains the URL of the external data source and is linked to the external credential.
  • The external credential, which stores the authentication protocol used by the external data source to grant access to its data.
  • The principal, which establishes the name you'll use when you create a permission set to grant users access to the external data. (It also stores any authentication parameters required by the external data source to grant access to its data, but we're not sending any parameters in this project.)

Create a New Trailhead Playground

For this project, you need to create a new Trailhead Playground. Scroll to the bottom of this page, click the playground name, then click Create Playground. It typically takes 2–3 minutes to create a new Trailhead Playground.


Yes, we really mean a brand-new Trailhead playground! If you use an existing org or playground, you can run into problems completing the steps in this project.

Process Overview

In this unit, we create the credentials and permission set. We build the flow and add an HTTP Callout action to it in the next unit.

  1. Create the external credential and its principal.
  2. Create a named credential and link the external credential to it.
  3. Create a permission set granting users access to the principal in the external credential.

Diagram corresponding to the preceding numbered steps.

Let's establish a named credential to hold the information we need to access the animals list.

Create the External Credential

  1. From Setup, enter Named in Quick Find and select Named Credentials.
  2. Select External Credentials.
  3. Click New.
  4. For Label, enter Animals API External.
  5. For Name, enter Animals_API_External.
  6. Set Authentication Protocol to Custom.

Usually, you need to use a standard authentication protocol. But because we created the animals list as an example data source, and it has no sensitive data, it doesn't require authentication.

  1. Click Save.
  2. Under Principals, click New.
  3. For Parameter Name, enter Animals API External.
    Create Principal window with Parameter Name set to Animals API External, Sequence Number 1 and Identity Type Named Principal.
  4. Click Save.

Create the Named Credential

  1. Select Named Credentials.
  2. Click New.
  3. For Label, enter Animals API Named.
  4. For Name, enter Animals_API_Named.
  5. For URL, enter
  6. For External Credential, select Animals API External.
    New Named Credential window with Label, Name, Url, and External Credential fields set as described in the preceding steps 3–6.
  7. Click Save.

Now your flow can connect to the external data source, but we need to give users permission to send the request for the animals data.

Create a Permission Set

Users need permission to use the named credential, so you create a permission set.

  1. In Setup, in the Quick Find box, enter Permission and then select Permission Sets.
  2. Click New.
  3. For Label, enter Animals API.
    API Name auto-fills with Animals_API.
  4. For Description, enter Animals API callout permissions.
  5. Click Save.
  6. In the Apps section, select External Credential Principal Access.
  7. Click Edit.
    Animal API permission set with External Credential Principal Access settings displayed showing 'Animals_API_External - Animals API External' in the Enabled External Credential Principals box.
  8. Move the Animals API External option from Available External Credential Principals to Enabled External Credential Principals.
  9. Click Save.

Assign the Permission Set

Now you assign the new permission set to users.

  1. Click Manage Assignments.
  2. Click Add Assignment.
  3. Select your user.
  4. Click Next.
  5. Click Assign.

Well done! The credentials and permissions are all set and you are ready to build the flow. Let's tackle that next.


Keep learning for
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities