Skip to content

Preview a template

POST
/v1/templates/{id}/preview
curl --request POST \
--url https://api.velumrelay.email/v1/templates/example/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "data": { "name": "Ada" } }'

Renders the saved template (inside its layout, if it has one) with data. Nothing is sent or stored.

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

Use a lowercase letter first, then a-z, 0-9 and _ (up to 48 characters)

Media typeapplication/json
object
data

Template variables to render with.

object
key
additional properties
template

Layouts only: one of your templates to render inside the layout. Leave out for placeholder content.

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

Example

{
"data": {
"name": "Ada"
}
}

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.

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 template with that ID in your account.

Media typeapplication/json
object
error
required

What went wrong, in plain words.

string

Example

{
"error": "template not found"
}

The template couldn’t be rendered with this data.

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.