Preview an unsaved template
const url = 'https://api.velumrelay.email/v1/preview';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"subject":"Hi {{name}}","html":"<p>Hello {{name}}</p>","layout":"default","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/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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
ID of one of your layouts to render the draft inside.
Template variables to render with.
object
Example
{ "subject": "Hi {{name}}", "html": "<p>Hello {{name}}</p>", "layout": "default", "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.
Invalid request.
object
What went wrong, in plain words.
Example
{ "error": "invalid request: subject: Enter a subject"}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 \"default\" not found"}The draft isn’t valid or couldn’t be rendered.
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.