curl --request POST \
--url https://apix.spotzee.com/api/client/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "email",
"campaign_id": 123,
"locale": "en-AU",
"data": {
"customHeaders": [
{
"name": "<string>",
"value": "<string>"
}
],
"from": {
"name": "<string>",
"address": "<string>"
},
"cc": "<string>",
"bcc": "<string>",
"reply_to": "<string>",
"subject": "<string>",
"emailEditorJson": {},
"emailDesign": {},
"text": "<string>",
"html": "<string>",
"mjml": "<string>"
},
"name": "<string>"
}
'import requests
url = "https://apix.spotzee.com/api/client/templates"
payload = {
"type": "email",
"campaign_id": 123,
"locale": "en-AU",
"data": {
"customHeaders": [
{
"name": "<string>",
"value": "<string>"
}
],
"from": {
"name": "<string>",
"address": "<string>"
},
"cc": "<string>",
"bcc": "<string>",
"reply_to": "<string>",
"subject": "<string>",
"emailEditorJson": {},
"emailDesign": {},
"text": "<string>",
"html": "<string>",
"mjml": "<string>"
},
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'email',
campaign_id: 123,
locale: 'en-AU',
data: {
customHeaders: [{name: '<string>', value: '<string>'}],
from: {name: '<string>', address: '<string>'},
cc: '<string>',
bcc: '<string>',
reply_to: '<string>',
subject: '<string>',
emailEditorJson: {},
emailDesign: {},
text: '<string>',
html: '<string>',
mjml: '<string>'
},
name: '<string>'
})
};
fetch('https://apix.spotzee.com/api/client/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apix.spotzee.com/api/client/templates"
payload := strings.NewReader("{\n \"type\": \"email\",\n \"campaign_id\": 123,\n \"locale\": \"en-AU\",\n \"data\": {\n \"customHeaders\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"from\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"reply_to\": \"<string>\",\n \"subject\": \"<string>\",\n \"emailEditorJson\": {},\n \"emailDesign\": {},\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"mjml\": \"<string>\"\n },\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": 158,
"project_id": 123,
"campaign_id": 24,
"type": "email",
"locale": "en-AU",
"data": {},
"created_at": "<string>",
"updated_at": "<string>",
"name": "<string>"
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}Create a template
Creates a new template for a campaign. The type discriminator chooses the channel-specific data shape (email, text, push, webhook, in_app).
Idempotent — pass an Idempotency-Key header to make safely retryable. On a replay the original response is returned with Idempotent-Replayed: true. See the API conventions guide for the full state machine, TTL, and mismatch behaviour.
curl --request POST \
--url https://apix.spotzee.com/api/client/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "email",
"campaign_id": 123,
"locale": "en-AU",
"data": {
"customHeaders": [
{
"name": "<string>",
"value": "<string>"
}
],
"from": {
"name": "<string>",
"address": "<string>"
},
"cc": "<string>",
"bcc": "<string>",
"reply_to": "<string>",
"subject": "<string>",
"emailEditorJson": {},
"emailDesign": {},
"text": "<string>",
"html": "<string>",
"mjml": "<string>"
},
"name": "<string>"
}
'import requests
url = "https://apix.spotzee.com/api/client/templates"
payload = {
"type": "email",
"campaign_id": 123,
"locale": "en-AU",
"data": {
"customHeaders": [
{
"name": "<string>",
"value": "<string>"
}
],
"from": {
"name": "<string>",
"address": "<string>"
},
"cc": "<string>",
"bcc": "<string>",
"reply_to": "<string>",
"subject": "<string>",
"emailEditorJson": {},
"emailDesign": {},
"text": "<string>",
"html": "<string>",
"mjml": "<string>"
},
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'email',
campaign_id: 123,
locale: 'en-AU',
data: {
customHeaders: [{name: '<string>', value: '<string>'}],
from: {name: '<string>', address: '<string>'},
cc: '<string>',
bcc: '<string>',
reply_to: '<string>',
subject: '<string>',
emailEditorJson: {},
emailDesign: {},
text: '<string>',
html: '<string>',
mjml: '<string>'
},
name: '<string>'
})
};
fetch('https://apix.spotzee.com/api/client/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apix.spotzee.com/api/client/templates"
payload := strings.NewReader("{\n \"type\": \"email\",\n \"campaign_id\": 123,\n \"locale\": \"en-AU\",\n \"data\": {\n \"customHeaders\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"from\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"cc\": \"<string>\",\n \"bcc\": \"<string>\",\n \"reply_to\": \"<string>\",\n \"subject\": \"<string>\",\n \"emailEditorJson\": {},\n \"emailDesign\": {},\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"mjml\": \"<string>\"\n },\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": 158,
"project_id": 123,
"campaign_id": 24,
"type": "email",
"locale": "en-AU",
"data": {},
"created_at": "<string>",
"updated_at": "<string>",
"name": "<string>"
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}{
"status": "error",
"code": "resource_missing",
"message": "User usr_01HXY7Z9K8M5J2N4P6Q8R0S1T2 was not found in this project.",
"error": "<string>",
"title": "Resource missing",
"type": "https://docs.spotzee.com/main-api/errors#resource_missing",
"request_id": "req_01HXY7Z9K8M5J2N4P6Q8R0S1T2",
"param": "id",
"errors": [
{
"param": "email",
"code": "parameter_invalid_format",
"message": "Must be a valid email address."
}
]
}Authorizations
Project-scoped secret API key (sk_…). Pass in the Authorization: Bearer <key> header. Grants access to the project the key was issued for.
Body
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
Create a new template. The type discriminator selects the channel-specific data shape.
email Campaign this template belongs to.
BCP-47 locale tag (for example en-AU).
"en-AU"
Email template payload — supports plain-text, HTML, and MJML bodies.
Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
Email address. Drafts may be blank; Handlebars variables are allowed in RFC-valid local parts.
^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$Email address. Drafts may be blank; Handlebars variables are allowed in RFC-valid local parts.
^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$Email address. Drafts may be blank; Handlebars variables are allowed in RFC-valid local parts.
^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$Email address. Drafts may be blank; Handlebars variables are allowed in RFC-valid local parts.
^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$code, visual, plain, wysiwyg React Email/TipTap document JSON used by the WYSIWYG editor.
Validated React Email design settings used by the WYSIWYG editor theme.
Response
The newly created template.
A localised, channel-specific message body bound to a campaign.
Numeric template identifier.
158
Identifier of the owning project.
Identifier of the campaign this template belongs to.
24
Delivery channel a template is bound to.
email, text, push, webhook, in_app "email"
BCP-47 locale this template is authored in.
"en-AU"
Channel-specific template body. Shape varies by type — see TemplateEmailData, TemplatePushData, etc.
Optional human-readable template name.
Was this page helpful?