Delete attachment
delete_attachmentPermanently delete an attached file from OpenProject. Requires explicit user confirmation; reads attachment metadata first to accurately identify the file and its container.
Instructions
Permanently delete one attached file from OpenProject.
Use it only on explicit user instruction, for example to remove a file uploaded to the wrong work package or a superseded document. The attachment's metadata is read first so the result names the file and the container it was attached to, and so an unknown id fails before anything is removed.
Returns the attachment id, the file name, its container and a confirmation message.
Pitfalls: this deletes the file itself, not a link to it — every work package, wiki page or comment that embedded it loses the image or download. Deleting needs edit permission on the container (or authorship for a file that has no container yet), so a 403 can follow a successful read. A 404 means the id is unknown or already deleted; a second call on the same id answers 404 rather than succeeding. Removing a file does not remove the comment or work package that referenced it.
Related: list_attachments shows the ids and file names of everything a container holds; upload_attachment adds a replacement; download_attachment saves a copy first if the bytes are still wanted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No | Must be true. Ask the user to confirm first: OpenProject offers no undo and no trash. Calling with confirm=false returns a confirmation_required error and nothing is read or deleted. | |
| attachment_id | Yes | Numeric attachment id from list_attachments or get_work_package(include=['attachments']). Never a work package or container id — deleting the wrong id cannot be undone. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Id of the attachment that was deleted. | |
| deleted | Yes | True once OpenProject accepted the deletion. | |
| message | Yes | Human-readable confirmation. | |
| container | No | Object the file was attached to (work package, wiki page, meeting, ...); null for an uploaded file that was never claimed by one. | |
| file_name | No | Name of the file that was removed, read before deleting it. |