# Create a New Named Credential

#### Overview

This configuration:

* Stores the SlapFive API key securely using an External Credential
* Injects the API key into requests via a custom HTTP header
* Avoids hard-coding secrets in Apex, metadata, or logs

***

#### Step 1: Create an External Credential

1. In Salesforce Setup, navigate to **External Credentials**
2. Click **New External Credential**

Use the following values:

* **Label:** SlapFive External API
* **Name:** SlapFiveExternalAPI
* **Authentication Protocol:** Custom

Save the record.

***

#### Step 2: Create an External Credential Principal

1. From the External Credential record, create a new **Principal**

Use the following values:

* **Parameter Name (Label):** SlapFive API Key
* **Sequence Number:** 1
* **Identity Type:** Named Principal

2. Under **Authentication Parameters**, add a new parameter:

* **Name:** APIKey
* **Value:** Paste your SlapFive API key here

***

#### Step 3: Add a Custom Header to the External Credential

On the same External Credential, add a **Custom Header**:

* **Header Name:** api-authorization
* **Value:**

  ```
  {!$Credential.SlapFiveExternalAPI.APIKey}
  ```
* **Sequence Number:** 1

This injects the encrypted API key into every request at runtime.

***

#### Step 4: Create a Named Credential

1. In Salesforce Setup, navigate to **Named Credentials**
2. Click **New Named Credential**

Use the following values:

* **Label:** SlapFive API
* **Name:** SlapFive\_API
* **URL:** enter the base URL of your SlapFive instance, which is:\
  &#x20;     <https://your\\_company\\_name.slapfive.com>.
* **External Credential:** SlapFive External API
* **Generate Authorization Header:** Checked
* **Allow Formulas in HTTP Header:** Checked
* **Allowed Namespaces for Callouts:** SlapFiveInc

Save the record.

***

#### Step 5: Grant Access to the External Credential Principal

Users running SlapFive automations must be granted access to the External Credential Principal.

1. Open the target **Profile** or **Permission Set**
2. Find **Enabled External Credential Principal Access**
3. Add the Principal created in Step 2.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.slapfive.com/integrations/salesforce/slapfive-advanced-app/2.-create-a-named-credential/create-a-new-named-credential.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
