Mail API reference

Mail API · Public

post/v1/u/{token}

One-click unsubscribe (RFC 8058) and the preferences form (no authentication).

The `List-Unsubscribe-Post: List-Unsubscribe=One-Click` target. A mailbox provider POSTs `List-Unsubscribe=One-Click` (form-encoded); the recipient is unsubscribed from the topic the email was sent on, or from all unsubscribable mail when it had no topic, and the answer is a short `200 text/plain`. No confirmation step, as RFC 8058 requires. The hosted page posts `action=unsubscribe` (same effect) or `action=save` with `topic` (repeated, the topic ids to stay subscribed to; unchecked public topics are opted out) and `all=1` (unsubscribe from everything), and gets the page back. Transactional mail (a send with no topic whose template has no unsubscribe link) is never affected. Emits `contact.updated`, and `contact.created` for a recipient who was not a contact yet.

Path parameters

token*string

The token from the unsubscribe link (`u1.` followed by base64url).

Request body

actionenum (2)
topicobject
allenum (1)

Response · 200

Unsubscribed (`text/plain` for one-click) or the updated page (`text/html`).

Example

Request

POST https://api.mail.productcraft.co/v1/u/{token}
Content-Type: application/json

{
  "action": "unsubscribe",
  "topic": {},
  "all": "1"
}