Skip to main content
WEBHOOK
SendPostWebhooks
{
  "event": {
    "eventID": "edhg-123gh-afasdf-124egh",
    "groups": [
      "transactional",
      "user-onboarding"
    ],
    "ipID": 123,
    "ipPoolID": 123,
    "domainID": 123,
    "tpspId": 1,
    "messageType": "default",
    "messageSubject": "Welcome to Pied Piper :) + 1 quick question",
    "accountID": 117,
    "subAccountID": 117,
    "messageID": "mjhl-1401-sasdf-129324",
    "type": 2,
    "from": "[email protected]",
    "fromName": "Richard",
    "to": "[email protected]",
    "toName": "Gavin",
    "submittedAt": 1567512491587205000,
    "smtpCode": 200,
    "smtpDescription": "email delivered successfully",
    "eventMetadata": {
      "smtpCode": 200,
      "smtpDescription": "email delivered successfully",
      "userAgent": {
        "Family": "Mozilla",
        "Major": "5.0",
        "Minor": "0",
        "Patch": "0"
      },
      "os": {
        "Family": "Windows",
        "Major": "10",
        "Minor": "0",
        "Patch": "0",
        "PatchMinor": "0"
      },
      "device": {
        "Family": ""
      },
      "geo": {
        "cityID": "123",
        "continentCode": "EU",
        "countryCode": "US",
        "postalCode": "12345",
        "timeZone": "America/Los_Angeles"
      },
      "clickedURL": "https://hooli.com",
      "trackedIP": "52.34.11.12",
      "rawUserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
    }
  },
  "emailMessage": {
    "messageID": "mjhl-1401-sasdf-129324",
    "accountID": 117,
    "subAccountID": 117,
    "ipID": 123,
    "publicIP": "52.34.11.12",
    "localIP": "127.0.0.1",
    "emailType": "default",
    "submittedAt": 1567512491587205000,
    "from": {
      "name": "Richard",
      "email": "[email protected]"
    },
    "replyTo": {
      "name": "Gavin",
      "email": "[email protected]"
    },
    "to": [
      {
        "name": "Gavin",
        "email": "[email protected]",
        "customFields": {
          "Company": "Hooli"
        },
        "cc": [
          {
            "name": "Dinesh",
            "email": "[email protected]",
            "customFields": {
              "Company": "Hooli"
            }
          }
        ],
        "bcc": [
          {
            "name": "Jian",
            "email": "[email protected]",
            "customFields": {
              "Company": "Hooli"
            }
          }
        ]
      }
    ],
    "groups": [
      "welcome",
      "user-onboarding"
    ],
    "ipPool": "transactional-piedpiper",
    "headers": {
      "X-Campaign-Id": "12345"
    },
    "customFields": {
      "Company": "Company Name",
      "Email": "[email protected]"
    },
    "trackOpens": true,
    "trackClicks": true,
    "webhookEndpoint": "https://webhook.example.com/webhook"
  }
}
When you use SendPost API to send an email, SendPost generates webhook events throughout the email lifecycle. Each webhook event contains an event object and an emailMessage object. The emailMessage object remains the same across all events for a given email, allowing you to correlate events using the messageID. For a detailed explanation of the email lifecycle and what each event type means, see Understanding Webhook Event Lifecycle.

Complete Webhook Payload Structure

Every webhook payload sent by SendPost follows this structure:
{
  "event": {
    "eventID": "string",
    "type": "integer",
    "messageID": "string",
    "submittedAt": "integer",
    "smtpCode": "integer",
    "smtpDescription": "string",
    "eventMetadata": {
      "clickedURL": "string",
      "smtpCode": "integer",
      "smtpDescription": "string",
      "userAgent": {
        "Family": "string",
        "Major": "string",
        "Minor": "string",
        "Patch": "string"
      },
      "os": {
        "Family": "string",
        "Major": "string",
        "Minor": "string",
        "Patch": "string",
        "PatchMinor": "string"
      },
      "device": {
        "Family": "string",
        "Brand": "string",
        "Model": "string"
      },
      "geo": {
        "city": "string",
        "country": "string",
        "countryCode": "string",
        "region": "string",
        "regionCode": "string",
        "postalCode": "string",
        "latitude": "number",
        "longitude": "number",
        "timezone": "string"
      },
      "trackedIP": "string",
      "rawUserAgent": "string"
    }
  },
  "emailMessage": {
    "messageID": "string",
    "from": {
      "email": "string",
      "name": "string"
    },
    "to": [
      {
        "email": "string",
        "name": "string"
      }
    ],
    "subject": "string",
    "emailType": "string",
    "ipID": "integer",
    "ipPoolID": "integer",
    "ipPool": "string",
    "publicIP": "string",
    "headers": {
      "key": "value"
    },
    "groups": ["string"]
  }
}

Event Object Fields

The event object contains information about the specific webhook event that occurred.
FieldTypeDescriptionPresent In
eventIDstringUnique identifier for this specific event. Use this to deduplicate events if your webhook endpoint receives the same event multiple times due to retries.All events
typeintegerNumeric code indicating the type of event. See the Event Types table below for all possible values.All events
messageIDstringUnique identifier for the email message. This ID remains consistent across all events for the same email, allowing you to correlate events throughout the email lifecycle.All events
submittedAtintegerUnix timestamp (in seconds) indicating when this specific event occurred in SendPost. For example, when the email was processed, delivered, opened, or clicked. Use this to track the exact timing of each event in the email lifecycle.All events
smtpCodeintegerThe SMTP response code returned by the recipient’s mail server. Common codes: 200-299 (success), 400-499 (temporary failure), 500-599 (permanent failure).Delivered, SoftBounced, HardBounced
smtpDescriptionstringHuman-readable description of the SMTP response. Provides context about why an email was delivered, bounced, or rejected.Delivered, SoftBounced, HardBounced
eventMetadataobjectContains additional metadata specific to the event type. The fields present vary depending on the event type.All events (contents vary)

Event Types

Every event generated as SendPost webhook will have a type field in the event object:
Webhook EventType Field ValueDescription
Processed0Email has been accepted by SendPost and is queued for delivery
Dropped1Email was not sent due to suppression list, invalid recipient, or policy violation
Delivered2Email was successfully delivered to the recipient’s mail server
SoftBounced3Email delivery temporarily failed; SendPost will retry delivery
HardBounced4Email delivery permanently failed; the recipient address is invalid or doesn’t exist
Opened5Recipient opened the email (requires tracking pixel)
Clicked6Recipient clicked a link in the email (requires link tracking)
Unsubscribed7Recipient unsubscribed via the unsubscribe link
Spam8Recipient marked the email as spam

Event Metadata Fields

The eventMetadata object contains event-specific information. Different fields are populated depending on the event type.
FieldTypeDescriptionPresent In
clickedURLstringThe full URL that the recipient clicked. Only present when a link click is tracked.Clicked
smtpCodeintegerDuplicate of event.smtpCode for convenience. The SMTP response code from the recipient’s mail server.Delivered, SoftBounced, HardBounced
smtpDescriptionstringDuplicate of event.smtpDescription for convenience. Human-readable SMTP response description.Delivered, SoftBounced, HardBounced
userAgentobjectParsed user agent information identifying the email client or browser used to open/click.Opened, Clicked
osobjectParsed operating system information of the device used to open/click.Opened, Clicked
deviceobjectParsed device information identifying the hardware used to open/click.Opened, Clicked
geoobjectGeographic location information based on the IP address of the recipient when they opened/clicked.Opened, Clicked
trackedIPstringThe IP address of the recipient when they clicked a link.Clicked
rawUserAgentstringThe raw, unparsed User-Agent string from the recipient’s browser or email client.Opened, Clicked

userAgent Object Fields

The userAgent object provides parsed browser/email client information:
FieldTypeDescriptionExample
FamilystringName of the browser or email client”Chrome”, “Safari”, “Outlook”, “Gmail”
MajorstringMajor version number of the browser/client”91”, “15”, “16”
MinorstringMinor version number of the browser/client”0”, “4”, “2”
PatchstringPatch version number of the browser/client”4472”, “1”, “0”

os Object Fields

The os object provides parsed operating system information:
FieldTypeDescriptionExample
FamilystringName of the operating system”Windows”, “Mac OS X”, “iOS”, “Android”, “Linux”
MajorstringMajor version number of the OS”10”, “14”, “12”
MinorstringMinor version number of the OS”0”, “5”, “1”
PatchstringPatch version number of the OS”19041”, “1”, “0”
PatchMinorstringAdditional patch version detail (if available)“1”

device Object Fields

The device object provides parsed hardware device information:
FieldTypeDescriptionExample
FamilystringGeneral category or name of the device”iPhone”, “iPad”, “Samsung”, “Other”
BrandstringBrand/manufacturer of the device”Apple”, “Samsung”, “Google”, “Unknown”
ModelstringSpecific model of the device”iPhone 13”, “Galaxy S21”, “Pixel 6”

geo Object Fields

The geo object provides geographic location information based on IP geolocation:
FieldTypeDescriptionExample
countryCodestringISO 3166-1 alpha-2 country code”US”, “GB”, “DE”
regionCodestringRegion/state code”CA”, “NY”, “TX”
postalCodestringPostal or ZIP code”94102”, “10001”, “SW1A 1AA”
timezonestringIANA timezone identifier”America/Los_Angeles”, “Europe/London”
Geographic data is derived from IP address lookups and may not always be 100% accurate. The precision depends on the IP geolocation database and the nature of the recipient’s network connection.

Email Message Object Fields

The emailMessage object contains information about the original email that was sent. This object remains identical across all webhook events for the same email.
FieldTypeDescriptionPresent In
messageIDstringUnique identifier for the email message. Matches event.messageID and can be used to correlate events across the email lifecycle.All events
fromobjectThe sender information for the email. Contains the sender’s email address and display name.All events
toarrayArray of recipient objects. Each object contains the recipient’s email address and display name.All events
subjectstringThe subject line of the email as it was sent.All events
emailTypestringThe classification type of the email. Common values include transactional for system-generated emails (receipts, password resets, notifications) and marketing for promotional content. This helps distinguish email purposes for analytics and compliance.All events
ipIDintegerThe unique identifier of the specific IP address used to send this email. Use this to track which IP was used for delivery, useful for troubleshooting deliverability issues.All events
ipPoolIDintegerThe unique identifier of the IP pool from which the sending IP was selected. IP pools group multiple IPs together for load balancing and reputation management.All events
ipPoolstringThe name of the IP pool used for sending this email. This is the human-readable name assigned to the IP pool, making it easier to identify which pool was used without looking up the ID.All events
publicIPstringThe actual public IP address used by SendPost to deliver this email to the recipient’s mail server. This is the IP that receiving servers see and is important for monitoring sender reputation.All events
headersobjectKey-value pairs of custom headers that were included in the original email request. Use these for tracking campaigns, orders, or custom metadata.All events (if headers were sent)
groupsarrayArray of group names/tags that were assigned to the email for classification and filtering purposes.All events (if groups were assigned)

from Object Fields

The from object contains sender information:
FieldTypeDescriptionExample
emailstringThe email address of the sender[email protected]
namestringThe display name of the sender (shown in email clients)“Support Team”, “John Doe”

to Array Item Fields

Each item in the to array represents a recipient:
FieldTypeDescriptionExample
emailstringThe email address of the recipient[email protected]
namestringThe display name of the recipient”John Doe”, “Jane Smith”

headers Object

The headers object is a key-value store for custom headers:
FieldTypeDescriptionExample
{key}stringAny custom header key you included in your email request"X-Campaign-Id": "summer-2024"
Custom headers you send with your email are preserved and returned in all webhook events. This allows you to track emails throughout their lifecycle using your own identifiers.

groups Array

The groups array contains classification tags:
FieldTypeDescriptionExample
groups[n]stringA group/tag name assigned to categorize the email”transactional”, “marketing”, “order-confirmation”

SMTP Code and Description in Webhook Events

SMTP codes and descriptions provide detailed information about email delivery status. These fields are available in specific webhook events to help you understand delivery outcomes.

Availability by Event Type

Event TypesmtpCode AvailablesmtpDescription AvailableLocation in Payload
Processed (0)❌ No❌ NoN/A
Dropped (1)❌ No❌ NoN/A
Delivered (2)✅ Yes✅ Yesevent.smtpCode, event.smtpDescription, event.eventMetadata.smtpCode, event.eventMetadata.smtpDescription
SoftBounced (3)✅ Yes✅ Yesevent.smtpCode, event.smtpDescription, event.eventMetadata.smtpCode, event.eventMetadata.smtpDescription
HardBounced (4)✅ Yes✅ Yesevent.smtpCode, event.smtpDescription, event.eventMetadata.smtpCode, event.eventMetadata.smtpDescription
Opened (5)❌ No❌ NoN/A
Clicked (6)❌ No❌ NoN/A
Unsubscribed (7)❌ No❌ NoN/A
Spam (8)❌ No❌ NoN/A

Common SMTP Codes

Code RangeCategoryDescription
200-299SuccessEmail was accepted and delivered successfully
250SuccessRequested mail action completed
421TemporaryService not available, try again later
450TemporaryMailbox unavailable (busy or temporarily blocked)
451TemporaryLocal error in processing
452TemporaryInsufficient storage
500PermanentSyntax error, command unrecognized
550PermanentMailbox unavailable (not found or policy rejection)
551PermanentUser not local
552PermanentMessage size exceeds limit
553PermanentMailbox name not allowed
554PermanentTransaction failed

Example: Delivered Event with SMTP Code

{
  "event": {
    "eventID": "edhg-123gh-afasdf-124egh",
    "type": 2,
    "messageID": "mjhl-1401-sasdf-129324",
    "submittedAt": 1704067200,
    "smtpCode": 250,
    "smtpDescription": "email delivered successfully",
    "eventMetadata": {
      "smtpCode": 250,
      "smtpDescription": "email delivered successfully"
    }
  },
  "emailMessage": {
    "messageID": "mjhl-1401-sasdf-129324",
    "from": {
      "email": "[email protected]",
      "name": "Support Team"
    },
    "to": [
      {
        "email": "[email protected]",
        "name": "John Doe"
      }
    ],
    "subject": "Welcome to Our Service",
    "emailType": "transactional",
    "ipID": 42,
    "ipPoolID": 7,
    "ipPool": "transactional-pool",
    "publicIP": "192.0.2.100",
    "headers": {
      "X-Campaign-Id": "12345",
      "X-Custom-Header": "value"
    }
  }
}

Example: HardBounced Event with SMTP Code

{
  "event": {
    "eventID": "edhg-456gh-afasdf-124egh",
    "type": 4,
    "messageID": "mjhl-1401-sasdf-129324",
    "submittedAt": 1704067200,
    "smtpCode": 550,
    "smtpDescription": "Mailbox unavailable",
    "eventMetadata": {
      "smtpCode": 550,
      "smtpDescription": "Mailbox unavailable"
    }
  },
  "emailMessage": {
    "messageID": "mjhl-1401-sasdf-129324",
    "from": {
      "email": "[email protected]",
      "name": "Support Team"
    },
    "to": [
      {
        "email": "[email protected]",
        "name": "Invalid User"
      }
    ],
    "subject": "Welcome to Our Service",
    "emailType": "transactional",
    "ipID": 42,
    "ipPoolID": 7,
    "ipPool": "transactional-pool",
    "publicIP": "192.0.2.100",
    "headers": {
      "X-Campaign-Id": "12345"
    }
  }
}
SMTP codes and descriptions are available in both the top-level event object and within event.eventMetadata. Both locations contain the same values for consistency and ease of access.

Example: Opened Event with Full Metadata

{
  "event": {
    "eventID": "evt-789gh-bfasdf-567egh",
    "type": 5,
    "messageID": "mjhl-1401-sasdf-129324",
    "submittedAt": 1704067200,
    "eventMetadata": {
      "userAgent": {
        "Family": "Chrome",
        "Major": "91",
        "Minor": "0",
        "Patch": "4472"
      },
      "os": {
        "Family": "Mac OS X",
        "Major": "10",
        "Minor": "15",
        "Patch": "7"
      },
      "device": {
        "Family": "Mac",
        "Brand": "Apple",
        "Model": "MacBook Pro"
      },
      "geo": {
        "city": "San Francisco",
        "country": "United States",
        "countryCode": "US",
        "region": "California",
        "regionCode": "CA",
        "postalCode": "94102",
        "latitude": 37.7749,
        "longitude": -122.4194,
        "timezone": "America/Los_Angeles"
      },
      "trackedIP": "203.0.113.42",
      "rawUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
    }
  },
  "emailMessage": {
    "messageID": "mjhl-1401-sasdf-129324",
    "from": {
      "email": "[email protected]",
      "name": "Support Team"
    },
    "to": [
      {
        "email": "[email protected]",
        "name": "John Doe"
      }
    ],
    "subject": "Welcome to Our Service",
    "emailType": "marketing",
    "ipID": 15,
    "ipPoolID": 3,
    "ipPool": "marketing-pool",
    "publicIP": "192.0.2.50",
    "headers": {
      "X-Campaign-Id": "summer-sale-2024",
      "X-Customer-Segment": "VIP"
    },
    "groups": ["transactional", "welcome-series"]
  }
}

Example: Clicked Event with URL

{
  "event": {
    "eventID": "evt-101gh-cfasdf-890egh",
    "type": 6,
    "messageID": "mjhl-1401-sasdf-129324",
    "submittedAt": 1704067200,
    "eventMetadata": {
      "clickedURL": "https://example.com/products/summer-sale?utm_source=email&utm_campaign=summer-2024",
      "userAgent": {
        "Family": "Safari",
        "Major": "15",
        "Minor": "4"
      },
      "os": {
        "Family": "iOS",
        "Major": "15",
        "Minor": "4"
      },
      "device": {
        "Family": "iPhone",
        "Brand": "Apple",
        "Model": "iPhone 13"
      },
      "geo": {
        "city": "New York",
        "country": "United States",
        "countryCode": "US",
        "region": "New York",
        "regionCode": "NY",
        "postalCode": "10001",
        "latitude": 40.7128,
        "longitude": -74.0060,
        "timezone": "America/New_York"
      },
      "trackedIP": "198.51.100.78",
      "rawUserAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1"
    }
  },
  "emailMessage": {
    "messageID": "mjhl-1401-sasdf-129324",
    "from": {
      "email": "[email protected]",
      "name": "Example Marketing"
    },
    "to": [
      {
        "email": "[email protected]",
        "name": "Jane Smith"
      }
    ],
    "subject": "Don't Miss Our Summer Sale!",
    "emailType": "marketing",
    "ipID": 15,
    "ipPoolID": 3,
    "ipPool": "marketing-pool",
    "publicIP": "192.0.2.50",
    "headers": {
      "X-Campaign-Id": "summer-sale-2024",
      "X-Campaign-Type": "promotional"
    },
    "groups": ["marketing", "summer-campaign"]
  }
}

Custom Headers in Webhook Payloads

Any custom headers you include in your email request are preserved and included in all webhook event payloads. This allows you to track campaigns, add custom identifiers, or pass metadata through the entire email lifecycle.

How Headers are Preserved

  • Included in All Events: Custom headers sent in your email request are included in the emailMessage.headers object in all webhook events (Processed, Dropped, Delivered, Opened, Clicked, Bounced, Unsubscribed, Spam).
  • Same Across Lifecycle: The headers remain the same across all events for a given email message, allowing you to correlate events using your custom identifiers.
  • Original Format: Headers are returned exactly as you sent them in your email request.

Example: Email Request with Custom Headers

{
  "from": {
    "email": "[email protected]",
    "name": "Support Team"
  },
  "to": [
    {
      "email": "[email protected]",
      "name": "John Doe"
    }
  ],
  "subject": "Order Confirmation",
  "htmlBody": "<p>Thank you for your order!</p>",
  "headers": {
    "X-Campaign-Id": "summer-sale-2024",
    "X-Order-Id": "ORD-12345",
    "X-Customer-Segment": "VIP"
  }
}

Example: Webhook Payload with Preserved Headers

{
  "event": {
    "eventID": "edhg-123gh-afasdf-124egh",
    "type": 5,
    "messageID": "mjhl-1401-sasdf-129324",
    "submittedAt": 1704067200,
    "eventMetadata": {
      "userAgent": {
        "Family": "Chrome",
        "Major": "91"
      },
      "os": {
        "Family": "Windows"
      }
    }
  },
  "emailMessage": {
    "messageID": "mjhl-1401-sasdf-129324",
    "from": {
      "email": "[email protected]",
      "name": "Support Team"
    },
    "to": [
      {
        "email": "[email protected]",
        "name": "John Doe"
      }
    ],
    "subject": "Order Confirmation",
    "emailType": "transactional",
    "ipID": 42,
    "ipPoolID": 7,
    "ipPool": "transactional-pool",
    "publicIP": "192.0.2.100",
    "headers": {
      "X-Campaign-Id": "summer-sale-2024",
      "X-Order-Id": "ORD-12345",
      "X-Customer-Segment": "VIP"
    },
    "groups": ["transactional", "order-confirmation"]
  }
}

Use Cases for Custom Headers

Campaign Tracking:
{
  "headers": {
    "X-Campaign-Id": "summer-sale-2024",
    "X-Campaign-Type": "promotional"
  }
}
Order/Transaction Tracking:
{
  "headers": {
    "X-Order-Id": "ORD-12345",
    "X-Transaction-Id": "TXN-67890"
  }
}
Customer Segmentation:
{
  "headers": {
    "X-Customer-Segment": "VIP",
    "X-Customer-Tier": "premium"
  }
}
Custom headers are included in every webhook event for the email, allowing you to filter and process webhooks based on your custom identifiers or metadata.

Body

application/json
event
object
emailMessage
object

Response

200

Return a 200 status to indicate that the data was received successfully