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 Type | API Name |
|---|---|
| Contact records | Contact |
| Lead records | Lead |
| Campaigns | Campaign |
| Marketing segments | MarketSegment |
| Flows | FlowRecord |
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.
DELETE /services/data/{apiVersion}/sobjects/MarketSegment/RECORD_ID HTTP/1.1
Host: YOUR_SUBDOMAIN.my.salesforce.com
Content-Type: application/json
Authorization: Bearer YOUR_BEARER_TOKEN
When the record is deleted successfully, the API returns a 204 No Content response with no response body.