How It Works
Include aheaders object in your email request with any custom key-value pairs. These headers are preserved throughout the email lifecycle and included in all webhook event payloads.
When an email is processed, delivered, hard bounced, soft bounced, opened, clicked, unsubscribed, or marked as spam, the webhook event includes your custom headers in the emailMessage.headers object. This makes it easy to reconcile events, update statistics for your customers, or create custom internal dashboards.
Use Cases
SaaS Companies
Track which customer account triggered each email:Email Marketing Agencies
Identify campaigns and clients:Email Marketing Platforms
Link emails to contacts and campaigns:Headers in Webhook Events
Custom headers are included in all webhook event types:- Processed (type: 0)
- Dropped (type: 1)
- Delivered (type: 2)
- SoftBounced (type: 3)
- HardBounced (type: 4)
- Opened (type: 5)
- Clicked (type: 6)
- Unsubscribed (type: 7)
- Spam (type: 8)
Example: Webhook Payload with Custom Headers
Examples
Transactional Email with Order Tracking
Marketing Campaign with Segmentation
Multi-Tenant Application
Custom headers are preserved exactly as you send them. Use consistent naming conventions (e.g.,
Contact-ID, Campaign-ID) across your application to make webhook processing easier.Headers are included in every webhook event for a given email, allowing you to filter and process webhooks based on your custom identifiers without needing to store additional mapping data.