Skip to the documentation
API

Delete files in bulk

Deletes up to 100 files in one call, each the way `DELETE /files/{id}` deletes one, as selecting several on the Files page does.

POSTapi.openemail.uk/files/batch-delete

Runs the real call against your workspace, with your own key.

POST /files/batch-delete

Deletes up to 100 files in one call, each the way DELETE /files/{id} deletes one, as selecting several on the Files page does.

Example

Needs threads:write. ids takes 1 to 100 file ids, and any other field is a 422 unknown_parameter.

curl
curl -X POST "$OE/files/batch-delete" -H "$AUTH" -H 'content-type: application/json' -d '{  "ids": ["file_0c4e7a91d2b84f63a5e19b7d", "file_6bb640f5b99e47deb758f1f5", "file_9e2b41c7a0f35d8e6b1c4a72"]}'
Response
{  "object": "file_batch_delete",  "deleted": ["file_0c4e7a91d2b84f63a5e19b7d"],  "kept": [    {      "id": "file_6bb640f5b99e47deb758f1f5",      "filename": "invoice-0912.pdf",      "usage": "received",      "reason": "It came in on a message, so it stays with that message."    }  ],  "missing": ["file_9e2b41c7a0f35d8e6b1c4a72"]}

A call where some files go and others stay is not an error. deleted lists what went, kept each file in use with its usage and the reason in words, and missing the ids that are unknown, already deleted or outside the addresses a narrowed key holds.

Each file is checked again as it is deleted, so one that came into use after you listed it is kept rather than lost. There is no undo.