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.

POST/v2/accounts/{accountId}/templates

Base URL https://api.sendstreak.com. All v2 endpoints require a bearer token - see Authentication.

Path parameters

accountIdstringrequired

The account the request is scoped to.

Request body

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

namestringrequired

Template name, shown on the dashboard.

slugstringrequired

Unique short identifier; the transactional send endpoint references templates by slug.

subjectstringrequired

Email subject line; supports the same variables as the content.

fromNamestringoptional

Sender display name. Omit to inherit the sending server’s defaultFromName.

fromEmailstring (email)optional

Sender address; should belong to a verified sending domain. Omit to inherit the sending server’s defaultFromEmail, resolved when the message is sent. Omitting it while no reachable server has a default means the message cannot be delivered.

contentstringrequired

HTML body of the email, with support for template variables. Sent as-is - it is not base64-encoded.

textContentstringrequired

Plain-text alternative body, used by text-only email clients.

contentTypeone of: html, wysiwygoptional

How the dashboard editor treats the content: raw HTML or the visual editor.

ccstringoptional

Optional address copied on every send from this template. May carry template variables, so it is not validated as an email when one is present.

bccstringoptional

Optional address blind-copied on every send from this template. May carry template variables, so it is not validated as an email when one is present.

rcptNamestringoptional

Optional recipient display name; supports variables.

preferredEmailServerstringoptional

Optional id of the email server to route this template’s sends through.

replyTostringoptional

Optional Reply-To address for every send of this template. May carry template variables, rendered per send. Omit to have replies go to the sender address.

clickTrackingbooleanoptional

Set true to rewrite links in mail from this template for click tracking. Omit to inherit the account default, which is itself off - tracking is opt-in at both levels.

openTrackingbooleanoptional

Set true to add an open-tracking pixel to mail from this template. Omit to inherit the account default, which is itself off.

Response

The created template.

Errors

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 --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": "sign-up-thank-you",
  "subject": "Welcome to Acme!",
  "fromName": "Acme Team",
  "fromEmail": "[email protected]",
  "content": "<h1>Welcome to Acme!</h1><p>Your account is ready - happy sending.</p>",
  "textContent": "Welcome aboard, John!",
  "contentType": "html",
  "cc": "[email protected]",
  "bcc": "[email protected]",
  "rcptName": "John Doe",
  "preferredEmailServer": "6652ee3f5a0c220015bc34de",
  "replyTo": "[email protected]",
  "clickTracking": false,
  "openTracking": false
}'
response200application/json
{
  "_id": "665f0a2b1c9d440012ab34cd",
  "name": "Example name",
  "slug": "sign-up-thank-you",
  "subject": "Welcome to Acme!",
  "fromName": "Acme Team",
  "fromEmail": "[email protected]",
  "content": "<h1>Welcome to Acme!</h1><p>Your account is ready - happy sending.</p>",
  "textContent": "Welcome aboard, John!",
  "contentType": "html",
  "cc": "[email protected]",
  "bcc": "[email protected]",
  "rcptName": "John Doe",
  "preferredEmailServer": "6652ee3f5a0c220015bc34de",
  "replyTo": "[email protected]",
  "clickTracking": false,
  "openTracking": false
}