Skip to content

Preview an unsaved template

POST
/v1/preview
curl --request POST \
--url https://api.velumrelay.email/v1/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "subject": "Hi {{name}}", "html": "<p>Hello {{name}}</p>", "layout": "default", "data": { "name": "Ada", "company": "Acme" } }'

Renders a template draft, optionally inside one of your layouts, without saving it. Nothing is sent or stored.

Media typeapplication/json
object
subject
required
string
>= 1 characters <= 1024 characters
html
required
string
>= 1 characters <= 524288 characters
text
string
<= 262144 characters
layout

ID of one of your layouts to render the draft inside.

string
/^[a-z][a-z0-9_]{0,47}$/
data

Template variables to render with.

object
key
additional properties

Example

{
"subject": "Hi {{name}}",
"html": "<p>Hello {{name}}</p>",
"layout": "default",
"data": {
"name": "Ada",
"company": "Acme"
}
}

The rendered email.

Media typeapplication/json
object
subject
required
string
html
required
string
text
required
string

Example generated

{
"subject": "example",
"html": "example",
"text": "example"
}
X-Request-Id
string
Example
req_3kTMd9vXq2LwB8nYpR4sZa

Unique ID of this request (req_ + 22 characters). Include it when you contact support.

Invalid request.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "invalid request: subject: Enter a subject"
}

Missing or invalid management key.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "invalid or missing management key"
}

No layout with that ID in your account.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "layout \"default\" not found"
}

The draft isn’t valid or couldn’t be rendered.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "render failed: …"
}

Rate limit exceeded (20 requests per second, bursts up to 40, per key). Wait for Retry-After seconds, then retry.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "rate limit exceeded"
}
Retry-After
integer
Example
1
X-Request-Id
string
Example
req_3kTMd9vXq2LwB8nYpR4sZa

Unique ID of this request (req_ + 22 characters). Include it when you contact support.