sendsend.email

Preview a template

POST/v1/templates/{id}/preview

Renders a template version with sample variables and sends nothing. It renders whatever it can and lists problems (missing or mistyped variables, or a mistake in the template), so a preview never fails just because a sample value is not filled in yet. Omit version for the latest, and pass language to preview a translation.

Required scope: templates:manage

Parameters

NameInDescription
idrequiredpathThe template id.

Example

curl -X POST 'https://api.sendsend.email/v1/templates/ID/preview' \
  -H "Authorization: Bearer $SENDSEND_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "variables": {
    "first_name": "Maria"
  }
}'

Response 200

{
  "version": 1,
  "subject": "Welcome, Maria",
  "html": "<p>Hi Maria!</p>",
  "text": null,
  "variables": {
    "first_name": {
      "type": "string",
      "required": true
    }
  },
  "problems": []
}

Errors

StatusCodeWhen
404not_foundNo such resource in this project.
400validation_errorThe request body or parameters are invalid. The message says which field.
401unauthorizedThe API key is missing, invalid or revoked.
403forbiddenThe key does not have the scope this endpoint needs.

Every error has the same shape. See Errors.