Mail API reference

Mail API · Templates

post/v1/workspaces/{workspace_id}/templates/{name}/renderAuth

Render a saved template against a data payload. Returns subject + html + text without sending.

Path parameters

workspace_id*string · uuid

Id of the workspace.

name*string

Name of the template.

Request body

data*object

Data to render into the template. Keys are your variable names and are kept exactly as sent.

Example: {"name":"Alice","order_id":"ord_123"}

Response · 200

subject*string

The rendered subject line.

html*string

Fully-rendered HTML body.

text*string

Plain-text body (derived if not authored).

Example

Request

POST https://api.mail.productcraft.co/v1/workspaces/{workspace_id}/templates/{name}/render
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "data": {
    "name": "Alice",
    "order_id": "ord_123"
  }
}

Response

{
  "subject": "string",
  "html": "string",
  "text": "string"
}