Preview a layout
const url = 'https://api.velumrelay.email/v1/layouts/example/preview';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"template":"welcome","data":{"name":"Ada","company":"Acme"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.velumrelay.email/v1/layouts/example/preview \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "template": "welcome", "data": { "name": "Ada", "company": "Acme" } }'Renders the saved layout around one of your templates (template), or around placeholder content. Nothing is sent or stored.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Use a lowercase letter first, then a-z, 0-9 and _ (up to 48 characters)
Request Body
Section titled “Request Body”object
Template variables to render with.
object
Layouts only: one of your templates to render inside the layout. Leave out for placeholder content.
Example
{ "template": "welcome", "data": { "name": "Ada", "company": "Acme" }}Responses
Section titled “Responses”The rendered email.
object
Example generated
{ "subject": "example", "html": "example", "text": "example"}Headers
Section titled “Headers”Example
req_3kTMd9vXq2LwB8nYpR4sZaUnique ID of this request (req_ + 22 characters). Include it when you contact support.
Missing or invalid management key.
object
What went wrong, in plain words.
Example
{ "error": "invalid or missing management key"}No layout with that ID in your account.
object
What went wrong, in plain words.
Example
{ "error": "layout not found"}The template couldn’t be rendered with this data.
object
What went wrong, in plain words.
Example
{ "error": "render failed: …"}Rate limit exceeded (20 requests per second, bursts up to 40, per key). Wait for Retry-After seconds, then retry.
object
What went wrong, in plain words.
Example
{ "error": "rate limit exceeded"}Headers
Section titled “Headers”Example
1Example
req_3kTMd9vXq2LwB8nYpR4sZaUnique ID of this request (req_ + 22 characters). Include it when you contact support.