menu
Update a template
Updates an email template. Sends that reference the template pick up the new content immediately.
Endpoint
PATCH https://api.sendstreak.com/v2/accounts/{accountId}/templates/{templateId}
All v2 endpoints require a bearer token - see Authentication.
Path parameters
| Parameter | Type | Description |
|---|---|---|
accountId | string | The account the request is scoped to. |
templateId | string |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
_id | string | no | |
name | string | yes | Template name, shown on the dashboard. |
slug | string | no | 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 | no | Sender display name. |
fromEmail | string (email) | no | Sender address; should belong to a verified sending domain. |
content | string | no | HTML body of the email, with support for template variables. |
textContent | string | no | Plain-text alternative body, used by text-only email clients. |
Response
The updated 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. |
404 | The requested resource does not exist. |
See Errors and rate limits for what error responses look like.
Curl example
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 '{
"_id": "665f0a2b1c9d440012ab34cd",
"name": "Example name",
"slug": "signup",
"subject": "Welcome to Acme!",
"fromName": "Acme Team",
"fromEmail": "[email protected]",
"content": "SGVsbG8gV29ybGQhCgo=",
"textContent": "Welcome aboard, John!"
}'