Multi Message Actions

Delete messages

Move messages to Trash or delete these if already in Trash<br/><br/>For Gmail API accounts the message is always moved to Trash. The force option, which permanently deletes on IMAP accounts, has no effect.

put/v1/account/{account}/messages/delete

Request

  • Base URL: https://your-emailengine-host
  • URL: https://your-emailengine-host/v1/account/{account}/messages/delete
  • Auth: HTTP bearer

Path parameters

accountstring required

Unique identifier for the email account

Example:user123

Query parameters

pathstring required

Mailbox folder path. Can use special use labels like "\Sent". Special value "\All" is available for Gmail IMAP, Gmail API, MS Graph API accounts.

Example:INBOX
forceboolean

Delete messages even if not in Trash. Not supported for Gmail API accounts (messages are always moved to Trash)

Headers

x-ee-timeoutinteger

Request timeout in milliseconds. Raises the command timeout above the EENGINE_TIMEOUT default for a long-running request; a value below the default has no effect

Example:30000

Request body

Example request

{
  "search": {
    "seq": "1:10",
    "from": "nyan.cat@example.com",
    "to": "support@example.com",
    "cc": "billing@example.com",
    "bcc": "archive@example.com",
    "body": "Hello world",
    "subject": "Hello world",
    "larger": 1048576,
    "smaller": 102400,
    "uid": "100:200",
    "modseq": 12345,
    "before": "2024-08-09",
    "since": "2022-08-09",
    "sentBefore": "2024-08-09",
    "sentSince": "2022-08-09",
    "emailId": "1278455344230334865",
    "threadId": "1694936993596975454",
    "header": {
      "Message-ID": "<1DAF52A51E674A2@example.com>"
    },
    "gmailRaw": "has:attachment in:unread",
    "labels": {
      "has": [
        "Horizon"
      ],
      "not": [
        "Horizon"
      ]
    },
    "emailIds": [
      "1278455344230334865"
    ]
  }
}

Response

Returns the number of messages deleted.

deletedboolean

Was the delete action executed. IMAP accounts return false when messages were moved to Trash, Gmail API and MS Graph API accounts return true also for moves to Trash

Example response

{
  "moved": {
    "destination": "Trash",
    "idMap": [
      [
        "AAAAAQAACnA",
        "AAAAAwAAAD4"
      ]
    ],
    "emailIds": [
      "1278455344230334865"
    ]
  },
  "deletedMessages": {
    "emailIds": [
      "1278455344230334865"
    ]
  },
  "failed": {
    "emailIds": [
      "1278455344230334865"
    ]
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.