Check a template's Liquid syntax, and optionally render it with sample data, without sending any email. Use this endpoint to test a template before it goes live, so mistakes are caught up front rather than surfacing in a real send.
Endpoint and headers
POST https://email.useinsider.com/mail/v2/validate
Header | Value | Purpose |
|---|---|---|
X-INS-AUTH-KEY | API token, format INS.{id}.{secret} | Authentication |
Content-Type | application/json | Request format |
Body parameters
Below are the parameters for this request.
Parameter | Description | Data type | Required |
|---|---|---|---|
subject | Subject template to validate. | String | No* |
content | Content blocks to validate (type, value). | Array | No* |
fields | Optional sample variables used to render valid templates. | Object | No |
* Provide at least one of subject or content.
Request example
Below is a sample body for this request.
{
"subject": "Hello {{ first_name }}",
"content": [
{
"type": "text/html",
"value": "<p>Hi {{ first_name }}</p>"
}
],
"fields": {
"first_name": "Alice"
}
}Sample responses
The endpoint always returns 200; the outcome is in the body. When the syntax is valid and sample fields are provided, the rendered output is returned.
{
"valid": true,
"rendered": [
{
"field": "subject",
"output": "Hello Alice"
},
{
"field": "content[0]",
"output": "<p>Hi Alice</p>"
}
]
}When the syntax is invalid, each problem is listed with the field it came from.
{
"valid": false,
"errors": [
{
"field": "content[0]",
"message": "unterminated \"for\" block"
}
]
}Keep in mind
Validation checks Liquid syntax. Fields appear in a stable order: subject first, then content[0], content[1].
Run validation as the last step before a template goes live. It is the intended way to confirm a template is well-formed without sending a real request.
For the full outcome shapes, refer to the Error Codes.