Skip to Content

Create template

POST
/templates

Create a new email template.

from is required and its domain must already be verified for this project, otherwise the request is rejected.

Authorization

ApiKeyAuth
headerAuthorizationBearer <API Key>

API Key authentication. The project is automatically derived from the key.

/v1/track requires a public key (pk_*) — it is the one endpoint intended for client-side use, and a secret key is rejected there with 401.

Every other endpoint requires a secret key (sk_*) and rejects public keys with 401.

So the two key types are not interchangeable in either direction: pick the key that matches the endpoint you are calling.

Request body

application/json
  1. body
name*string

Internal name for the template.

description?string

Optional internal note. Not sent to recipients.

subject*string
body*string

HTML body. Use {{variable}} placeholders to interpolate contact data at send time.

from*string

Sender address. Must belong to a domain verified for this project.

Formatemail
fromName?string

Sender display name.

replyTo?string
Formatemail
type?string

Optional. Defaults to MARKETING when omitted.

Default"MARKETING"
Value in"TRANSACTIONAL""MARKETING""HEADLESS"

Response body

Template created

application/json
  1. response
id?string
name?string
description?string
subject?string
body?string

HTML content with {{variable}} placeholders.

from?string

Sender address. Must belong to a verified domain.

Formatemail
fromName?string
replyTo?string
Formatemail
type?string
Value in"TRANSACTIONAL""MARKETING""HEADLESS"
projectId?string
createdAt?string
Formatdate-time
updatedAt?string
Formatdate-time
Example request
curl -X POST 'https://api.send.47signals.com/templates' \  -H 'Content-Type: application/json' \  -d '{  "name": "Password reset",  "subject": "Reset your password",  "body": "<h1>Hi {{firstName}}</h1><p>Use this code: {{resetCode}}</p>",  "from": "hello@example.com",  "fromName": "My App",  "type": "TRANSACTIONAL"}'
Example response
{  "id": "string",  "name": "string",  "description": "string",  "subject": "string",  "body": "string",  "from": "user@example.com",  "fromName": "string",  "replyTo": "user@example.com",  "type": "TRANSACTIONAL",  "projectId": "string",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}