---
title: "Test Template Content"
method: POST
path: "/templates/validate"
tags: ["Templates API"]
---

# Test Template Content

`POST /templates/validate`

## Headers

- `X-Postmark-Server-Token` string, required

## Request body

- TemplateValidationRequest
  - `Subject` string — The subject content to validate. Must be specified if HtmlBody or TextBody are not. See our template language documentation for more information on the syntax for this field.
  - `HtmlBody` string — The html body content to validate. Must be specified if Subject or TextBody are not. See our template language documentation for more information on the syntax for this field.
  - `TextBody` string — The text body content to validate. Must be specified if HtmlBody or Subject are not. See our template language documentation for more information on the syntax for this field.
  - `TestRenderModel` object — The model to be used when rendering test content.
  - `InlineCssForHtmlTestRender` boolean — When HtmlBody is specified, the test render will have style blocks inlined as style attributes on matching html elements. You may disable the css inlining behavior by passing false for this parameter.

## Response `200`

OK

- TemplateValidationResponse
  - `AllContentIsValid` boolean
  - `TextBody` TemplateValidationResult
    - `ContentIsValid` boolean
    - `ValidationErrors` TemplateValidationError[]
      - `Message` string
      - `Line` integer
      - `CharacterPosition` integer
    - `RenderedContent` string
  - `HtmlBody` TemplateValidationResult
    - `ContentIsValid` boolean
    - `ValidationErrors` TemplateValidationError[]
      - `Message` string
      - `Line` integer
      - `CharacterPosition` integer
    - `RenderedContent` string
  - `Subject` TemplateValidationResult
    - `ContentIsValid` boolean
    - `ValidationErrors` TemplateValidationError[]
      - `Message` string
      - `Line` integer
      - `CharacterPosition` integer
    - `RenderedContent` string
  - `SuggestedTemplateModel` object

## Other responses

- `422` — An error was generated due to incorrect use of the API. See the Message associated with this response for more information.
- `500` — Indicates an internal server error occurred.

---

[API](https://skmtc.dev/postmarkapp/apis/postmark-api.md) · [All operations](https://skmtc.dev/postmarkapp/apis/postmark-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/postmarkapp/postmark-api/revisions/fdae25f55e2e/schema)
