Delete Records in Marketing Cloud Next Using REST API

You can delete individual records using the delete sObject rows endpoints in REST API.

Record Types 

You can use REST API to delete these record types.

Record TypeAPI Name
Contact recordsContact
Lead recordsLead
CampaignsCampaign
Marketing segmentsMarketSegment
FlowsFlowRecord

Prerequisite 

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

If you don’t know the IDs of the records that you want to delete, perform a query.

Send the Request 

To delete a record, send a DELETE request to the /data/{apiVersion}/sobjects/OBJECT_API_NAME/RECORD_ID endpoint. Replace OBJECT_API_NAME with the API name of the type of object that you want to delete, and replace RECORD_ID with the unique ID of the record to delete. You can find the IDs for the records that you want to delete by running a query.

This example shows how to delete a marketing segment. The DELETE operation doesn’t contain a request body.

1DELETE /services/data/{apiVersion}/sobjects/MarketSegment/RECORD_ID HTTP/1.1
2Host: YOUR_SUBDOMAIN.my.salesforce.com
3Content-Type: application/json
4Authorization: Bearer YOUR_BEARER_TOKEN

When the record is deleted successfully, the API returns a 204 No Content response with no response body.