SendStreak logo
menu

Create a template

Creates an email template: subject, sender identity, and HTML plus plain-text content, addressed by a unique slug that the transactional send endpoint references.

Endpoint

POST https://api.sendstreak.com/v2/accounts/{accountId}/templates

All v2 endpoints require a bearer token - see Authentication.

Path parameters

Parameter Type Description
accountId string The account the request is scoped to.

Request body

Request body for creating a template. cc, bcc, contentType, rcptName and preferredEmailServer are optional; every other listed field is required.

Field Type Required Description
name string yes Template name, shown on the dashboard.
slug string yes Unique short identifier; the transactional send endpoint references templates by slug.
subject string yes Email subject line; supports the same variables as the content.
fromName string yes Sender display name.
fromEmail string (email) yes Sender address; should belong to a verified sending domain.
content string yes HTML body of the email, with support for template variables.
textContent string yes Plain-text alternative body, used by text-only email clients.
contentType one of: html, wysiwyg no How the dashboard editor treats the content: raw HTML or the visual editor.
cc string (email) no Optional CC address added to every send of this template.
bcc string (email) no Optional BCC address added to every send of this template.
rcptName string no Optional recipient display name; supports variables.
preferredEmailServer string no Optional id of the email server to route this template’s sends through.

Response

The created template.

{
  "_id": "665f0a2b1c9d440012ab34cd",
  "name": "Example name",
  "slug": "signup",
  "subject": "Welcome to Acme!",
  "fromName": "Acme Team",
  "fromEmail": "[email protected]",
  "content": "SGVsbG8gV29ybGQhCgo=",
  "textContent": "Welcome aboard, John!"
}

Errors

Status Description
400 The request body or parameters failed validation.
401 Missing or invalid token, or the token is not authorized for this account/user.

See Errors and rate limits for what error responses look like.

Curl example

curl --location --request POST 'https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/templates' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "Example name",
  "slug": "signup",
  "subject": "Welcome to Acme!",
  "fromName": "Acme Team",
  "fromEmail": "[email protected]",
  "content": "SGVsbG8gV29ybGQhCgo=",
  "textContent": "Welcome aboard, John!",
  "contentType": "html",
  "cc": "[email protected]",
  "bcc": "[email protected]",
  "rcptName": "John Doe",
  "preferredEmailServer": "primary-ses"
}'
Try SendStreak for Free now!