Templates API
Templates let you define reusable email content that can be applied to broadcasts, sequences, and transactional emails. Use the Templates API to manage your template library programmatically.
Base URL
https://app.sendbroadcast.com/api/v1
Authentication
All requests require a Bearer token with the appropriate template permissions. See Authentication for details.
The Template Object
| Field | Type | Description |
|---|---|---|
id |
integer | Unique identifier for the template |
label |
string | Display name of the template |
subject |
string | Default email subject line |
preheader |
string | Preview text shown in email clients |
body |
text | Plain text or Markdown email body |
html_body |
text | HTML email body |
created_at |
datetime | When the template was created (ISO 8601) |
updated_at |
datetime | When the template was last modified (ISO 8601) |
Example Template Object
{
"id": 42,
"label": "Monthly Newsletter",
"subject": "Your {{ month }} Update",
"preheader": "See what's new this month",
"body": "Hi {{ subscriber.first_name }},\n\nHere's your monthly update...",
"html_body": "<h1>Hi {{ subscriber.first_name }}</h1><p>Here's your monthly update...</p>",
"created_at": "2025-09-15T10:30:00Z",
"updated_at": "2025-10-01T14:22:00Z"
}
List Templates
Retrieve all templates for the current broadcast channel, ordered alphabetically by label.
GET /api/v1/templates
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
integer | No | Maximum number of templates to return |
offset |
integer | No | Number of templates to skip (for pagination) |
Request
curl -X GET "https://app.sendbroadcast.com/api/v1/templates" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Response
{
"data": [
{
"id": 42,
"label": "Monthly Newsletter",
"subject": "Your {{ month }} Update",
"preheader": "See what's new this month",
"body": "Hi {{ subscriber.first_name }},\n\nHere's your monthly update...",
"html_body": "<h1>Hi {{ subscriber.first_name }}</h1><p>Here's your monthly update...</p>",
"created_at": "2025-09-15T10:30:00Z",
"updated_at": "2025-10-01T14:22:00Z"
},
{
"id": 43,
"label": "Welcome Email",
"subject": "Welcome to {{ channel_name }}!",
"preheader": "Thanks for subscribing",
"body": "Welcome aboard!",
"html_body": "<h1>Welcome aboard!</h1>",
"created_at": "2025-08-20T09:00:00Z",
"updated_at": "2025-08-20T09:00:00Z"
}
],
"total": 2
}
Pagination
Use limit and offset to paginate through results:
curl -X GET "https://app.sendbroadcast.com/api/v1/templates?limit=10&offset=20" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Get a Template
Retrieve a single template by its ID.
GET /api/v1/templates/:id
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Yes | The template ID |
Request
curl -X GET "https://app.sendbroadcast.com/api/v1/templates/42" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Response
{
"id": 42,
"label": "Monthly Newsletter",
"subject": "Your {{ month }} Update",
"preheader": "See what's new this month",
"body": "Hi {{ subscriber.first_name }},\n\nHere's your monthly update...",
"html_body": "<h1>Hi {{ subscriber.first_name }}</h1><p>Here's your monthly update...</p>",
"created_at": "2025-09-15T10:30:00Z",
"updated_at": "2025-10-01T14:22:00Z"
}
Create a Template
Create a new template in the current broadcast channel.
POST /api/v1/templates
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
template[label] |
string | Yes | Display name for the template |
template[subject] |
string | No | Default subject line |
template[preheader] |
string | No | Email preview text |
template[body] |
text | No | Plain text or Markdown body |
template[html_body] |
text | No | HTML body content |
Request
curl -X POST "https://app.sendbroadcast.com/api/v1/templates" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"template": {
"label": "Product Launch",
"subject": "Introducing {{ product_name }}",
"preheader": "Something new just dropped",
"body": "We are excited to announce...",
"html_body": "<h1>Introducing {{ product_name }}</h1><p>We are excited to announce...</p>"
}
}'
Response 201 Created
{
"id": 44
}
Update a Template
Update an existing template.
PATCH /api/v1/templates/:id
Request
curl -X PATCH "https://app.sendbroadcast.com/api/v1/templates/44" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"template": {
"subject": "Introducing {{ product_name }} - Now Available",
"preheader": "Get early access today"
}
}'
Response
{
"id": 44,
"label": "Product Launch",
"subject": "Introducing {{ product_name }} - Now Available",
"preheader": "Get early access today",
"body": "We are excited to announce...",
"html_body": "<h1>Introducing {{ product_name }}</h1><p>We are excited to announce...</p>",
"created_at": "2025-10-05T11:00:00Z",
"updated_at": "2025-10-05T12:15:00Z"
}
Delete a Template
Permanently delete a template.
DELETE /api/v1/templates/:id
Request
curl -X DELETE "https://app.sendbroadcast.com/api/v1/templates/44" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Response
{
"message": "Template deleted successfully"
}
Error Responses
404 Not Found
The requested template does not exist or belongs to a different broadcast channel.
{
"error": "Template not found"
}
422 Unprocessable Content
The request body contains invalid data.
{
"error": "Label can't be blank"
}
Required Permissions
| Action | Permission |
|---|---|
| List / Get | templates_read |
| Create / Update / Delete | templates_write |
Next: Email Servers API – Manage email server configurations via API.