---
schema_version: "1"
id: 3569ffb880e25bf587eeff88075ac5e779d13a5615929e0ddfafee956bdb5d3f
title: Check for Duplicate Records
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/uiapi/ui_api_resources_predupe_create.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_predupe_create.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: ebb17cb6d3253141334478a38b2dcc4565703d76ea5a1b0002aa97ee958e0594
description: Before updating or creating a record, you can check whether a duplicate record exists. Use the response to learn whether to block or allow the action, and whether to warn the user.
---
# Check for Duplicate Records

Before updating or creating a record, you can check whether a duplicate record exists. Use the response to learn whether to block or allow the action, and whether to warn the user.

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

#### Tip

To learn more about when to check for duplicate records, see [Get Duplicate Management Configuration for a Specified Object](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_duplicates_get.htm "Learn whether duplicate management is configured for the specified object. If duplicate management is configured, learn about the object's duplicate rules and matching rules. Use the information in the response to know when to check for duplicate records.").

Resource

/ui-api/predupe

Available Version

50.0

HTTP Method

POST

Example

Use the following request to check whether a duplicate record for the movie "Aliens" exists.

ui-api/predupe{
"apiName" : "Movie\_\_c",
"fields" :
{"Name": "Aliens",
  "Year\_\_c": "1986"
}

Request Body

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





              <thead class="thead sorted" align="left">
                <tr>
                  <th class="featureTableHeader vertical-align-top " id="d66995e115">Name</th>

                  <th class="featureTableHeader vertical-align-top " id="d66995e118">Type</th>

                  <th class="featureTableHeader vertical-align-top " id="d66995e121">Description</th>

                  <th class="featureTableHeader vertical-align-top " id="d66995e124">Required or Optional</th>

                  <th class="featureTableHeader vertical-align-top " id="d66995e127">Available Version</th>

                </tr>

              </thead>

              <tbody class="tbody">
                <tr>
                  <td class="entry" headers="d66995e115" data-title="Name"><samp class="codeph nolang">allowSaveOnDuplicate</samp></td>

                  <td class="entry" headers="d66995e118" data-title="Type">Boolean</td>

                  <td class="entry" headers="d66995e121" data-title="Description">Specifies whether to save a duplicate record (<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">Don’t specify
                      this property when checking for duplicate records.</p>
                  </td>

                  <td class="entry" headers="d66995e124" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d66995e127" data-title="Available Version">43.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d66995e115" data-title="Name"><samp class="codeph nolang">apiName</samp></td>

                  <td class="entry" headers="d66995e118" data-title="Type">String</td>

                  <td class="entry" headers="d66995e121" data-title="Description">To create a record, specify the API name of an Object from which to
                    create the record. To update a record, use <samp class="codeph nolang">null</samp> or don’t pass this property. To check for duplicate records,
                    specify the API name of the object for which you’re performing the duplicate
                    check.</td>

                  <td class="entry" headers="d66995e124" data-title="Required or Optional">Required to create a record.<p class="p">Required to check for duplicate
                      records.</p>
                  </td>

                  <td class="entry" headers="d66995e127" data-title="Available Version">41.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d66995e115" data-title="Name"><samp class="codeph nolang">fields</samp></td>

                  <td class="entry" headers="d66995e118" data-title="Type">Map&lt;String, Object&gt;</td>

                  <td class="entry" headers="d66995e121" data-title="Description">Map of field names to field values.<p class="p">Format data types according to
                      these rules: </p>
                    <ul class="ul bulletList">
                      <li class="li">
                        <samp class="codeph nolang">Address</samp>—JSON String.
                        Addresses are compound fields and must be broken up into their constituent
                        fields. See the previous example.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Boolean</samp>—JSON Boolean,
                        <samp class="codeph nolang">true</samp> or <samp class="codeph nolang">false</samp>
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Currency</samp>—JSON Number (for
                        example, <samp class="codeph nolang">67.54</samp>)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Date</samp>—JSON string (for
                        example, <samp class="codeph nolang">2020-04-20</samp>)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">DateTime</samp>—JSON string in ISO
                        8601 format (for example, <samp class="codeph nolang">2012-02-18T06:40:41.000Z</samp>)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Double</samp>—JSON Number
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Email</samp>—JSON String (for
                        example, <samp class="codeph nolang">joe@smith.com</samp>)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">EncryptedString</samp>—JSON
                        String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Int</samp>—JSON Number
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Location</samp>—JSON String.
                        Location fields are compound fields and must be broken up into their
                        constituent fields.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">MultiPicklist</samp>—JSON String
                        (for example, <samp class="codeph nolang">Dog;Cat;Fish)</samp>.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Percent</samp>—JSON Number
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Phone</samp>—JSON String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Picklist</samp>—JSON String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Reference</samp>—JSON String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">String</samp>—JSON String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">TextArea</samp>—JSON String
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Time</samp>—JSON String in format
                        <samp class="codeph nolang">HH:MM:SS</samp>
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Url</samp>—JSON String
                      </li>

                    </ul>
                    <p class="p">To specify the main record type, either don’t specify the <samp class="codeph nolang">RecordTypeId</samp> field, or set it to <samp class="codeph nolang">null</samp>.</p>
                  </td>

                  <td class="entry" headers="d66995e124" data-title="Required or Optional">Required</td>

                  <td class="entry" headers="d66995e127" data-title="Available Version">41.0</td>

                </tr>

              </tbody>

            </table>

Response Body

[Duplicates](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_duplicates.htm "The results of a check for duplicate records.")

#### See Also

- [Get Duplicate Management Configuration for a Specified Object](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_duplicates_get.htm "Learn whether duplicate management is configured for the specified object. If duplicate management is configured, learn about the object's duplicate rules and matching rules. Use the information in the response to know when to check for duplicate records.")