> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sendpost.io/llms.txt
> Use this file to discover all available pages before exploring further.

# SendPost Webhook Object

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](/api-reference/webhook/understanding-webhook-event-lifecycle).

## Complete Webhook Payload Structure

Every webhook payload sent by SendPost follows this structure:

```json theme={null}
{
  "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.

| Field             | Type    | Description                                                                                                                                                                                                                              | Present In                          |
| ----------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| `eventID`         | string  | Unique 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                          |
| `type`            | integer | Numeric code indicating the type of event. See the Event Types table below for all possible values.                                                                                                                                      | All events                          |
| `messageID`       | string  | Unique 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                          |
| `submittedAt`     | integer | Unix 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                          |
| `smtpCode`        | integer | The 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 |
| `smtpDescription` | string  | Human-readable description of the SMTP response. Provides context about why an email was delivered, bounced, or rejected.                                                                                                                | Delivered, SoftBounced, HardBounced |
| `eventMetadata`   | object  | Contains 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 Event | Type Field Value | Description                                                                          |
| ------------- | ---------------- | ------------------------------------------------------------------------------------ |
| Processed     | 0                | Email has been accepted by SendPost and is queued for delivery                       |
| Dropped       | 1                | Email was not sent due to suppression list, invalid recipient, or policy violation   |
| Delivered     | 2                | Email was successfully delivered to the recipient's mail server                      |
| SoftBounced   | 3                | Email delivery temporarily failed; SendPost will retry delivery                      |
| HardBounced   | 4                | Email delivery permanently failed; the recipient address is invalid or doesn't exist |
| Opened        | 5                | Recipient opened the email (requires tracking pixel)                                 |
| Clicked       | 6                | Recipient clicked a link in the email (requires link tracking)                       |
| Unsubscribed  | 7                | Recipient unsubscribed via the unsubscribe link                                      |
| Spam          | 8                | Recipient marked the email as spam                                                   |

***

## Event Metadata Fields

The `eventMetadata` object contains event-specific information. Different fields are populated depending on the event type.

| Field             | Type    | Description                                                                                             | Present In                          |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| `clickedURL`      | string  | The full URL that the recipient clicked. Only present when a link click is tracked.                     | Clicked                             |
| `smtpCode`        | integer | Duplicate of `event.smtpCode` for convenience. The SMTP response code from the recipient's mail server. | Delivered, SoftBounced, HardBounced |
| `smtpDescription` | string  | Duplicate of `event.smtpDescription` for convenience. Human-readable SMTP response description.         | Delivered, SoftBounced, HardBounced |
| `userAgent`       | object  | Parsed user agent information identifying the email client or browser used to open/click.               | Opened, Clicked                     |
| `os`              | object  | Parsed operating system information of the device used to open/click.                                   | Opened, Clicked                     |
| `device`          | object  | Parsed device information identifying the hardware used to open/click.                                  | Opened, Clicked                     |
| `geo`             | object  | Geographic location information based on the IP address of the recipient when they opened/clicked.      | Opened, Clicked                     |
| `trackedIP`       | string  | The IP address of the recipient when they clicked a link.                                               | Clicked                             |
| `rawUserAgent`    | string  | The 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:

| Field    | Type   | Description                                | Example                                |
| -------- | ------ | ------------------------------------------ | -------------------------------------- |
| `Family` | string | Name of the browser or email client        | "Chrome", "Safari", "Outlook", "Gmail" |
| `Major`  | string | Major version number of the browser/client | "91", "15", "16"                       |
| `Minor`  | string | Minor version number of the browser/client | "0", "4", "2"                          |
| `Patch`  | string | Patch version number of the browser/client | "4472", "1", "0"                       |

### os Object Fields

The `os` object provides parsed operating system information:

| Field        | Type   | Description                                    | Example                                          |
| ------------ | ------ | ---------------------------------------------- | ------------------------------------------------ |
| `Family`     | string | Name of the operating system                   | "Windows", "Mac OS X", "iOS", "Android", "Linux" |
| `Major`      | string | Major version number of the OS                 | "10", "14", "12"                                 |
| `Minor`      | string | Minor version number of the OS                 | "0", "5", "1"                                    |
| `Patch`      | string | Patch version number of the OS                 | "19041", "1", "0"                                |
| `PatchMinor` | string | Additional patch version detail (if available) | "1"                                              |

### device Object Fields

The `device` object provides parsed hardware device information:

| Field    | Type   | Description                            | Example                                 |
| -------- | ------ | -------------------------------------- | --------------------------------------- |
| `Family` | string | General category or name of the device | "iPhone", "iPad", "Samsung", "Other"    |
| `Brand`  | string | Brand/manufacturer of the device       | "Apple", "Samsung", "Google", "Unknown" |
| `Model`  | string | Specific model of the device           | "iPhone 13", "Galaxy S21", "Pixel 6"    |

### geo Object Fields

The `geo` object provides geographic location information based on IP geolocation:

| Field         | Type   | Description                     | Example                                 |
| ------------- | ------ | ------------------------------- | --------------------------------------- |
| `countryCode` | string | ISO 3166-1 alpha-2 country code | "US", "GB", "DE"                        |
| `regionCode`  | string | Region/state code               | "CA", "NY", "TX"                        |
| `postalCode`  | string | Postal or ZIP code              | "94102", "10001", "SW1A 1AA"            |
| `timezone`    | string | IANA timezone identifier        | "America/Los\_Angeles", "Europe/London" |

<Info>
  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.
</Info>

***

## 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.

| Field       | Type    | Description                                                                                                                                                                                                                                                     | Present In                           |
| ----------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| `messageID` | string  | Unique identifier for the email message. Matches `event.messageID` and can be used to correlate events across the email lifecycle.                                                                                                                              | All events                           |
| `from`      | object  | The sender information for the email. Contains the sender's email address and display name.                                                                                                                                                                     | All events                           |
| `to`        | array   | Array of recipient objects. Each object contains the recipient's email address and display name.                                                                                                                                                                | All events                           |
| `subject`   | string  | The subject line of the email as it was sent.                                                                                                                                                                                                                   | All events                           |
| `emailType` | string  | The 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                           |
| `ipID`      | integer | The 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                           |
| `ipPoolID`  | integer | The 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                           |
| `ipPool`    | string  | The 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                           |
| `publicIP`  | string  | The 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                           |
| `headers`   | object  | Key-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)    |
| `groups`    | array   | Array 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:

| Field   | Type   | Description                                             | Example                                             |
| ------- | ------ | ------------------------------------------------------- | --------------------------------------------------- |
| `email` | string | The email address of the sender                         | "[support@example.com](mailto:support@example.com)" |
| `name`  | string | The 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:

| Field   | Type   | Description                        | Example                                               |
| ------- | ------ | ---------------------------------- | ----------------------------------------------------- |
| `email` | string | The email address of the recipient | "[customer@example.com](mailto:customer@example.com)" |
| `name`  | string | The display name of the recipient  | "John Doe", "Jane Smith"                              |

### headers Object

The `headers` object is a key-value store for custom headers:

| Field   | Type   | Description                                              | Example                          |
| ------- | ------ | -------------------------------------------------------- | -------------------------------- |
| `{key}` | string | Any custom header key you included in your email request | `"X-Campaign-Id": "summer-2024"` |

<Info>
  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.
</Info>

### groups Array

The `groups` array contains classification tags:

| Field       | Type   | Description                                       | Example                                            |
| ----------- | ------ | ------------------------------------------------- | -------------------------------------------------- |
| `groups[n]` | string | A 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 Type       | smtpCode Available | smtpDescription Available | Location in Payload                                                                                              |
| ---------------- | ------------------ | ------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| Processed (0)    | ❌ No               | ❌ No                      | N/A                                                                                                              |
| Dropped (1)      | ❌ No               | ❌ No                      | N/A                                                                                                              |
| Delivered (2)    | ✅ Yes              | ✅ Yes                     | `event.smtpCode`, `event.smtpDescription`, `event.eventMetadata.smtpCode`, `event.eventMetadata.smtpDescription` |
| SoftBounced (3)  | ✅ Yes              | ✅ Yes                     | `event.smtpCode`, `event.smtpDescription`, `event.eventMetadata.smtpCode`, `event.eventMetadata.smtpDescription` |
| HardBounced (4)  | ✅ Yes              | ✅ Yes                     | `event.smtpCode`, `event.smtpDescription`, `event.eventMetadata.smtpCode`, `event.eventMetadata.smtpDescription` |
| Opened (5)       | ❌ No               | ❌ No                      | N/A                                                                                                              |
| Clicked (6)      | ❌ No               | ❌ No                      | N/A                                                                                                              |
| Unsubscribed (7) | ❌ No               | ❌ No                      | N/A                                                                                                              |
| Spam (8)         | ❌ No               | ❌ No                      | N/A                                                                                                              |

### Common SMTP Codes

| Code Range | Category  | Description                                         |
| ---------- | --------- | --------------------------------------------------- |
| 200-299    | Success   | Email was accepted and delivered successfully       |
| 250        | Success   | Requested mail action completed                     |
| 421        | Temporary | Service not available, try again later              |
| 450        | Temporary | Mailbox unavailable (busy or temporarily blocked)   |
| 451        | Temporary | Local error in processing                           |
| 452        | Temporary | Insufficient storage                                |
| 500        | Permanent | Syntax error, command unrecognized                  |
| 550        | Permanent | Mailbox unavailable (not found or policy rejection) |
| 551        | Permanent | User not local                                      |
| 552        | Permanent | Message size exceeds limit                          |
| 553        | Permanent | Mailbox name not allowed                            |
| 554        | Permanent | Transaction failed                                  |

### Example: Delivered Event with SMTP Code

```json theme={null}
{
  "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": "support@example.com",
      "name": "Support Team"
    },
    "to": [
      {
        "email": "customer@example.com",
        "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

```json theme={null}
{
  "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": "support@example.com",
      "name": "Support Team"
    },
    "to": [
      {
        "email": "invalid@example.com",
        "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"
    }
  }
}
```

<Info>
  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.
</Info>

***

## Example: Opened Event with Full Metadata

```json theme={null}
{
  "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": "support@example.com",
      "name": "Support Team"
    },
    "to": [
      {
        "email": "customer@example.com",
        "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

```json theme={null}
{
  "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": "marketing@example.com",
      "name": "Example Marketing"
    },
    "to": [
      {
        "email": "customer@example.com",
        "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

```json theme={null}
{
  "from": {
    "email": "support@example.com",
    "name": "Support Team"
  },
  "to": [
    {
      "email": "customer@example.com",
      "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

```json theme={null}
{
  "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": "support@example.com",
      "name": "Support Team"
    },
    "to": [
      {
        "email": "customer@example.com",
        "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:**

```json theme={null}
{
  "headers": {
    "X-Campaign-Id": "summer-sale-2024",
    "X-Campaign-Type": "promotional"
  }
}
```

**Order/Transaction Tracking:**

```json theme={null}
{
  "headers": {
    "X-Order-Id": "ORD-12345",
    "X-Transaction-Id": "TXN-67890"
  }
}
```

**Customer Segmentation:**

```json theme={null}
{
  "headers": {
    "X-Customer-Segment": "VIP",
    "X-Customer-Tier": "premium"
  }
}
```

<Info>
  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.
</Info>

<aside class="success">
  Note that at times your application may go down and as a result webhook API calls may fail. In such a scenario SendPost will attempt retry on the webhook for the next 10 hours before cancelling it forever.
</aside>


## OpenAPI

````yaml webhook SendPostWebhooks
openapi: 3.1.0
info:
  title: SendPost API
  version: 1.0.0
  description: >
    # Introduction


    SendPost provides email API and SMTP relay which can be used not just to
    send & measure but also alert & optimised email sending.


    You can use SendPost to:


    * Send personalised emails to multiple recipients using email API 


    * Track opens and clicks


    * Analyse statistics around open, clicks, bounce, unsubscribe and spam 



    At and advanced level you can use it to:


    * Manage multiple sub-accounts which may map to your promotional or
    transactional sending, multiple product lines or multiple customers 


    * Classify your emails using groups for better analysis


    * Analyse and fix email sending at sub-account level, IP Pool level or group
    level


    * Have automated alerts to notify disruptions regarding email sending


    * Manage different dedicated IP Pools so to better control your email
    sending


    * Automatically know when IP or domain is blacklisted or sender score is
    down


    * Leverage pro deliverability tools to get significantly better email
    deliverability & inboxing



    [<img src="https://run.pstmn.io/button.svg" alt="Run In Postman"
    style="width: 128px; height:
    32px;">](https://god.gw.postman.com/run-collection/33476323-e6dbd27f-c4a7-4d49-bcac-94b0611b938b?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D33476323-e6dbd27f-c4a7-4d49-bcac-94b0611b938b%26entityType%3Dcollection%26workspaceId%3D6b1e4f65-96a9-4136-9512-6266c852517e) 


    # Overview


    ## REST API


    SendPost API is built on REST API principles. Authenticated users can
    interact with any of the API endpoints to perform:


    * **GET**- to get a resource


    * **POST** - to create a resource


    * **PUT** - to update an existing resource


    * **DELETE** - to delete a resource



    The API endpoint for all API calls is:

    <code>https://api.sendpost.io/api/v1</code>



    Some conventions that have been followed in the API design overall are
    following:



    * All resources have either <code>/api/v1/subaccount</code> or
    <code>/api/v1/account</code> in their API call resource path based on who is
    authorised for the resource. All API calls with path
    <code>/api/v1/subaccount</code> use <code>X-SubAccount-ApiKey</code> in
    their request header. Likewise all API calls with path
    <code>/api/v1/account</code> use <code>X-Account-ApiKey</code> in their
    request header.


    * All resource endpoints end with singular name and not plural. So we have
    <code>domain</code> instead of domains for domain resource endpoint.
    Likewise we have <code>sender</code> instead of senders for sender resource
    endpoint.


    * Body submitted for POST / PUT API calls as well as JSON response from
    SendPost API follow camelcase convention


    * All timestamps returned in response (created or submittedAt response
    fields) are UNIX nano epoch timestamp.



    <aside class="success">

    All resources have either <code>/api/v1/subaccount</code> or
    <code>/api/v1/account</code> in their API call resource path based on who is
    authorised for the resource. All API calls with path
    <code>/api/v1/subaccount</code> use <code>X-SubAccount-ApiKey</code> in
    their request header. Likewise all API calls with path
    <code>/api/v1/account</code> use <code>X-Account-ApiKey</code> in their
    request header.

    </aside>



    SendPost uses conventional HTTP response codes to indicate the success or
    failure of an API request. 



    * Codes in the <code>2xx</code> range indicate success. 


    * Codes in the <code>4xx</code> range indicate an error owing due to
    unauthorize access, incorrect request parameters or body etc.


    * Code in the <code>5xx</code> range indicate an eror with SendPost's
    servers ( internal service issue or maintenance )



    <aside class="info">

    SendPost all responses return <code>created</code> in UNIX nano epoch
    timestamp. 

    </aside>



    ## Authentication


    SendPost uses API keys for authentication. You can register a new SendPost
    API key at our [developer portal](https://app.sendpost.io/register).



    SendPost expects the API key to be included in all API requests to the
    server in a header that looks like the following:



    `X-SubAccount-ApiKey: AHEZEP8192SEGH`



    This API key is used for all Sub-Account level operations such as:


    * Sending emails


    * Retrieving stats regarding open, click, bounce, unsubscribe and spam


    * Uploading suppressions list


    * Verifying sending domains

    and more


    In addition to <code>X-SubAccount-ApiKey</code> you also have another API
    Key <code>X-Account-APIKey</code> which is used for Account level operations
    such as :


    * Creating and managing sub-accounts


    * Allocating IPs for your account


    * Getting overall billing and usage information


    * Email List validation


    * Creating and managing alerts

    and more



    <aside class="notice">

    You must look at individual API reference page to look at whether
    <code>X-SubAccount-ApiKey</code> is required or
    <code>X-Account-ApiKey</code>

    </aside>



    In case an incorrect API Key header is specified or if it is missed you will
    get HTTP Response 401 ( Unauthorized ) response from SendPost.



    ## HTTP Response Headers



    Code           | Reason                 | Details

    ---------------| -----------------------| -----------

    200            | Success                | Everything went well

    401            | Unauthorized           | Incorrect or missing API header
    either <code>X-SubAccount-ApiKey</code> or <code>X-Account-ApiKey</code>

    403            | Forbidden              | Typically sent when resource with
    same name or details already exist

    406            | Missing resource id    | Resource id specified is either
    missing or doesn't exist

    422            | Unprocessable entity   | Request body is not in proper
    format

    500            | Internal server error  | Some error happened at SendPost
    while processing API request

    503            | Service Unavailable    | SendPost is offline for
    maintenance. Please try again later


    # API SDKs


    We have native SendPost SDKs in the following programming languages. You can
    integrate with them or create your own SDK with our API specification. In
    case you need any assistance with respect to API then do reachout to our
    team from website chat or email us at **hello@sendpost.io**



    * [PHP](https://github.com/sendpost/sendpost_php_sdk)


    * [Javascript](https://github.com/sendpost/sendpost_javascript_sdk)


    * [Ruby](https://github.com/sendpost/sendpost_ruby_sdk)


    * [Python](https://github.com/sendpost/sendpost_python_sdk)


    * [Golang](https://github.com/sendpost/sendpost_go_sdk)



    # API Reference


    SendX REST API can be broken down into two major sub-sections:



    * Sub-Account


    * Account 



    Sub-Account API operations enable common email sending API use-cases like
    sending bulk email, adding new domains or senders for email sending
    programmatically, retrieving stats, adding suppressions etc. All Sub-Account
    API operations need to pass <code>X-SubAccount-ApiKey</code> header with
    every API call.



    The Account API operations allow users to manage multiple sub-accounts and
    manage IPs. A single parent SendPost account can have 100's of sub-accounts.
    You may want to create sub-accounts for different products your company is
    running or to segregate types of emails or for managing email sending across
    multiple customers of yours.



    # SMTP Reference


    Simple Mail Transfer Protocol (SMTP) is a quick and easy way to send email
    from one server to another. SendPost provides an SMTP service that allows
    you to deliver your email via our servers instead of your own client or
    server. 

    This means you can count on SendPost's delivery at scale for your SMTP
    needs. 



    ## Integrating SMTP 



    1. Get the SMTP `username` and `password` from your SendPost account.


    2. Set the server host in your email client or application to
    `smtp.sendpost.io`. This setting is sometimes referred to as the external
    SMTP server or the SMTP relay.


    3. Set the `username` and `password`.


    4. Set the port to `587` (or as specified below).


    ## SMTP Ports



    - For an unencrypted or a TLS connection, use port `25`, `2525` or `587`.


    - For a SSL connection, use port `465`


    - Check your firewall and network to ensure they're not blocking any of our
    SMTP Endpoints.



    SendPost supports STARTTLS for establishing a TLS-encrypted connection.
    STARTTLS is a means of upgrading an unencrypted connection to an encrypted
    connection. There are versions of STARTTLS for a variety of protocols; the
    SMTP version is defined in [RFC 3207](https://www.ietf.org/rfc/rfc3207.txt).



    To set up a STARTTLS connection, the SMTP client connects to the SendPost
    SMTP endpoint `smtp.sendpost.io` on port 25, 587, or 2525, issues an EHLO
    command, and waits for the server to announce that it supports the STARTTLS
    SMTP extension. The client then issues the STARTTLS command, initiating TLS
    negotiation. When negotiation is complete, the client issues an EHLO command
    over the new encrypted connection, and the SMTP session proceeds normally.



    <aside class="success">

    If you are unsure which port to use, a TLS connection on port 587 is
    typically recommended.

    </aside>



    ## Sending email from your application



    ```javascript

    "use strict";


    const nodemailer = require("nodemailer");


    async function main() {

    // create reusable transporter object using the default SMTP transport

    let transporter = nodemailer.createTransport({

    host: "smtp.sendpost.io",

    port: 587,

    secure: false, // true for 465, false for other ports

    auth: {

    user:  "<username>" , // generated ethereal user

    pass: "<password>", // generated ethereal password

    },

    requireTLS: true,

    debug: true,

    logger: true,

    });


    // send mail with defined transport object

    try {

    let info = await transporter.sendMail({

    from: 'erlich@piedpiper.com',

    to: 'gilfoyle@piedpiper.com',

    subject: 'Test Email Subject',

    html: '<h1>Hello Geeks!!!</h1>',

    });

    console.log("Message sent: %s", info.messageId);

    } catch (e) {

    console.log(e)

    }

    }


    main().catch(console.error);

    ```


    For PHP



    ```php

    <?php

    // Import PHPMailer classes into the global namespace

    use PHPMailer\PHPMailer\PHPMailer;

    use PHPMailer\PHPMailer\SMTP;

    use PHPMailer\PHPMailer\Exception;


    // Load Composer's autoloader

    require 'vendor/autoload.php';


    $mail = new PHPMailer(true);


    // Settings

    try {

    $mail->SMTPDebug = SMTP::DEBUG_CONNECTION;                  // Enable
    verbose debug output

    $mail->isSMTP();                                            // Send using
    SMTP

    $mail->Host       = 'smtp.sendpost.io';                     // Set the SMTP
    server to send through

    $mail->SMTPAuth   = true;                                   // Enable SMTP
    authentication

    $mail->Username   = '<username>';                           // SMTP username

    $mail->Password   = '<password>';                           // SMTP password

    $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;         // Enable
    implicit TLS encryption

    $mail->Port       = 587;                                    // TCP port to
    connect to; use 587 if you have set `SMTPSecure =
    PHPMailer::ENCRYPTION_STARTTLS`


    //Recipients

    $mail->setFrom('erlich@piedpiper.com', 'Erlich');

    $mail->addAddress('gilfoyle@piedpiper.com', 'Gilfoyle');


    //Content

    $mail->isHTML(true);                                  //Set email format to
    HTML

    $mail->Subject = 'Here is the subject';

    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';

    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';


    $mail->send();

    echo 'Message has been sent';


    } catch (Exception $e) {

    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";

    }

    ```

    For Python

    ```python

    #!/usr/bin/python3


    import sys

    import os

    import re


    from smtplib import SMTP

    import ssl


    from email.mime.text import MIMEText


    SMTPserver = 'smtp.sendpost.io'

    PORT = 587

    sender =     'erlich@piedpiper.com'

    destination = ['gilfoyle@piedpiper.com']


    USERNAME = "<username>"

    PASSWORD = "<password>"


    # typical values for text_subtype are plain, html, xml

    text_subtype = 'plain'


    content="""\

    Test message

    """


    subject="Sent from Python"


    try:

    msg = MIMEText(content, text_subtype)

    msg['Subject']= subject

    msg['From']   = sender


    conn = SMTP(SMTPserver, PORT)

    conn.ehlo()

    context = ssl.create_default_context()

    conn.starttls(context=context)  # upgrade to tls

    conn.ehlo()

    conn.set_debuglevel(True)

    conn.login(USERNAME, PASSWORD)


    try:

    resp = conn.sendmail(sender, destination, msg.as_string())

    print("Send Mail Response: ", resp)

    except Exception as e:

    print("Send Email Error: ", e)

    finally:

    conn.quit()


    except Exception as e:

    print("Error:", e)

    ```

    For Golang

    ```go

    package main


    import (

    "fmt"

    "net/smtp"

    "os"

    )


    // Sending Email Using Smtp in Golang


    func main() {


    username := "<username>"

    password := "<password>"


    from := "erlich@piedpiper.com"

    toList := []string{"gilfoyle@piedpiper.com"}

    host := "smtp.sendpost.io"

    port := "587" // recommended


    // This is the message to send in the mail

    msg := "Hello geeks!!!"


    // We can't send strings directly in mail,

    // strings need to be converted into slice bytes

    body := []byte(msg)


    // PlainAuth uses the given username and password to

    // authenticate to host and act as identity.

    // Usually identity should be the empty string,

    // to act as username.

    auth := smtp.PlainAuth("", username, password, host)


    // SendMail uses TLS connection to send the mail

    // The email is sent to all address in the toList,

    // the body should be of type bytes, not strings

    // This returns error if any occured.

    err := smtp.SendMail(host+":"+port, auth, from, toList, body)


    // handling the errors

    if err != nil {

    fmt.Println(err)

    os.Exit(1)

    }


    fmt.Println("Successfully sent mail to all user in toList")

    }


    ```

    For Java

    ```java

    // implementation 'com.sun.mail:javax.mail:1.6.2'


    import java.util.Properties;


    import javax.mail.Message;

    import javax.mail.Session;

    import javax.mail.Transport;

    import javax.mail.internet.InternetAddress;

    import javax.mail.internet.MimeMessage;


    public class SMTPConnect {


    // This address must be verified.

    static final String FROM = "erlich@piedpiper.com";

    static final String FROMNAME = "Erlich Bachman";


    // Replace recipient@example.com with a "To" address. If your account

    // is still in the sandbox, this address must be verified.

    static final String TO = "gilfoyle@piedpiper.com";


    // Replace smtp_username with your SendPost SMTP user name.

    static final String SMTP_USERNAME = "<username>";


    // Replace smtp_password with your SendPost SMTP password.

    static final String SMTP_PASSWORD = "<password>";


    // SMTP Host Name

    static final String HOST = "smtp.sendpost.io";


    // The port you will connect to on SendPost SMTP Endpoint.

    static final int PORT = 587;


    static final String SUBJECT = "SendPost SMTP Test (SMTP interface accessed
    using Java)";


    static final String BODY = String.join(

    System.getProperty("line.separator"),

    "<h1>SendPost SMTP Test</h1>",

    "<p>This email was sent with SendPost using the ",

    "<a href='https://github.com/eclipse-ee4j/mail'>Javamail Package</a>",

    " for <a href='https://www.java.com'>Java</a>."

    );


    public static void main(String[] args) throws Exception {


    // Create a Properties object to contain connection configuration
    information.

    Properties props = System.getProperties();

    props.put("mail.transport.protocol", "smtp");

    props.put("mail.smtp.port", PORT);

    props.put("mail.smtp.starttls.enable", "true");

    props.put("mail.smtp.debug", "true");

    props.put("mail.smtp.auth", "true");


    // Create a Session object to represent a mail session with the specified
    properties.

    Session session = Session.getDefaultInstance(props);


    // Create a message with the specified information.

    MimeMessage msg = new MimeMessage(session);

    msg.setFrom(new InternetAddress(FROM,FROMNAME));

    msg.setRecipient(Message.RecipientType.TO, new InternetAddress(TO));

    msg.setSubject(SUBJECT);

    msg.setContent(BODY,"text/html");


    // Create a transport.

    Transport transport = session.getTransport();


    // Send the message.

    try {

    System.out.println("Sending...");


    // Connect to SendPost SMTP using the SMTP username and password you
    specified above.

    transport.connect(HOST, SMTP_USERNAME, SMTP_PASSWORD);


    // Send the email.

    transport.sendMessage(msg, msg.getAllRecipients());

    System.out.println("Email sent!");


    } catch (Exception ex) {


    System.out.println("The email was not sent.");

    System.out.println("Error message: " + ex.getMessage());

    System.out.println(ex);

    }

    // Close and terminate the connection.

    }

    }

    ```


    Many programming languages support sending email using SMTP. This capability
    might be built into the programming language itself, or it might be
    available as an add-on, plug-in, or library. You can take advantage of this
    capability by sending email through SendPost from within application
    programs that you write.


    We have provided examples in Python3, Golang, Java, PHP, JS.
servers:
  - url: https://api.sendpost.io/api/v1
security: []
tags:
  - name: Email
    description: >
      This API allows you to send emails from a specific sub-account. You can
      specify one email recipient or multiple recipients with this API call. You
      can provide options for tracking opens or clicks, having dynamic custom
      fields or if-else conditions for email personalisation.


      You can also assign various groups to each API call which will later be
      useful while analysing stats. Also you can specify custom headers which
      will be added to webhook payload on occurrence of events such as email
      processed, delivered, opened, clicked, bounced, unsubscribed etc.


      If you are running on dedicated IP plan then you can also specify the
      IPPool from which emails should be sent.

      ## Personalisation within email

      SendPost allows users to personalize email content dynamically using
      Handlebars. Personalization can be applied to the text body, html body and
      the subject itself. Here's how you can utilize custom field variables to
      enhance your email communication.

      ```js

      {
        "from": {
          "email": "richard@piedpiper.com",
          "name": "Richard"
        },
        "to": [
          {
            "email": "gavin@hooli.com",
            "name": "Gavin Belson",
            "customFields": {
              "firstName": "Gavin",
              "discountCode": "BELSON240"
              "status": "VIP"
            }
          },
          {
            "email": "erlich@piedpiper.com",
            "name": "Erlich Bachman",
            "customFields": {
              "firstName": "Erlich",
              "discountCode" : "BACHMAN10"
              "status": "Incubator"
            }
          },
        ],
        "subject": "Hello, {{firstName}}! Welcome to Pied Piper!",
        "htmlBody": "<p>Hi {{firstName}},</p><p>Your discount code is <b>{{discountCode}}</b>. Your account status is {{status}}}.</p>",
        "textBody": "Hi {{firstName}},\n\nYour discount code is {{discountCode}}. Your account status is {{status}}.",
        "ippool": "default",
        "trackOpens": true,
        "trackClicks": true,
        "groups": [
          "special-offers"
        ]
      }

      ```


      ### Explanation:

      Custom Fields for Personalization:

      - Each recipient in the to array has a customFields map. 

      - These fields are used to dynamically render the email content.

      - Example: `{{firstName}}`, `{{discountCode}}`, and `{{status}}` in the
      subject, htmlBody, and textBody are replaced with the respective values
      from customFields.

      ### Output Example:


      For gavin@hooli.com:



      Subject: Hello, Gavin! Your Special Offer Awaits

      <p>Hi Gavin,</p><p>Your discount code is <b>BELSON240</b>. Your account
      status is VIP.</p>



      ---




      For erlich@piedpier.com:




      Subject: Hello, Erlich! Your Special Offer Awaits

      <p>Hi Erlich,</p><p>Your discount code is <b>BACHMAN10</b>. Your account
      status is Incubator.</p>



      ---


      ### Note: 

      <strong>`unsubscribe` is a reserved custom field name. You can't use it as
      a custom field name.</strong>


      ## Unsubscribe link in your templates

      Here is how to add an unsubscribe link to your SendPost email templates.

      Add this to your email template:


      ```


      <a href='{{unsubscribe}}'>Unsubscribe</a>

      ```


      Any user who clicks on this will get added to the suppression list on your
      SendPost subaccount.
  - name: Domain
    description: >
      This API allows you to manage your domains for a specific sub-account.
      Across all the requests you need to pass X-SubAccount-ApiKey header.
  - name: Stats
    description: >
      This API allows you to get your stats for a specific sub-account. Across
      all the requests you need to pass X-SubAccount-ApiKey header. You will be
      able to see email processed, delivered, opens, clicks, hardBounce,
      softBounce, unsubscribe and spam complaints.
  - name: Suppression
    description: >
      This API allows you to manage your suppressions for a specific
      sub-account. Across all the requests you need to pass X-SubAccount-ApiKey
      header.
  - name: IP
    description: >
      This API allows you to manage your ips for a specific account. Across all
      the requests you need to pass X-Account-ApiKey header.
  - name: IPPools
    description: >
      This API allows you to manage your ippools for a specific account. Across
      all the requests you need to pass X-Account-ApiKey header.

      ## Routing Strategies and Metadata


      ### routing_strategy 0 (RoundRobinStrategy)

      In RoundRobinStrategy all your emails are fairly shared between all your
      IPs and TPSPs


      The payload for routingMetaData for RoundRobinStrategy is:


      Key | Value

      --------- | -----------

      routingStrategy | 0

      routingMetaData | "{}"



      For example, if you have IP 3.238.19.86 and TPSPs Sendgrid and Mailgun and
      send 6 emails then 2 emails will be sent from 3.238.19.86, Mailgun and
      Sengrid.


      ### routing_strategy 1 (EmailProviderStrategy)


      In the EmailProviderStrategy we can assign IPs and TPSPs to the specific
      email provider.


      Existing email provider types:


      Id | Description

      --------- | -----------

      0 | Email provider Gmail

      1 | Email provider Yahoo

      2 | Email provider AOL

      3 | Email provider Microsoft

      4 | Email provider Comcast

      5 | Email provider Yandex

      6 | Email provider GMX

      7 | Email provider Mailru

      8 | Email provider Icloud

      9 | Email provider Zoho

      10 | Email provider QQ

      11 | Email provider default



      Key | Value

      --------- | -----------

      routingStrategy | 1

      routingMetaData | JSON payload


      JSON payload example:

      ```json

      {
        "0": "[\"IP_100\",\"IP_105\"]",
        "1": "[\"TPSP_101\"]",
        "others": "[\"IP_102\",\"TPSP_103\",\"IP_104\"]"
      } 

      ```



      On the left side, you can see the email types: 0 is Gmail, 1 is Yahoo, and
      'others' in this case all email addresses that don't belong to Yahoo or
      Gmail, the left side key is in the string format. Currently, for the right
      side, the format is an Array of strings in the format of "Entity_ID".
      Where 'Entity' could be 'IP' or 'TPSP' (third-party sending provider).


      For example, the 'IP_' prefix means that the entity is IP, and 100 in
      "IP_100" mean that the ID of this IP is 100. For example, the 'TPSP_'
      prefix means that the entity is TPSP, and 101 in "TPSP_101" mean that the
      ID of this TPSP is 101.


      The metadata above means: that for Gmail we send emails fairly between IPs
      with ID 105 and ID 100; and for Yahoo, we send emails from TPSP with ID
      101; and for all the rest email types we send fairly from the TPSP with ID
      103 and from IP with ID 104 and 102.


      ### routing_strategy 2 (VolumePercentageStrategy)


      In the VolumePercentageStrategy we can assign volumes to the specific IPs
      and TPSPs.


      Key | Value

      --------- | -----------

      routingStrategy | 2

      routingMetaData | JSON payload


      JSON payload example:


      ```json 

      {
        "IP_100":   "2",
        "IP_101":   "3",
        "TPSP_102": "1",
        "TPSP_103": "4"
      }

      ```

      Currently, for the left side, the format is a string in the format of
      "Entity_ID". Where 'Entity' could be 'IP' or 'TPSP' (third-party sending
      provider). And for the right side, the volume number of emails that we
      send (also in the string format).


      For example, the 'IP_' prefix means that the entity is IP, and 100 in
      "IP_100" mean that the ID of this IP is 100. For example, the 'TPSP_'
      prefix means that the entity is TPSP, and 101 in "TPSP_101" mean that the
      ID of this TPSP is 101.


      The metadata above means: that, for example, if we send 20 emails, 4 go
      from IP with ID 100, 6 go from IP with ID 101, 2 go from TPSP with ID 102,
      and 8 go from TPSP with ID 103.


      ### routing_strategy 3 (SendingDomainStrategy)

      In the SendingDomainStrategy we can assign IPs and TPSPs to the specific
      domains that we are sending from.


      Key | Value

      --------- | -----------

      routingStrategy | 3

      routingMetaData | JSON payload


      JSON payload example:

      ```json 

      {
        "sendx.io":    "[\"TPSP_100\",\"IP_105\"]",
        "sendpost.io": "[\"IP_101\"]",
        "others":      "[\"IP_102\",\"IP_103\",\"TPSP_104\"]"
      }

      ```


      On the left side, you can see the domains, in this case, it's sendx.io and
      sendpost.io, and 'others'. The email would be put in the 'others' category
      if its domain doesn't belong to sendx.io or sendpost.io. Currently, for
      the right side, the format is an Array of strings in the format of
      "Entity_ID". Where 'Entity' could be 'IP' or 'TPSP' (third-party sending
      provider).


      For example, the 'IP_' prefix means that the entity is IP, and 100 in
      "IP_100" mean that the ID of this IP is 100. For example, the 'TPSP_'
      prefix means that the entity is TPSP, and 101 in "TPSP_101" mean that the
      ID of this TPSP is 101.


      The metadata above means: that, for example, if we send emails from
      t1@sendx.io, t2@sendx.io, t1@sendpost.io, t1@gmail.com, t2@gmail.com,
      t3@gmail.com, t4@yahoo.com The sendx.io emails (t1@sendx.io, t2@sendx.io)
      will be sent from TPSP with ID 100 and IP with ID 105. The sendpost.io
      emails will be sent from IP with ID 101. The 'others' emails
      (t1@gmail.com, t2@gmail.com, t3@gmail.com, t4@yahoo.com) will be sent from
      IP with ID 102 and 103, and TPSP with ID 104.
  - name: Stats (A)
    description: >
      This API allows you to get your stats for a specific account. Across all
      the requests you need to pass X-Account-ApiKey header. You will be able to
      see email processed, delivered, opens, clicks, hardBounce, softBounce,
      unsubscribe and spam complaints for the specific account.
  - name: Sub-Account
    description: >
      This API allows you to manage your sub-accounts for a specific
      sub-account. Across all the requests you need to pass X-Account-ApiKey
      header.
  - name: Webhook
    description: >
      This API allows you to manage your webhooks for a specific account. Across
      all the requests you need to pass X-Account-ApiKey header.
  - name: Webhook Reference
    description: >
      Webhooks are an HTTP POST request made to your application endpoint when
      an interesting event happens at SendPost. This includes events such as
      email opens, clicks, hard bounce, spam, unsubscribe and more.


      You may want to consume webhook events if you want to replicate state of
      your email recipients to your internal system ( have they unsubscribed or
      has their email bounced ?) or you want to build custom analytics for
      internal product consumption.


      Other use cases where consuming webhook may be relevant is when you are
      building an application on top of SendPost such as an email marketing
      software and you want to show emails delivered, opened, clicked etc. to
      your customers.



      # Testing Webhooks


      Generally configuring a webhook is cumbersome process for developers.  At
      SendPost we have tried to make it a bit simpler:


      * **Webhook Single-Click Test**


      You can go to SendPost dashboard and click on button to test individual
      webhook. This will trigger a test Webhook API call of the specific event
      such as email open, click etc.


      * **Request Bin**


      [RequestBin](https://requestbin.com/) is a great service to inspect HTTP
      requests. You can create a temporary RequestBin URL and use the temporary
      URL as your webhook URL in SendPost.


      After that you can trigger webhook calls either using curl or through our
      Webhook Single-Click Test. RequestBin will then record the HTTP requests
      and allow you to inspect the HTTP requests to verify headers, JSON body,
      and other information about the webhook request.


      This will provide you with information about the HTTP requests used in the
      webhook if you don’t have a public URL set up yet and want to start
      developing right away.
  - name: Message
    description: >
      This API allows you to manage your messages for a specific account. Across
      all the requests you need to pass X-Account-ApiKey header.
paths: {}

````