---
schema_version: "1"
id: 7cbae72822d31066bb763a28bed82e357909012d539b0e58bb51d7b11e833098
title: CspTrustedSite
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_csptrustedsite.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_csptrustedsite.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 42c5e66acdeda4396952a3be6cd3b941526836c2075113a2c4f2b12e0f3c5811
description: Represents a trusted URL. For each CspTrustedSite component, you can specify Content Security Policy (CSP) directives and permissions policy directives. Each CSP directive allows Lightning components, third-party APIs, and WebSocket connections to access a resource type from the trusted URL. If the Permissions-Policy HTTP header is enabled, each permissions policy directive grants the trusted URL access to a browser feature. In API version 58.0 and earlier, CspTrustedSite components included only CSP directives and were referred to as CSP Trusted Sites.
---
# CspTrustedSite

Represents a trusted URL. For each CspTrustedSite component, you can specify Content Security Policy (CSP) directives and permissions policy directives. Each CSP directive allows Lightning components, third-party APIs, and WebSocket connections to access a resource type from the trusted URL. If the Permissions-Policy HTTP header is enabled, each permissions policy directive grants the trusted URL access to a browser feature. In API version 58.0 and earlier, CspTrustedSite components included only CSP directives and were referred to as CSP Trusted Sites.

This type extends the [Metadata](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/metadata.htm "The base class for all metadata types. You can’t edit this object. A component is an instance of a metadata type.") metadata type and inherits its fullName field.

## Declarative Metadata File Suffix and Directory Location

CspTrustedSite components are stored in the cspTrustedSites directory of the corresponding package directory. The file name matches the unique name of the trusted site, and the extension is .cspTrustedSite.

![Tip](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note_tip.png)

#### Tip

Some infrastructure limits the maximum size of HTTP headers. If you allow multiple domains to frame content served by your org, keep the size of the CSP header under 12 KB. Salesforce customers report issues when the header size approaches 16 KB, and third parties often add to the header during processing.

## Version

CspTrustedSite components are available in API version 39.0 and later.

## Fields

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d296715e100">Field</th>

              <th class="featureTableHeader  " id="d296715e103">Field Type</th>

              <th class="featureTableHeader  " id="d296715e106">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">canAccessCamera</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">boolean</td>

              <td class="entry" headers="d296715e106" data-title="Description">Indicates whether this CspTrustedSite can access the user’s
                camera (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>). The default value is
                <samp class="codeph nolang">false</samp>.<p class="p">This field takes
                  effect only when the
                  <span class="keyword parmname">enablePermissionsPolicy</span> field equals
                  <samp class="codeph nolang">true</samp> and the
                  <span class="keyword parmname">grantCameraAccess</span> field equals <samp class="codeph nolang">TrustedUrls</samp> in the <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_securitysettings.htm" title="Represents an org’s security settings. For example, settings define trusted IP ranges for network access, password and login requirements, session expiration, and single sign-on settings.">SecuritySettings</a>
                  metadata API type.
                </p>
                <p class="p">This field is available in API version
                  59.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">canAccessMicrophone</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">boolean</td>

              <td class="entry" headers="d296715e106" data-title="Description">Indicates whether this CspTrustedSite can access the user’s
                microphone (<samp class="codeph nolang">true</samp>) or not
                (<samp class="codeph nolang">false</samp>). The default value
                is <samp class="codeph nolang">false</samp>.<p class="p">This field takes
                  effect only when the
                  <span class="keyword parmname">enablePermissionsPolicy</span> field equals
                  <samp class="codeph nolang">true</samp> and the
                  <span class="keyword parmname">grantMicrophoneAccess</span> field equals
                  <samp class="codeph nolang">TrustedUrls</samp> in the
                  <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_securitysettings.htm" title="Represents an org’s security settings. For example, settings define trusted IP ranges for network access, password and login requirements, session expiration, and single sign-on settings.">SecuritySettings</a>
                  metadata API type.
                </p>
                <p class="p">This field is available in API version
                  59.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">context</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">CspTrustedSiteContext (enumeration of type string)</td>

              <td class="entry" headers="d296715e106" data-title="Description">Declares the scope of the CSP directives for this trusted URL.<ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph nolang">All</samp>—Apply the
                    CSP directives to all supported context types.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">Communities</samp>—Apply the CSP directives to
                    Experience Builder sites only.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">FieldServiceMobileExtension</samp>—Apply the
                    CSP directives to the Field Service Mobile Extensions only.
                    This value is available in API version 47.0 and later.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">LEX</samp>—Apply the
                    CSP directives to Lightning Experience pages only.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">LightningOut</samp>—Reserved
                    for future use. Available in API version 64.0 and later
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">VisualForce</samp>—Apply the CSP directives to
                    custom Visualforce pages only. This value is available in
                    API version 55.0 and later.
                  </li>

                </ul>
                <p class="p">For custom Visualforce pages, content is restricted to
                  trusted URLs only if the page’s <samp class="codeph nolang">cspHeader</samp> attribute is set to <samp class="codeph nolang">true</samp>.</p>
                <p class="p">This field is
                  available in API version 44.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">description</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">string</td>

              <td class="entry" headers="d296715e106" data-title="Description">The description of this trusted URL.</td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">endpointUrl</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">string</td>

              <td class="entry" headers="d296715e106" data-title="Description">Required. The URL for this CspTrustedSite.<a name="ul_nmd_kwn_fkc"><!-- --></a>
                <ul class="ul bulletList" id="ul_nmd_kwn_fkc">
                  <li class="li">This field must include a domain name and can include a
                    port. For example, <samp class="codeph nolang">https://example.com</samp> or <samp class="codeph nolang">https://example.com:8080</samp>.
                    To reduce repetition, you can use the wildcard character
                    <samp class="codeph nolang">*</samp> (asterisk). For
                    example, <samp class="codeph nolang">*.example.com</samp>.<p class="p">Don't include placeholders or
                      invalid characters. For example, don't use <samp class="codeph nolang">malformed^url.example.com</samp>, and <samp class="codeph nolang">https://{subdomain}.example.com</samp>. </p>
                  </li>

                  <li class="li">For a third-party API, the URL must begin with https://. For
                    example, <samp class="codeph nolang">https://example.com</samp>.</li>

                  <li class="li">For a WebSocket connection, the URL must begin with wss://.
                    For example, <span class="ph filepath">wss://example.com</span>.</li>

                  <li class="li">For a Chrome extension, use the 32-character extension ID in
                    the format<samp class="codeph nolang">
                      chrome-extension://abcdefghijklmnopabcdefghijklmnop</samp>.
                    The ID can contain only lowercase letters a–p. Wildcards
                    aren’t supported in Chrome extension URIs.</li>

                </ul>
                <p class="p">Before February 2025, it was possible to save a malformed
                  URL. Malformed URLs are excluded from generated CSP HTTP
                  headers. To keep your Trusted URLs list accurate, remove any
                  malformed entries. You can use an Apex class to find all
                  malformed URLs. See the knowledge article, <a class="xref" href="https://help.salesforce.com/s/articleView?id=005317938&amp;type=1&amp;language=en_US" target="_blank">Identify Malformed Trusted
                    URLs</a>.</p>
                <p class="p">To add an <samp class="codeph nolang">EndpointUrl</samp> based on parameters, build the URL
                  before you add it to this Metadata Type.</p>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">isActive</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">boolean</td>

              <td class="entry" headers="d296715e106" data-title="Description">Required. Indicates whether this CspTrustedSite is active
                (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). The default value is <samp class="codeph nolang">true</samp>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">isApplicableToConnectSrc</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">boolean</td>

              <td class="entry" headers="d296715e106" data-title="Description">Indicates whether Lightning components, third-party APIs, and
                WebSocket connections can load URLs using script interfaces from
                this trusted URL (<samp class="codeph java">true</samp>) or not
                (<samp class="codeph java">false</samp>). This field has a
                default value of <samp class="codeph java">false</samp>.<p class="p">This
                  field is available in API version 48.0 and later.</p>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">isApplicableToFontSrc</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">boolean</td>

              <td class="entry" headers="d296715e106" data-title="Description">Indicates whether Lightning components, third-party APIs, and
                WebSocket connections can load fonts from this trusted URL (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). This field has a default
                value of <samp class="codeph java">false</samp>.<p class="p">This field is
                  available in API version 48.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">isApplicableToFrameSrc</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">boolean</td>

              <td class="entry" headers="d296715e106" data-title="Description">Indicates whether Lightning components, third-party APIs, and
                WebSocket connections can load resources contained in <samp class="codeph nolang">&lt;iframe&gt;</samp> elements from this
                trusted URL (<samp class="codeph java">true</samp>) or not
                (<samp class="codeph java">false</samp>). This field has a
                default value of <samp class="codeph java">false</samp>.This field
                is available in API version 48.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">isApplicableToImgSrc</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">boolean</td>

              <td class="entry" headers="d296715e106" data-title="Description">Indicates whether Lightning components, third-party APIs, and
                WebSocket connections can load images from this trusted URL (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). This field has a default
                value of <samp class="codeph java">false</samp>. This field is
                available in API version 48.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">isApplicableToMediaSrc</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">boolean</td>

              <td class="entry" headers="d296715e106" data-title="Description">Indicates whether Lightning components, third-party APIs, and
                WebSocket connections can load audio and video from this trusted URL
                (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). This field has a default
                value of <samp class="codeph java">false</samp>.<p class="p">In API version
                  59.0 and later, for each trusted URL, at least one
                  CSPTrustedSite starting with <span class="keyword parmname">isApplicable</span>
                  or <span class="keyword parmname">canAccess</span> must be set to <samp class="codeph nolang">true.</samp></p>
                <p class="p">In API version 50.0
                  to 58.0, if all <span class="keyword parmname">isApplicable</span> fields are
                  <samp class="codeph java">false</samp>, the
                  <span class="keyword parmname">isApplicableToImgSrc</span> field is set to
                  <samp class="codeph java">true</samp>. In API version 49.0
                  and earlier, if all <span class="keyword parmname">isApplicable</span> fields are
                  <samp class="codeph java">false</samp>, these fields all
                  default to <samp class="codeph java">true</samp>.
                </p>
                This
                field is available in API version 48.0 and later.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">isApplicableToStyleSrc</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">boolean</td>

              <td class="entry" headers="d296715e106" data-title="Description">Indicates whether Lightning components, third-party APIs, and
                WebSocket connections can load style sheets from this trusted URL
                (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). This field has a default
                value of <samp class="codeph java">false</samp>. This field is
                available in API version 48.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d296715e100" data-title="Field"><span class="keyword parmname">mobileExtension</span></td>

              <td class="entry" headers="d296715e103" data-title="Field Type">string</td>

              <td class="entry" headers="d296715e106" data-title="Description">Reserved for future use.</td>

            </tr>

          </tbody>

        </table>

## Declarative Metadata Sample Definition

A sample XML definition of a trusted site is shown below.

<?xml version="1.0" encoding="UTF-8"?>
<CspTrustedSite xmlns="http://soap.sforce.com/2006/04/metadata">
    <canAccessCamera\>false</canAccessCamera\>
    <canAccessMicrophone\>true</canAccessMicrophone\>
    <description\>Used for Lightning component callout to mapping web service</description\>
    <context\>LEX</context\>
    <endpointUrl\>https://www.maptestsite.net/</endpointUrl\>
    <isActive\>true</isActive\>
    <isApplicableToConnectSrc\>true</isApplicableToConnectSrc\>
    <isApplicableToFontSrc\>true</isApplicableToFontSrc\>
    <isApplicableToFrameSrc\>false</isApplicableToFrameSrc\>
    <isApplicableToImgSrc\>true</isApplicableToImgSrc\>
    <isApplicableToMediaSrc\>false</isApplicableToMediaSrc\>
    <isApplicableToStyleSrc\>true</isApplicableToStyleSrc\>
</CspTrustedSite\>

## Usage

For each CSPTrustedSite component, at least one field starting with grantAccess or isApplicableTo must be set to true.

In API versions 50.0 to 58.0, if all isApplicable fields are false, the isApplicableToImgSrc field is set to true. In API version 49.0 and earlier, if all isApplicable fields are false, those fields all default to true.

To ensure smooth integration across Salesforce products, Salesforce includes URLs in each of the CSP directives that correspond to the isApplicable fields, even though those URLs aren’t defined as CspTrustedSite components. Salesforce regularly updates those URLs based on the latest requirements.

## Wildcard Support in the Manifest File

This metadata type supports the wildcard character \* (asterisk) in the package.xml manifest file. For information about using the manifest file, see [Deploying and Retrieving Metadata with the Zip File](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_meta.meta/api_meta/file_based_zip_file.htm).