How to Set Up a Named Credential for Pardot (Account Engagement) in Salesforce

Integrating Pardot with Salesforce using Named Credentials ensures secure, scalable, and manageable API communication. Here’s a step-by-step walkthrough to configure Named Credentials using External Credentials with JWT Bearer Flow authentication.
Prerequisites
Pardot (Account Engagement) with Salesforce SSO enabled
Salesforce admin access
A Connected App in Salesforce (with JWT flow enabled)
📌 Step 1: From Salesforce Setup, search "App Manager" in the Quick Find bar, click the result
Click Create New Connected App
Fill out some Basic Information
Connected App Name: Flow Actions for Pardot
API Name: just let it auto complete
Contact Email: use your email address
Description: Grants Flow Actions for Pardot API access
Check the Enable OAuth Settings, fill out more OAuth details:
Enable for Device Flow: leave unchecked!
Callback URL: https://login.salesforce.com/services/oauth2/callback (replace login.salesforce with test.salesforce for a Sandbox)
Use digital signatures: check
Choose File: pick the Certificate you downloaded as part of the previous section. This will need to be replaced each year.
Selected OAuth Scopes: pardot_api and offline_access
Click Save
Copy the Consumer Key and paste it somewhere easy to access for later use (this is a bit different from when the video was recorded)
Click the Manage Consumer Details button (you might be asked to login again).
(currently) you will land in a Salesforce Classic Screen. Clicking the Copy button under Consumer Key
Close the browser tab (bringing you back to the LIghtning page you were on)
Click Manage
Click Edit Policies
Change "Permitted Users" from "All users may self-authorize" to "Admin approved users are pre-authorized"
Click Save, which brings us back to the "Manage Connected App" screen
Pre-approve the user(s) you want to use by either adding their Profile, or a Permission set you create specifically for this.
One Option: Create Empty Permission Set
A Permission Set is used to pre-authorize a User to use the Connected App to connect to the Pardot API.
In Salesforce Lightning, Navigate to Setup
Navigate to Permission Sets under Administration > Users, click on New
Use the following values (or use whatever makes sense for you)
Label: Pardot API Access
API Name: let it auto populate
Description: Grants access to Pardot via API. No permissions specified
Click Save
Add the new Permission Set to the User created/chosen above
When viewing the Permission Set, click Manage Assignments
Click Add Assignments, and select the correct User
🔑 Step 2: Create External Credential
Go to Setup > Named Credentials > External Credentials
Click New External Credential
Fill the details:
Label:
Pardot_External_Cred
Authentication Protocol : OAuth 2.0
Authentication Protocol: JWT Bearer Token Flow
Audience:
https://login.salesforce.com
Identity Provider URL (or)Token Endpoint URL:
https://login.salesforce.com/services/oauth2/token
JWT Expiration (Seconds):
600
(for 10 minutes)Subject: Salesforce username of the Pardot-connected user
Issuer: Client Key (or) Consumer Key from the Connected App
Signing Certificate: Select the certificate uploaded in the Connected App
Save it
Add a Principal:
Identity Type: Named Principal
Save It.
In the Pardot API Access Permission set,
go to Permission set → External Credential Principal Access,
click Edit, and move the newly created External Credential to ‘Enabled External Credential Principals’.
🔗 Step 3: Create Named Credential
Go to Setup > Named Credentials > New Named Credential
Fill the following:
Label:
Pardot_Named_Credential
Select External Credential and choose the one created above
Authentication Protocol: Custom (Use External Credential)
🧪 Step 4: Test Your Callout
In Apex, use the following:
apexCopyEditHttpRequest req = new HttpRequest();
req.setEndpoint('callout:Pardot_Named_Credential/api/v5/objects/prospects');
req.setMethod('GET');
req.setHeader('Pardot-Business-Unit-Id', 'YOUR_BUSINESS_UNIT_ID');
Http http = new Http();
HttpResponse res = http.send(req);
System.debug(res.getBody());
Subscribe to my newsletter
Read articles from Yogesh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
