---
schema_version: "1"
id: 14511c773e3f39ac11f9af55ab2564c9793e3bf57d55b65e3ccddaf63cde67d9
title: Create or Edit a Named Credential
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/nc_create_edit_named_credential.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.nc_create_edit_named_credential.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: e63a5ff8cdc68eecaf5ef04d59aef6552f391e0273afdc6b5b87093a6afd6400
description: Configure a named credential to specify the URL of a callout endpoint. To specify the required authentication parameters for the callout, connect the named credential to an external credential.
products:
  - Security
release: "264"
---
# Create or Edit a Named Credential

Configure a named credential to specify the URL of a callout endpoint. To specify the required authentication parameters for the callout, connect the named credential to an external credential.

### 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: both Salesforce Classic (not available in all orgs) and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: all editions</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d82707e41">User Permissions
              Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e41 ">To view named credentials:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e41 ">View Setup and Configuration</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e41 ">To create, edit, or delete named credentials:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e41 ">Manage Named Credentials or Customize Applications</td>

          </tr>
        </tbody>
      </table>

Before creating a named credential, you must create an external credential to link it to. See [Create or Edit an External Credential](https://help.salesforce.com/s/articleView?id=xcloud.nc_create_edit_external_credential.htm&release=264.0.0&type=5 "To use named credentials, you must first configure an external credential. The external credential represents the details of how Salesforce authenticates to an external system via an authentication protocol."). For an overview of the steps required to configure a named credential, see [Create Named Credentials and External Credentials](https://help.salesforce.com/s/articleView?id=xcloud.nc_named_creds_and_ext_creds.htm&release=264.0.0&type=5 "To simplify the setup of authenticated callouts, create an external credential to specify an authentication protocol and then specify a named credential as the callout endpoint. Add custom headers to cover more use cases and security requirements. Use a permission set or profile to grant access so that users can make authenticated callouts. You can create and configure named credentials programmatically or through the Salesforce UI.").

1. From [Setup](https://help.salesforce.com/s/articleView?id=xcloud.basics_nav_setup.htm&type=5&language=en_US), use the Quick Find box to find and select **Named Credentials**.
2. Click **Named Credentials**.
3. To create a new named credential, click **New**. To edit an existing named credential, click its link in the list of named credentials and then click **Edit**.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-security-264-0-0-production-enus/8cecd769-ab2d-4e07-addf-c4f2927925e1/images/icon_note.png)
    
    Note If you want to create a legacy named credential, select **New Legacy** from the dropdown menu instead and follow the instructions in [Define a Legacy Named Credential](https://help.salesforce.com/s/articleView?id=xcloud.named_credentials_define.htm&release=264.0.0&type=5 "Create a legacy named credential to specify the URL of a callout endpoint and its required authentication parameters in one definition. You can then specify the legacy named credential as a callout endpoint to let Salesforce handle all authentication. You can also skip remote site settings, which are otherwise required for callouts to external sites, for the site defined in the legacy named credential."). Legacy named credentials are no longer updated or enhanced.
4. Complete the fields.
    
    <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:25%">
              <col style="width:75%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d82707e133">Field</th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d82707e135">Description</th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e133 "><strong class="uicontrol">Label</strong></td>
                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e135 ">A user-friendly name for the named credential that’s displayed in the Salesforce
                  user interface, such as in list views.</td>
              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e133 "><strong class="uicontrol">Name</strong></td>
                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e135 ">
                  <p>A unique identifier that’s used to refer to this named credential from callout
                    definitions and through the API.</p>
                  <p style="margin-bottom:0;">The name can contain only underscores and alphanumeric
                    characters. It must be unique, begin with a letter, not include spaces, not end with an
                    underscore, and not contain two consecutive underscores.</p>
                </td>
              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e133 "><strong class="uicontrol">URL</strong></td>
                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e135 ">
                  <p>The URL or root URL of the callout endpoint. Must begin with <code>https://</code>. Can include a path but not a query string. For
                    example:</p>
                  <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>https://my_endpoint.example.com/secure/payroll</code></pre>
                  <p>You can, however, append a query string and a specific path in the callout definition’s
                    reference to the named credential. </p>
                  <p>For example, an Apex callout could reference the named credential “My_Payroll_System”
                    as follows.</p>
                  <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>HttpRequest req = new HttpRequest();
req.setEndpoint('<strong>callout:My_Payroll_System/paystubs?format=json</strong>');</code></pre>
                </td>
              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e133 "><strong class="uicontrol">Enabled for Callouts</strong></td>
                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e135 ">By default, the ability to make callouts with the named credential is turned on. There are
                  two exceptions where this field is turned off: When the named credential is created from
                  an Apex application or when any endpoint in the named credential or its related external
                  credential or auth identity provider is updated from an Apex application. Be aware of
                  security considerations when enabling callouts for named credentials that originate from
                  or are updated from Apex.</td>
              </tr>
              <tr class="">
                <td class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" headers="d82707e133 d82707e135 "><strong>Authentication</strong></td>
              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e133 "><strong class="uicontrol">External Credential</strong></td>
                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e135 ">The name of an external credential. See <a href="https://help.salesforce.com/s/articleView?id=xcloud.nc_create_edit_external_credential.htm&amp;release=264.0.0&amp;type=5" title="To use named credentials, you must first configure an external credential. The external credential represents the details of how Salesforce authenticates to an external system via an authentication protocol.">Create or Edit an External Credential</a>.</td>
              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e133 "><strong class="uicontrol">Client Certificate</strong></td>
                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e135 ">Optional. If you specify a certificate, your Salesforce org supplies it when
                  establishing each two-way SSL connection with the external system. The certificate is used
                  for digital signatures, which verify that requests are coming from your Salesforce
                  org.</td>
              </tr>
              <tr class="">
                <td class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" headers="d82707e133 d82707e135 "><strong>Callout Options</strong></td>
              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e133 "><strong class="uicontrol">Generate Authorization Header</strong></td>
                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e135 ">
                  <p>By default, Salesforce generates an authorization header and applies it to each
                    callout that references the named credential.</p>
                  <p>Deselect this option only if one of the
                    following statements applies.</p>
                  <ul>
                    <li>The remote endpoint doesn’t support authorization headers.</li>
                    <li>You’re generating an authorization header by creating a custom header and naming it
                      ‘Authorization’. For example, create a custom authorization header if you’re using HTTP
                      Basic authorization. Likewise, in Apex callouts, you can have the code construct a
                      custom authorization header for each callout.</li>
                  </ul>
                  <p style="margin-bottom:0;">This option is required if you reference the named credential from an external
                    data source. See <a href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_named_credentials_custom_headers_bodies.htm" target="_blank">Custom Headers
                      and Bodies of Apex Callouts That Use Named Credentials</a>.</p>
                </td>
              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e133 "><strong class="uicontrol">Allow Formulas in HTTP Header</strong></td>
                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e135 ">
                  <p>Use credential fields as formula fields in named credential custom headers, external
                    credential custom headers, and Apex HTTP headers. For example:</p>
                  <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>Client-ID: {!$Credential.MyExtCred.MyClientId}</code></pre>
                  <p style="margin-bottom:0;">Defaults to false. See <a href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_named_credentials_custom_headers_bodies.htm" target="_blank">Custom Headers
                      and Bodies of Apex Callouts That Use Named Credentials</a>.</p>
                </td>
              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e133 "><strong class="uicontrol">Allow Formulas in HTTP Body</strong></td>
                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e135 ">Allow Apex to construct the callout’s HTTP body with credential fields available as
                  formula fields. Defaults to false. See <a href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_named_credentials_custom_headers_bodies.htm" target="_blank">Custom Headers
                    and Bodies of Apex Callouts That Use Named Credentials</a>.</td>
              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e133 "><strong class="uicontrol">Outbound Network Connection</strong></td>
                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e135 ">
                  <p>Use a private connection that bypasses the public internet. Enter the name of an
                    existing outbound network connection. See <a href="https://help.salesforce.com/s/articleView?id=xcloud.private_connect_overview.htm&amp;type=5&amp;language=en_US" target="_blank">Secure
                      Cross-Cloud Integrations with Private Connect</a>.</p>
                  <p style="margin-bottom:0;">If you choose this option, your
                    new named credential has <samp class="parmname">PrivateEndpoint</samp> as its type. Otherwise the
                    named credential has a <samp class="parmname">SecuredEndpoint</samp> type.</p>
                </td>
              </tr>
              <tr class="">
                <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e133 "><strong class="uicontrol">Allowed Namespaces for Callouts</strong></td>
                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d82707e135 ">
                  <p>Optional list of namespaces that identifies the managed packages that are allowed to
                    make callouts using this named credential.</p>
                  <ul>
                    <li>For managed packages, the subscriber must add the package’s namespace to a named
                      credential’s list of allowed namespaces to enable callouts. This action isn’t necessary
                      if the named credential is installed as part of the same package.</li>
                    <li>If you have multiple orgs, you can create a named credential with the same name but
                      with a different endpoint URL in each org. You can then package and deploy—on all
                      the orgs—one callout definition that references the shared name of those named
                      credentials. For example, the named credential in each org can have a different endpoint
                      URL to accommodate differences in development and production environments. If an Apex
                      callout specifies the shared name of those named credentials, the Apex class that
                      defines the callout can be packaged and deployed on all those orgs without
                      programmatically checking the environment.</li>
                  </ul>
                  <p style="margin-bottom:0;">Named credentials aren’t automatically added to packages. If you package an
                    external data source or Apex code that specifies a named credential as a callout
                    endpoint, add the named credential to the package. Alternatively, make sure that the
                    subscriber org has a valid named credential with the same name.</p>
                </td>
              </tr>
            </tbody>
          </table>
5. Click **Save**. You’re taken to the Named Credentials screen.
6. Optionally, create a custom header for this named credential or edit an existing custom header. See [Create and Edit Custom Headers](https://help.salesforce.com/s/articleView?id=xcloud.nc_create_custom_headers.htm&release=264.0.0&type=5 "Use custom headers to make unique secure connections to external data sources.").

To reference a named credential from a callout definition, use the named credential URL. A named credential URL contains the scheme `callout:`, the name of the named credential, and an optional path. For example: `callout:`My\_Named\_Credential`/`some\_path.

You can append a query string to a named credential URL. Use a question mark (?) as the separator between the named credential URL and the query string. For example: `callout:`My\_Named\_Credential`/`some\_path`?format=json`.

You’ve finished the main steps to create a named credential. Next, grant access to external credential principals and user external credentials to authorize users to make authenticated callouts.

#### See Also

- [_Metadata API Developer Guide_: NamedCredential](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_namedcredential.htm)
- [_Tooling API Developer Guide_: NamedCredential](https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_namedcredential.htm)
- [_Apex Developer Guide_: NamedCredentials Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_NamedCredentials_static_methods.htm#apex_ConnectAPI_NamedCredentials_methods)