Skip to content

attachment_delete

Delete an attachment’s metadata and its stored file. Use it to let users remove their own uploads, or to let administrators clean up storage.

{
"cmd": "attachment_delete",
"attachment_id": "550e8400-e29b-41d4-a716-446655440000"
}
Field Type Required Description
attachment_id string Yes ID of the attachment to delete. Surrounding spaces are trimmed.

The response command is attachment_deleted, not attachment_delete.

{
"cmd": "attachment_deleted",
"attachment_id": "550e8400-e29b-41d4-a716-446655440000",
"deleted": true
}

This response goes to the caller only; nothing is broadcast.

Messages that reference the attachment are not changed, but the file can no longer be downloaded. To remove a message together with its attachments, use message_delete.

You must be the user who uploaded the attachment, or have manage_server.

The command is blocked while you are timed out.

val When
Attachment not found or expired No attachment has this ID, or it has expired.
You can only delete your own attachments You didn’t upload it and lack manage_server.
Failed to delete attachment The server could not remove the attachment record from storage.
Validation message attachment_id is missing or blank, for example attachment_id: Required.