latestOpenAPI 3.0.2cPanel License2026-08-106251554.3 MB

3da41671c02c

Mail
cPanel Account Mail Management

Remove email account messages by mailbox GUID

This function removes mail messages from a cPanel account.

Important:

When you disable the Receive Mail role, the system disables this function.

get/expunge_messages_for_mailbox_guid

Query parameters

accountstring required
Example:user@example.com

The email account's name.

mailbox_guidstring required
Example:2550860f0c58d158c92a000044f0d230

The mailbox's globally unique identifier (GUID).

Note:

To find the mailbox GUID, use the WHM API 1 - get_mailbox_status function.

querystring required
Example:savedbefore 52w

The Dovecot search query to select which messages you wish to remove from the mailbox. For more information, read Dovecot's Search Query documentation.

Response

HTTP Request was successful.

Example response

{
  "metadata": {
    "command": "expunge_messages_for_mailbox_guid",
    "reason": "OK",
    "result": 1,
    "version": 1
  }
}