Create Records in Marketing Cloud Growth Using REST API

Create individual records using the sObjects create endpoints in REST API.

A common use case for this API is the integration of applications that collect contact registration information. You can use this API to feed the collected data directly into lead, contact, and campaign records.

Use REST API to create the record types shown in this table.

Record TypeAPI Name
Contact recordsContact
Lead recordsLead

Before you send a request to REST API, obtain a bearer token. For more information, see Connect to REST-based APIs.

To create a record, send a POST request to the /services/data/v61.0/sobjects/OBJECT_API_NAME endpoint, where OBJECT_API_NAME is the API name of the type of object that you want to create. The body of the request is a JSON object that contains the information to include in the record.

A common use case is to use REST API to create individual contact records. This code example shows how to create a basic contact record.

The field names that you specify in the request body must exactly match the field names in the target object. You can retrieve a list of field names and relationships by issuing a GET call to the /services/data/v61.0/sobjects/OBJECT_API_NAME/describe endpoint. Alternatively, you can view a list of fields and relationships in the Object Explorer on the Setup page of the Salesforce web app.

Fields that are required by the target object but not specified in the request receive the default values for the object. If a field in the request doesn’t exist in the target object, the request fails with an error.

For more information and code examples, see createContact.

You can create up to 200 records in a single synchronous operation by issuing a POST request to the /services/data/v61.0/composite/tree/OBJECT_API_NAME endpoint. To create more than 200 records, use Bulk API 2.0 instead.

In a request to create multiple records, the body of the request contains an array called records. Each record is a separate object in the array. Each record includes an additional object, attributes, which specifies the object type. The object must also include a referenceId, which is included in the response so that you can track which items were processed successfully.

This code example shows how to create multiple contact records in a single call to REST API.

If the request is successful, the response indicates whether there were errors in processing the request. It also lists the IDs and the reference IDs for each object that was created.