PUT /data/v1/async/dataextensions/{id}/rows

Upsert data into a data extension asynchronously by key or ID. An upsert operation updates rows if the specified key exists and inserts rows if the specified key doesn’t exist.

NameTypeDescription
idstringThe unique identifier of the data extension. The ID is required if the request doesn’t include the key parameter.
keystringThe external customer key of the data extension. The key is required if the request doesn’t include the id parameter. Add the string key: to the beginning of the external key.
NameTypeDescription
itemsarrayRequired. An array of objects, where each object represents a row of data in the target data extension. Each object is expected to contain name-value pairs matching the column name and value of the target.

The request body contains an object called items, which is an array of JSON objects. Each object consists of name-value pairs that correspond to columns in the destination data extension. In this example, the data extension must have the fields FirstName, LastName, and PostalCode. Requests aren’t required to include all fields in the data extension as long as all of the required fields are included.

When a request is accepted, the API returns a 202 OK response. The body of the response contains a RequestId property, as shown in this example. Use the request ID to determine the status and results of the request.

If the request refers to an invalid data extension ID or key, the API returns a 400 Bad Request error. When you receive this error, it indicates that the request hasn’t been added to the asynchronous queue for processing. You can find more information about the failure by using the /data/v1/async/{requestId}/results?includeDetail=true resource.