Delete Attachments
Deleting Attachments From Messages
A user can delete the attachments from a message they have sent. This can be important for instance if a file was sent that shouldn't have been. In the default setting, users cannot delete messages they have sent as download logs and everything is tied to the message, but by deleting attachments, a user can prevent the attachment from being downloaded if they haven't already.
One thing to note that when sending files through drops — Filedrops, Emaildrops and FTPdrops, what happens internally is that a message is created with recipient of the drop set as the owner of the message so in the case of a message created from a Filedrop, Emaildrop or FTPdrop, the drop recipient is the one that owns the message and can delete attachments.
Here's the API call to delete the attachment:
Info | Value |
---|---|
Request URL | /message/message_id/delete_attachments |
Request VERB | DELETE |
Example using curl
curl -s -X DELETE --user "$api_key:x" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
https://test.host/message/tjXQlmeD8ZuJxacB6kfQh1/delete_attachments
Deleting an Unsent Attachment
If you've uploaded a file but the user changes their mind and don't want to send it, it is possible to delete an attachment if you know the attachment ID. This would be used together with the sending files API when you've uploaded a file using the html form based method.
Info | Value |
---|---|
Request URL | /message/attachments/:attachment_id |
Request VERB | DELETE |
Example using curl
curl -s -X DELETE --user "$api_key:x" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
https://test.host/message/attachments/M7V4HeTuIH6po2X7T5hp3u
Deleting All Unsent Attachments
Similarly, you can delete all unsent attachments for a user using the following API call:
Info | Value |
---|---|
Request URL | /message/attachments/delete |
Request VERB | DELETE |
Example using curl
curl -s -X DELETE --user "$api_key:x" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
https://test.host/message/attachments/delete