You can delete individual records of messages or media associated with messages by using the HTTP DELETE functionality of the API.
- To delete individual message records through the API, make an HTTP DELETE request to the message resource.
- To delete individual media files associated with MMS messages through the API, make an HTTP DELETE request to the message media resource.
Notice: Deleting the record of a message does not automatically delete the media associated with the message (if applicable). If you need to delete a message and its associated media you’ll need to delete both the message and media records separately.
Delete message bodies
If you want to remove only the message's body (and keep the actual record of the message), you make an HTTP POST request to the message resource to update the body with an empty string
"". For more details, see Update a Message resource (Twilio Docs).
An even better option would be to use Message Redaction, which allows you to redact the phone number and body of a message before it's stored. Users can request access and full details by filling out this form.