---
schema_version: "1"
id: 3bc4ddaebd3b1d395a6825313155393a103f335de6550b3a912f7c02333a442a
title: Create a Batch of Records
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/uiapi/ui_api_resources_records_batch_post.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_records_batch_post.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1ae642784e49f0584fd2650c09524da6b70468ceae46ce4ae0a13b07066f58b5
description: Create multiple records. You can create, update, and delete up to 200 records in a single request.
---
# Create a Batch of Records

Create multiple records. You can create, update, and delete up to 200 records in a single request.

Resource

/ui-api/records/batch

Available Version

59.0

HTTP Method

POST

Example

This example creates an account and a contact, and updates a record.

POST /ui-api/records/batch

{
  "allOrNone": false,
  "operations": \[
    {
      "type": "CREATE",
      "records": \[
        {
          "apiName": "Account",
          "fields": {
            "Name": "Global Media"
          }
        },
        {
          "apiName": "Contact",
          "fields": {
            "LastName": "Smith"
          }
        }
      \]
    },
    {
      "type": "Update",
      "records": \[
        {
          "fields": {
            "Id": "001xx000003Gaf9AAC",
            "NumberOfEmployees": 1000
          }
        }
      \]
    }
  \]
}

Request Body

| Name | Type | Description | Required or Optional | Available Version |
| --- | --- | --- | --- | --- |
| recordInput | [Batch Record Input](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_requests_batch_input.htm "A description of multiple operations for a request to create, update, or delete a batch of records.") | The batch of record input. | Required | 59.0 |

Request Parameters

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





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

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

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

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

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

                </tr>

              </thead>

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

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

                  <td class="entry" headers="d78783e183" 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">For an Account, specifies whether to apply the default territory assignment
                      rules. </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="d78783e186" data-title="Required or Optional">Optional</td>

                  <td class="entry" headers="d78783e189" data-title="Available Version">64.0</td>

                </tr>

              </tbody>

            </table>

Response Body

[Batch Results](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_responses_batch_results.htm#ui_api_responses_batch_results "The results from a request to a batch resource. Results include information for each subrequest in the batch.")

Usage

When creating a batch of records, you must include the required apiName field in [Batch Operation Input](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_requests_batch_operation_input.htm "Represents the operation type and record data to create, update, and delete in a batch."). Don’t include the Id field. Otherwise, a 400 HTTP status code with an INVALID\_BATCH\_REQUEST error is returned.

Receiving a 400 HTTP status code with an INVALID\_INPUT error can be caused by one of these reasons.

- The operations field is missing or empty.
- The operation type is missing.
- The operations field doesn’t contain a records field or the records field is empty.

#### See Also

- [Update a Batch of Records](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_records_batch_update.htm "Update multiple records. You can create, update, and delete up to 200 records in a single request.")
- [Delete a Batch of Records](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_records_batch_delete.htm "Delete multiple records. You can create, update, and delete up to 200 records in a single request.")