Design Studio emails

Preview an email

Returns an email with liquid fully evaluated against data you provide. The response includes the final HTML as a recipient would see it, along with liquid errors.

Omit the body or send {} to render your fallback values: a variable with a default filter renders its fallback, and each variable without one reports an error in the response's errors object.

The render, preview, review, link, and publish endpoints share a rate limit of 5 requests per second per workspace.

post/v1/design_studio/emails/{id}/preview

Path parameters

idstring uuid required

The UUID of the email. If your email has translations, this is the ID of a specific language variant.

Request body

customerobject

Customer profile attributes for {{customer.*}} variables.

eventobject

Event attributes for {{event.*}}.

triggerobject

Trigger data for {{trigger.*}}.

campaignobject

Campaign metadata for {{campaign.*}}.

messageobject

Message metadata for {{message.*}}.

journeyobject

Journey metadata for {{journey.*}}.

objectsobject

Related objects for {{objects.*}}.

laxboolean

Set to true if you want undefined variables to resolve to an empty string instead of reporting an error; this can help you focus on more important errors when you don't provide sample data or fallback values. Liquid syntax errors (like broken tags and invalid filters) are always reported as errors.

Example request

{
  "customer": {
    "first_name": "Jane",
    "email": "jane@example.com",
    "plan": "enterprise"
  },
  "event": {
    "name": "order_completed",
    "total": 149.99
  }
}

Response

Successful response

node_idstring uuid

The UUID of the previewed email node.

node_type'EMAIL'

Always "EMAIL".

languagestring

Language code if the node is a translation. Omitted for default-language nodes.

subjectstring

Evaluated subject line.

htmlstring

Final HTML with Liquid evaluated, the preheader injected, and dangerous tags removed.

ampstring

AMP HTML variant with liquid evaluated. Omitted if the email doesn't have an AMP version.

textstring

Plain-text body with liquid evaluated. Omitted if the email doesn't have a plain text version.

plaintext_bodystring

The plain-text part a recipient would get—your plain text version with HTML tags stripped, or text generated from the final HTML if the email doesn't have one. Omitted when empty.

fromstring

Resolved from address, for example "Name <email>". Omitted when the email doesn't include a from address.

preheader_textstring

Evaluated preheader text. Omitted when the email doesn't include preheaders.

Example response

{
  "node_id": "1a0cbb4e-09d3-402e-949e-f6732f021650",
  "node_type": "EMAIL",
  "subject": "Order Confirmation",
  "html": "<!DOCTYPE html>...<p>Purchase info</p>...",
  "text": "<html><head></head><body style=\"margin:0\"><div style=\"font-size:16px;line-height:1.5;font-family:Arial,Helvetica,sans-serif;white-space:pre-wrap;padding:10px;\">Thanks for your recent purchase!</div></body></html>",
  "plaintext_body": "Thanks for your recent purchase!",
  "from": "\"No reply\" <noreply@example.com>",
  "errors": {
    "subject": [],
    "body": [],
    "body_amp": [],
    "body_plain": [],
    "from": [],
    "reply_to": [],
    "bcc": [],
    "cc": [],
    "to": [],
    "preheader_text": [],
    "layout": [],
    "message": [],
    "snippets": [],
    "event": [],
    "trigger": []
  },
  "links": [
    {
      "url": "https://example.com/orders",
      "text": "View your order",
      "tracked": true,
      "errors": []
    }
  ]
}

Changes

Changed in 1 of the 13 revisions of this API.1