Save an email template
Overview
Save your custom version of an email type.
Use this after editing.
You'll need the type and the content.
The override is saved and used from now on.
Prerequisites
- A bearer token. See Authentication.
- The account's id (
company_id), with the email templates section turned on. - The email
type, from List email types.
Base URL
| Environment | URL |
|---|---|
| Production | https://production-api.shoutaboutus.com |
| Development | https://development-api.shoutaboutus.com |
Endpoint
POST /api/v1/account/white-label/email-templates/save
Authentication
Partner or Account token
company_idmust be inside your own account tree. A Partner token can use any account under the partner; an Account token only its own account.- An account outside your tree, or one that doesn't exist, is rejected with
422. - The email templates section must be turned on for the account's partner (
email_templates_enabledin Get branding). When it's off, every email template call for that account returns403withThe email template section is disabled for this account. - Types managed centrally by the platform return
403(This template is managed centrally and cannot be edited here.).
Rate limit
This endpoint has no rate limit.
Request parameters
None.
Request body
A save replaces all four regions: any of header, body, footer or signature you leave out is reset to the default, so send every region you want to keep. subject_override left out is cleared too. template_mode and custom_html are kept when you leave them out.
Region fields are base64-encoded HTML.
Only the merge fields returned by List an email's merge fields for that type are accepted (the example decodes to <p>Hello [customerName]</p>, valid for user_welcome); any other token returns 422 Unknown variables for this template: [token].
| Field | Type | Required | Description |
|---|---|---|---|
company_id | integer | Yes | The account. Must exist and be inside your account tree. |
type | string | Yes | The email type, from List email types. |
header | string | No | The header region. Base64-encoded HTML, up to 80,000 characters. Only merge fields from List an email's merge fields for this type are allowed. Left out or empty: the default is used. |
body | string | No | The body region. Base64-encoded HTML, up to 80,000 characters. Only merge fields from List an email's merge fields for this type are allowed. Left out or empty: the default is used. |
footer | string | No | The footer region. Base64-encoded HTML, up to 80,000 characters. Only merge fields from List an email's merge fields for this type are allowed. Left out or empty: the default is used. |
signature | string | No | The signature region. Base64-encoded HTML, up to 80,000 characters. Only merge fields from List an email's merge fields for this type are allowed. Left out or empty: the default is used. |
subject_override | string | No | The subject, as plain text (not base64), up to 255 characters. Merge fields allowed. Left out: cleared, so the default subject is used. |
template_mode | string | No | regions (header, body, footer and signature) or html (one full-HTML body in custom_html). Left out: unchanged. |
custom_html | string | No | The full-HTML body for html mode, base64-encoded, up to 400,000 characters. Left out: the saved full-HTML version is kept. |
Request payload
{
"company_id": 5994,
"type": "user_welcome",
"body": "PHA+SGVsbG8gW2N1c3RvbWVyTmFtZV08L3A+",
"subject_override": "Welcome to [partnerTitle]!",
"template_mode": "regions"
}Response body
The payload is inside data.
| Field | Type | Description |
|---|---|---|
status | string | success. |
message | string | Email template saved successfully. |
Response payload
{
"data": {
"status": "success",
"message": "Email template saved successfully."
}
}Examples
Success payload
See Response payload.
Error payload
403 Email templates section is off
{
"message": "The email template section is disabled for this account.",
"status": "error",
"errors": []
}403 Type managed centrally
{
"message": "This template is managed centrally and cannot be edited here.",
"status": "error",
"errors": []
}422 Unknown merge field
{
"message": "Unknown variables for this template: [recipientName]",
"errors": {
"body": [
"Unknown variables for this template: [recipientName]"
]
}
}422 template_mode isn't allowed
{
"message": "The selected template mode is invalid.",
"errors": {
"template_mode": [
"The selected template mode is invalid."
]
}
}422 Account outside your tree
{
"message": "The selected company id does not belong to your company hierarchy.",
"errors": {
"company_id": [
"The selected company id does not belong to your company hierarchy."
]
}
}| Status | Meaning |
|---|---|
200 | The template was saved. |
401 | The token is missing, expired or invalid. |
403 | The email templates section is off for this account, or the type is managed centrally. |
422 | A field is invalid, a region uses a merge field that isn't valid for this type, or the account is outside your tree. |
500 | Unexpected server error. |
Example request
curl --request POST \
--url "https://production-api.shoutaboutus.com/api/v1/account/white-label/email-templates/save" \
--header 'Authorization: Bearer <bearer-token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"company_id": 5994, "type": "user_welcome", "body": "PHA+SGVsbG8gW2N1c3RvbWVyTmFtZV08L3A+", "subject_override": "Welcome to [partnerTitle]!", "template_mode": "regions"}'Updated 17 days ago
