Update a template

Updates an email template. Sends that reference the template pick up the new content immediately.

PATCH/v2/accounts/{accountId}/templates/{templateId}

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.

templateIdstringrequired

Request body

Request body for updating a template. Every field is optional - send only what changes. The optional fields also accept null, which clears the stored value. That is the only way to take a sender, a reply-to or a copy address back off a template: an omitted key means “leave this alone” and the empty string is rejected. The content fields are not nullable.

namestringoptional

Template name, shown on the dashboard.

slugstringoptional

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

subjectstringoptional

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

fromNamestringoptional

Sender display name. Null clears it, so the sending server’s defaultFromName is used instead.

fromEmailstring (email)optional

Sender address; should belong to a verified sending domain. Null clears it, so the sending server’s defaultFromEmail is used instead.

contentstringoptional

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

textContentstringoptional

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. Null clears it.

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. Null clears it.

rcptNamestringoptional

Optional recipient display name; supports variables. Null clears it.

preferredEmailServerstringoptional

Optional id of the email server to route this template’s sends through. Null clears the pin, so any of the account’s servers may carry the send.

replyTostringoptional

Optional Reply-To address for every send of this template. May carry template variables, rendered per send. Null clears it, so replies go to the sender address.

clickTrackingbooleanoptional

Whether links in mail from this template are rewritten for click tracking. Null clears the setting, so the template inherits the account default again - which is the only way to express ‘inherit’ once a value has been stored.

openTrackingbooleanoptional

Whether an open-tracking pixel is added to mail from this template. Null clears the setting, so the template inherits the account default again.

Response

The updated 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.

404

The requested resource does not exist.

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

curl --location --request PATCH 'https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/templates/YOUR_TEMPLATE_ID' \
--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
}