Skip to main content
POST
/
v1
/
templates
Create Template
curl --request POST \
  --url https://api.example.com/v1/templates \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "subject": "<string>",
  "html": "<string>",
  "text": "<string>"
}
'
name
string
required
A friendly name for the template.
subject
string
required
The email subject line. Supports variables like {{variable}}.
html
string
The HTML body of the email. Supports variables.
text
string
The plain text body of the email. Supports variables.

Request

cURL
curl -X POST https://www.unosend.co/api/v1/templates \
  -H "Authorization: Bearer un_xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome Email",
    "subject": "Welcome to {{company_name}}, {{first_name}}!",
    "html": "<h1>Welcome, {{first_name}}!</h1><p>Thanks for joining {{company_name}}.</p>"
  }'

Response

200
{
  "id": "tpl_abc123",
  "name": "Welcome Email",
  "subject": "Welcome to {{company_name}}, {{first_name}}!",
  "html": "<h1>Welcome, {{first_name}}!</h1><p>Thanks for joining {{company_name}}.</p>",
  "created_at": "2024-01-15T10:30:00.000Z"
}