---
schema_version: "1"
id: b642fdfef6d02fa53f9694a4767e53457e5088fed277c57bfe786c7f22e53434
title: Create or Clone a Record
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/uiapi/ui_api_resources_records_create.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_records_create.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: bfe63d1b20a72613dceb927c968d9d299aadeff051e8c255cd46d210eb405a44
description: Create or clone a record.
---
# Create or Clone a Record

Create or clone a record.

## Usage

To create or clone a record, pass a [Record Input](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_requests_record_input.htm "A description of a record to use in a request to create or update a record or in a request to check for duplicate records.") request body to the POST /ui-api/records resource. To create the request body, you must know the fields, required fields, and default values for that object. You may also want layout information. If you don’t want layout information, use the lightweight resources.

To find the required fields, fields, and default values, make a request to one of these resources.

- [Get Default Values to Create a Record](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_defaults_create.htm "Get the default values for fields for a new record of a specified object and optional record type. After getting the default values, make a request to POST /ui-api/records to create the record.")
- [Get Default Values to Create a Record—Lightweight](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_defaults_template_create.htm "Get the default values for fields for a new record of a specified object and optional record type. You must specify the fields you want returned. This resource doesn’t use or return layout information. After getting the default values, make a request to POST /ui-api/records to create the record.")
- [Get Default Values to Clone a Record](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_defaults_clone.htm "Get the default layout information, object information, and data for cloning a record. After getting the default values, make a request to POST /ui-api/records to create the record.")
- [Get Default Values to Clone a Record—Lightweight](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_record_defaults_template_clone.htm "Get the default values for fields for cloning a record. You must specify the fields you want returned. This resource doesn’t use or return layout information. After getting the default values, make a request to POST /ui-api/records to create the record.")

The response from these resources includes [Object Info](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_object_info.htm "The metadata for an object."), including all fields and a required property for each field.

To find the values for lookup fields, picklist fields, and multi-select picklist fields, use these resources.

- [Get Lookup Field Suggestions for a Specified Object](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_lookup_object_get.htm "When a user edits a lookup field, use this resource to search for and display suggestions for a specified object. You can search for most recently used matches, for matching names, or for any match in a searchable field. You can also specify lookup filter bindings for dependent lookups.")
- [Get Lookup Field Suggestions](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_lookup_get.htm "When a user edits a lookup field, use this resource to search for and display suggestions. You can search for most recently used matches, for matching names, or for any match in a searchable field. You can also specify lookup filter bindings for dependent lookups.")
- [Get Values for a Picklist Field](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_picklist_values.htm "If a field’s dataType property is equal to Picklist or MultiPicklist, use this resource to get its values.")
- [Get Values for All Picklist Fields of a Record Type](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_picklist_values_collection.htm "Use this resource to get the values for all the picklist fields of a specific record type. This resource is especially useful for getting dependent picklist values. For example, if an object has a tree of dependent picklists (Continents__c, Countries__c, Cities__c), use this resource to get all the values for each picklist in one request.")

As of API version 43.0, if you pass read-only fields in a request body, the response is an [Error with Output](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_error_with_output.htm#ui_api_responses_error_with_output "Contains extra information about errors. In rare cases, an error message isn't enough to describe the reason for a failure. For example, when a conflicting precondition exists, the error result can include the information about the cause of the conflict.").

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

#### Note

ProductMedia records can’t be created with this resource. Use the [ProductMedia object API](https://developer.salesforce.com/docs/atlas.en-us.264.0.object_reference.meta/object_reference/sforce_api_objects_productmedia.htm) instead.

Resource

/ui-api/records

Available Version

41.0

HTTP Method

POST

Example

POST /ui-api/records

{
  "apiName": "Account",
  "fields": {
    "Name": "Universal Containers"
  }
}

To provide an address, provide the individual fields as separate inputs. The compound field is only available in the response.

{
  "apiName": "Account",
  "fields" : {
    "Name": "Local Boxes",
    "BillingState": "WA",
    "BillingStreet" : "123 Main Street",
    "BillingCountry" : "USA"
  }
}

Request Parameters

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





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

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

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

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

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

                </tr>

              </thead>

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

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

                  <td class="entry" headers="d81601e276" data-title="Description">Specifies whether to save a duplicate record. The default value is
                    <samp class="codeph nolang">false</samp>.
                  </td>

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

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

                </tr>

                <tr>
                  <td class="entry" headers="d81601e270" data-title="Parameter Name"><samp class="codeph nolang">handleOwnerChange</samp></td>

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

                  <td class="entry" headers="d81601e276" data-title="Description">Specifies whether to return a <samp class="codeph nolang">204 No
                      Content</samp> HTTP status code if the context user loses access to the
                    record during creation. The default value is <samp class="codeph nolang">false</samp>. When <samp class="codeph nolang">false</samp>, if the
                    context user loses access to the record during creation, creation completes
                    successfully, however the resource returns an incorrect <samp class="codeph nolang">404 Not found</samp> HTTP status code.</td>

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

                  <td class="entry" headers="d81601e282" data-title="Available Version">60.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d81601e270" data-title="Parameter Name">
                    <samp class="codeph nolang">triggerOtherEmail</samp>
                  </td>

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

                  <td class="entry" headers="d81601e276" data-title="Description">For a Case, specifies whether to send email to users outside the
                    organization. In the Salesforce user interface, this email can be
                    automatically triggered by creating, editing, or deleting a contact for a
                    Case.<p class="p">The default value is <samp class="codeph nolang">false</samp>.</p>
                    <p class="p">See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/sforce_api_header_emailheader.htm" target="_blank" title="HTML (New Window)">EmailHeader</a>
                      in <em class="ph i">SOAP API Developer Guide</em>.</p>
                  </td>

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

                  <td class="entry" headers="d81601e282" data-title="Available Version">51.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d81601e270" data-title="Parameter Name"><samp class="codeph nolang">triggerUserEmail</samp></td>

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

                  <td class="entry" headers="d81601e276" data-title="Description">For a Case or a Lead, specifies whether to send email to users in the
                    organization. In the Salesforce user interface, this email can be
                    automatically triggered by various events: resetting a password, creating a
                    user, changing the Case owner, or adding comments to a Case.<p class="p">For Case owner
                      changes, also set <samp class="codeph nolang">useDefaultRule=true</samp>,
                      or no email is sent. </p>
                    <p class="p">The default value is <samp class="codeph nolang">false</samp>.</p>
                    <p class="p">See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/sforce_api_header_emailheader.htm" target="_blank" title="HTML (New Window)">EmailHeader</a>
                      in <em class="ph i">SOAP API Developer Guide</em>.</p>
                  </td>

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

                  <td class="entry" headers="d81601e282" data-title="Available Version">51.0</td>

                </tr>

                <tr>
                  <td class="entry" headers="d81601e270" data-title="Parameter Name"><samp class="codeph nolang">useDefaultRule</samp></td>

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

                  <td class="entry" headers="d81601e276" data-title="Description">
                    <p class="p">For a Case or Lead, specifies whether to use the default (<samp class="codeph nolang">active</samp>) assignment rule. If you specify
                      <samp class="codeph nolang">useDefaultRule</samp>, don’t specify an
                      <samp class="codeph nolang">assignmentRuleId</samp>.
                    </p>

                    <p class="p">When you create an Account, as long as the account matches any filter for a
                      territory, the Account is assigned to that territory regardless of how
                      <samp class="codeph nolang">useDefaultRule</samp> is set.
                    </p>

                    <p class="p">The default value is <samp class="codeph nolang">false</samp>.</p>

                    <p class="p">See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/sforce_api_header_assignmentruleheader.htm" target="_blank" title="HTML (New Window)">AssignmentRuleHeader</a> in <em class="ph i">SOAP API Developer Guide</em>.</p>

                  </td>

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

                  <td class="entry" headers="d81601e282" data-title="Available Version">51.0</td>

                </tr>

              </tbody>

            </table>

Request Body

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





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

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

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

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

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

                </tr>

              </thead>

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

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

                  <td class="entry" headers="d81601e505" 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="d81601e508" data-title="Required or Optional">Optional</td>

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

                </tr>

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

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

                  <td class="entry" headers="d81601e505" 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="d81601e508" 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="d81601e511" data-title="Available Version">41.0</td>

                </tr>

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

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

                  <td class="entry" headers="d81601e505" 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="d81601e508" data-title="Required or Optional">Required</td>

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

                </tr>

              </tbody>

            </table>

Response Body

[Record](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_record.htm#ui_api_responses_record "The field data, API name, child relationship data, and record type information for a record.")

#### See Also

- [Upload Binary Files](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_features_records_binary_upload.htm "If a record has a Base64 field, you can upload binary data to the field when you create or update a record.")