Marketing and newsletter email should include an easy opt-out. Set enable_unsubscribe: true on POST /emails and Piisend handles the rest.
What Piisend adds
When enable_unsubscribe is true:
- A signed unsubscribe URL is generated for each recipient.
List-UnsubscribeandList-Unsubscribe-Postheaders are added before delivery (Gmail/Yahoo one-click compliant).- When the recipient unsubscribes, their address is added to your suppression list.
Step-by-step
1. Enable on send
{
"to": ["subscriber@example.com"],
"subject": "March newsletter",
"html": "<p>Latest updates.</p>",
"enable_unsubscribe": true
}
2. Recipient clicks Unsubscribe
Webmail clients show an unsubscribe button using the List-Unsubscribe header. The link points to Piisend's /unsubscribe/{token} endpoint.
3. Suppression is recorded
Both GET (link click) and POST (one-click) unsubscribe requests add the address to suppressions with source manual.
4. Future sends are blocked
Any subsequent POST /emails to that address is rejected before queueing.
When to use
- Newsletters and promotional campaigns
- Any mail where recipients did not explicitly request a one-off transactional message
Transactional mail (password reset, receipt) typically keeps enable_unsubscribe: false.
Related
- Email suppressions
- Custom headers — automatic List-Unsubscribe headers
- Deliverability insights
Example request
curl -sS -X POST "https://api.piisend.com/api/v1/emails" \
-H "Authorization: Bearer $PIISEND_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": ["subscriber@example.com"],
"subject": "March newsletter",
"html": "<p>Latest updates from our team.</p>",
"enable_unsubscribe": true
}'