Delete an inbound message

Delete an inbound message before its 30-day retention ends; attachment metadata and forward attempts are removed with it.

Removes a stored inbound message immediately instead of waiting for the 30-day sweep. Attachment metadata and the forward delivery attempts of that message go with it; the message no longer counts towards your rolling 30-day inbound quota.

DELETE /v3/inbound/messages/{id}

Requires a `full_access` key. The call is not idempotent: a second call, or an id of another workspace, answers 404 not_found.

Responses

StatusDescription
204Deleted. No body.
401Missing or invalid API key.
403insufficient_scope — only a full_access key may delete inbound mail.
404No such inbound message on your workspace.

Code examples

cURL
curl -X DELETE https://api.wemail.io/v3/inbound/messages/6f1c2a1e-7d3b-4b7e-9f0e-2a4c8d9b1e55 \
  -H "Authorization: Bearer afn_live_…"
# 204 No Content
Node.js
const res = await fetch("https://api.wemail.io/v3/inbound/messages/6f1c2a1e-7d3b-4b7e-9f0e-2a4c8d9b1e55", {
  method: "DELETE",
  headers: { Authorization: `Bearer ${process.env.WEMAIL_API_KEY}` },
});
console.log(res.status); // 204
Python
import os, requests

r = requests.delete(
    "https://api.wemail.io/v3/inbound/messages/6f1c2a1e-7d3b-4b7e-9f0e-2a4c8d9b1e55",
    headers={"Authorization": f"Bearer {os.environ['WEMAIL_API_KEY']}"},
)
print(r.status_code)  # 204
Go
client, _ := wemail.NewClient(os.Getenv("WEMAIL_API_KEY"))
ctx := context.WithValue(context.Background(), wemail.ContextAccessToken, os.Getenv("WEMAIL_API_KEY"))
_, err := client.API.InboundAPI.DeleteInboundMessage(ctx, "6f1c2a1e-7d3b-4b7e-9f0e-2a4c8d9b1e55").Execute()