Create a Record

Use the sObject Basic Information resource to create new records. You supply the required field values in the request data, and send the request using the POST HTTP method. The response body contains the ID of the new record if the call is successful.

The following example request creates a new Account record, with the field values for the new record provided in newaccount.json. Only the name field is specified in this example, but you could also provide values for other Account fields.

Example for creating a new Account
curl https://MyDomainName.my.salesforce.com/services/data/v63.0/sobjects/Account/ -H "Authorization: Bearer token" -H "Content-Type: application/json" -d "@newaccount.json"
Example request body newaccount.json file for creating a new Account
{
  "Name" : "Express Logistics and Transport"
}
Example response body after successfully creating a new Account
{
  "id" : "001D000000IqhSLIAZ",
  "errors" : [ ],
  "success" : true
}
Example of an error when attempting to create a new Account
An invalid rquest body newaccount.json file for creating a new Account:
{
  "id" : "001D000000IqhSLIAZ",
  "Name" : "Express Donuts and Pies"
}
The resulting error:
[{"message":"The Id field should not be specified in the sobject data.",
"errorCode":"INVALID_FIELD"}]