post

/sendEmail

This endpoint is solely responsible for sending emails over Pepipost’s v2 API.

This is the most recent version of our API. Pepipost do provide the advance examples on how to personalize your emails.

Pepipost provides libraries to help you quickly and easily integrate with v2 API in 7 different languages: C#, Java, Node JS, PHP, Python, and Ruby.

Using this API, you can pass the components of the messages such as To/Recipient, From, Subject, HTML/Content, attachments, etc. Pepipost will build a MIME representation of the message and send it.

In case you want to get an advanced control of MIME. Then it is suggested to use your own SMTP to generate the emails and submit to Pepipost’s SMTP to deliver. In case of SMTP, it’s you who is actually building the MIME.

While there is no limit on the number of personalization objects which you can add in a single API call, but still it is recommended to not include more than 5000 personalizations per API request. If you need to include more than 5000 personalizations, please divide these across multiple API requests.

Request Parameters

1 Header

Request Body

1 Example
Schema
object
attachments
array[object]
fileContent
string

Name of the file to be attached. e.g. abc.pdf or mydoc.xls

fileName
string

base64 encoded value of the attached file. e.g if you want to attach a xyz.pdf file, then first convert the file content in base64 and pass the same in this parameter.

content
string

The HTML content to be sent in your email. You can use attributes to display dynamic values such as name, account number, etc. for ex. [% NAME %] for NAME , [% AGE %] for AGE etc.

minLength: 1
from
object
required
fromEmail
string
1 validation + required
fromName
string

The name of the recipient to whom you are sending an email.

personalizations
array[object]

An array of recipients and their metadata. Each object within personalizations can be thought of as an envelope - it defines who should receive an individual message and how that message should be handled.

required
uniqueItems: true
maxItems: 5000
attributes
object

A collection of key/value pairs following the pattern “NAME”:“John”. All are assumed to be strings. These attributes will apply to the html content of the body of your email, sender name and subject parameters. The total collective size of your attributes may not exceed 10,000 bytes per personalization object.

Each attribute can be used in your HTML as [%NAME%] for NAME , [%AGE%] for AGE. Spaces are not allowed within the attribute name, but special character underscore can be used.

recipient
string

An array of recipients email address. Each object within this array must always contain the email address of a recipient.

1 validation + required
recipient_cc
array[string]

An array of recipients who will receive a copy of your email i.e. recipients who will be in CC of your emails. Each object within this array must always contain the email address of the recipient.

x-apiheader
string

Values that are specific to this personalization that will be carried along with the email and its activity data. It is recommended to pass Unique string in this parameter. Example: You can pass InvoiceID, TransactionID, MessageID in this parameter. These will get associated with their respective email messages and will be returned back to you in reports and over webhooks. Each of the X-APIHEADER value should not exceed 256 characters.

2 validations
x-apiheader_cc
string

Values that are specific to this personalization that will be carried along with the email and its activity data. This data is going to be mapped with their respective email address defined in the parameter recipient_cc. It is recommended to pass Unique string in this parameter. Example: You can pass InvoiceID, TransactionID, MessageID in this parameter. These will get associated with their respective email messages and will be returned back to you in reports and over webhooks. Each of the X-APIHEADER value should not exceed 256 characters.

2 validations
replyToId
string

Email address which need to be used as Reply-To

format: email
settings
object
bcc
string

You can set the email address on which a Bcc copy of the email will be sent.

1 validation
clicktrack
boolean

You can enable or disable click tracking for your emails.

footer
boolean

You can set common footer under your Pepipost account. And in case you want to use that footer than set this value to 1.

opentrack
boolean

You can enable or disable open tracking for your emails.

unsubscribe
boolean

You can enable or disable unsubscribe tracking for your emails.

subject
string

The subject line for your email. You can also use attributes in subject like [% NAME %], [% AGE %] and these will be replaced with the respective value for the recipient.

required
minLength: 1
maxLength: 998
tags
string

Tags can help organize your email analytics by enabling you to “tag” emails by type or broad topic. You can define your own custom tags like “OTP Emails”, “Order Confirmation emails” etc

templateId
integer

You can upload the HTML content in your Pepipost account and can just pass the TemplateID here. This will save the data transfer in API call in case you are going to repeatedly use same HTML template for all your emails.

Responses

1 Example
Schema
object
data
object
message
string

Send a Test Request

Send requests directly from the browser (CORS must be enabled)
$$.env
No $$.env variables are being used in this request.