---
schema_version: "1"
id: 57fc08a93a4f6a34b63f408ce51f1ed286af1d2b706eb6c3e83d67975f520bbd
title: Create Preference Form Access Tokens with REST API
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/create_access_tokens_rest_api.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.create_access_tokens_rest_api.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: cb0290be363f6f6d224527f1220037beabc9429e0eee9b41b84f83cfcff594c3
description: Create an access token for Preference Manager forms by using REST API.
products:
  - Security
  - Cross Cloud
release: "264"
---
# Create Preference Form Access Tokens with REST API

Create an access token for Preference Manager forms by using REST API.

### Required Editions

After you generate the access token, append the access token string ?pctoken=\[token string\] to the website URL of your published site. Then send this URL to your users to give them access to the preference form without logging in.

<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: <strong>Developer</strong>, <strong>Enterprise</strong>, <strong>Performance</strong>, and <strong>Unlimited</strong> Editions. Requires the Salesforce Privacy Center license.</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="d12908e67">User Permissions
            Needed</th>
        </tr>
      </thead>
      <tbody>
        <tr class="">
          <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d12908e67 ">To use the Preference Manager Builder:</td>

          <td class="slds-cell-wrap" style="vertical-align:top;" headers="d12908e67 ">ManagePreferenceManager</td>

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

## Syntax

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <tbody>
          <tr class="">
            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">URI</td>

            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">services/data/vXX.X/consent/prefcenter/token</td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">Formats</td>

            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">JSON</td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">HTTP Methods</td>

            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">POST</td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">Authentication</td>

            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">Bearer Token</td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">Request Parameters</td>

            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">recordId</td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">Request Body</td>

            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">
              <p>The request body contains a JSON object with the record ID of the
                associated object. </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 class="nolang">{
  [recordId]            // String, Required
}
</code></pre>
            </td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">Response Body</td>

            <td class="slds-cell-wrap" style="text-align:left;vertical-align:top;">
              <p>The response body returns a JSON object containing the token for
                the user associated with the provided recordId.</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 class="nolang">{
  "success":                     // Boolean
  "tokenMapping": {              // Object
  "token": "xxxxxxxxxxxxxxxx"    // String
                  },
  "tokenErrors": {},             // Object 
  "error": ""                    // String 
}
</code></pre>
              <ul>
                <li><code>success</code> returns a true
                  or false statement to indicate if the request was
                  successful. </li>

                <li><code>tokenErrors</code> indicates
                  if there was an error revoking the token. If you included
                  multiple tokens, the response indicates any errors for each
                  individual token. </li>

                <li><code>error</code> indicates if
                  there was a system error while processing the request. </li>

              </ul>
            </td>

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

## Example Response Body

This example shows a successful response for a request with the record ID 0034L00000CZqeqQAD.

```

{
  "success" : true,
  "tokenMapping" : 
    {
    "token": "QTRMMDAwMDAwNTRQSGc0ZlhSczZnSXNTNEpNUVBldWN6
              cFl0bDRNcERURWRMWGJPZ1hhamxQTnUxa2oxN0dXVVFM
              alhwNFY1NXVxaDlrcXEwcFhuQy94WGNBYmMyMkZaWjJR
              L1VTOWw0UVhiZ2s4dFZaMUM0M053M01wWllUUTQzODZ1
              VjFLekxod2xQZ2NNQzRIYzNuM2RtRW9kVTRTN1lEdz09"
    },
  "tokenErrors": {},
  "error": ""
}

```