POST emails/preview


POST /v2/emails/preview retrieves a fully rendered version of an email message based on a subscribers profile. This capability is useful for designing applications that deliver emails outside of the Yesmail Marketing Platform. 

Resource URI

Call Description

This call returns different results based on the Accept header value made with the request. Content-Type: application/json must always be included.

Accept: application/json - Returns a JSON encoded response with envelope properties, text content and HTML content.

Accept: text/html- Returns just the HTML content.

Accept: text/plain - Returns just the text content

HTTP Return Codes



200 OK

The request has been processed.

400 Bad Request

The request could not be understood by the server due to malformed syntax.

401 Unauthorized

The request requires user authentication.  Invalid Api-User and/or Api-Key header value.

404 Not Found

If the specific templateId or renderSubscriber Id is not found.
Request Payload: 
    "content": {
        "templateId": "1456917"
    "renderSubscriber": {
        "id": ""    ;client defined id
Response Payload: 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    <meta content="en-us" http-equiv="content-language">
    <h1>Sample Email</h1>
    <p>This is an example HTML payload</p>
    <p>Yesmail's <a href=
    <p>-The Yesmail Team</p><br>
    <p>If you no longer wish to receive these emails, use this link to <a href=
  "headers": {
    "campaign": "Sample Campaign",
    "from": "",
    "from-friendly": "Yesmail Team",
    "keywords": "Sample|Test",
    "name": "Sample Email",
    "reply-to": "",
    "reply-to-friendly": "Yesmail Team",
    "sender": "",
    "sender-friendly": "Yesmail Team",
    "subject": "Sample Email"
  "text": {
    "content": "[Sample Email]\r\n\r\nThis is an example text payload.\r\n\r\nYesmail's API Guide <https:\/\/>\r\n\r\n-The Yesmail Team\r\n\r\nIf you no longer wish to receive these emails, go to the following link to =\r\nunsubscribe: https:\/\/\/v2\/subscribers\/unsubscribe?s=ZXVI&i=12=\r\n345678"
  "html": {
    "content": "<!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\" \"http:\/\/\/TR\/html4\/loose.dtd\"><html><head>\r\n<meta http-equiv=\"content-language\" content=\"en-us\">\r\n<title><\/title>\r\n<\/head>\r\n<body>\r\n<h1>Sample Email<\/h1>\r\n<p>This is an exmaple HTML payload<\/p>\r\n<p>Yesmail's <a href=\"https:\/\/\">API Guide<\/a><\/p>\r\n<br\/>\r\n<p>-The Yesmail Team<\/p>\r\n<br\/>\r\n<p>If you no longer wish to receive these emails, use this link to \r\n<a href=\"https:\/\/\/v2\/subscribers\/unsubscribe?s=ZXVI&i=12345678\">unsubscribe<\/a><\/p>\r\n<\/body>\r\n<\/html>\r\n"