---
schema_version: "1"
id: 8651e166172313dabb14e1b2c2ae9c8f3557924607f9e7ef7ae994b63fdac061
title: Create Multiple Records
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/api-rest/guides/do-me/dome-composite-sobject-tree-flat.md
canonical_url: https://developer.salesforce.com/docs/platform/api-rest/guide/dome-composite-sobject-tree-flat.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: d938a1726c394d5fc2f3c8e0236b30622e572f5854938776eac3ec97a10a81cc
products:
  - REST API Developer Guide
  - Platform Developer Content
---

# Create Multiple Records

While the resource can be used to create nested records, you can also create multiple, unrelated records of the same type. In a single request, you can create up to two hundred records. In the request data, you supply the required and optional field values for each record, each record’s type, and a reference ID for each record, and then use the POST method of the resource. The response body will contain the IDs of the created records if the request is successful. Otherwise, the response contains only the reference ID of the record that caused the error and the error information.

The following example creates four new accounts. The record data is provided in newrecords.json.

## Example for creating four new accounts

```nolang
curl https://MyDomainName.my.salesforce.com/services/data/v68.0/composite/tree/Account/ -H "Authorization: Bearer token -H "Content-Type: application/json" -d "@newrecords.json"
```

## Example request body newrecords.json file for creating four new accounts

```nolang
{
"records" :[{
    "attributes" : {"type" : "Account", "referenceId" : "ref1"},
    "name" : "SampleAccount1",
    "phone" : "1111111111",
    "website" : "www.salesforce.com",
    "numberOfEmployees" : "100",
    "industry" : "Banking"   
    },{
    "attributes" : {"type" : "Account", "referenceId" : "ref2"},
    "name" : "SampleAccount2",
    "phone" : "2222222222",
    "website" : "www.salesforce2.com",
    "numberOfEmployees" : "250",
    "industry" : "Banking"
    },{
    "attributes" : {"type" : "Account", "referenceId" : "ref3"},
    "name" : "SampleAccount3",
    "phone" : "3333333333",
    "website" : "www.salesforce3.com",
    "numberOfEmployees" : "52000",
    "industry" : "Banking"
    },{
    "attributes" : {"type" : "Account", "referenceId" : "ref4"},
    "name" : "SampleAccount4",
    "phone" : "4444444444",
    "website" : "www.salesforce4.com",
    "numberOfEmployees" : "2500",
    "industry" : "Banking"
    }]
}

```

## Example response body after successfully creating records

```nolang
{
    "hasErrors" : false,
    "results" : [{
     "referenceId" : "ref1",
     "id" : "001D000000K1YFjIAN"
     },{
     "referenceId" : "ref2",
     "id" : "001D000000K1YFkIAN"
     },{
     "referenceId" : "ref3",
     "id" : "001D000000K1YFlIAN"
     },{
     "referenceId" : "ref4",
     "id" : "001D000000K1YFmIAN"     
     }]
}
```

**See Also**  


-   [sObject Tree](https://developer.salesforce.com/docs/platform/api-rest/resources/resources-composite-sobject-tree.md)

