curl --request POST \
--url https://api.1club.ai/v1/platform/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"content": "<string>",
"type": "message",
"subject": "<string>",
"previewText": "<string>",
"contentType": "html"
}
'import requests
url = "https://api.1club.ai/v1/platform/templates"
payload = {
"name": "<string>",
"content": "<string>",
"type": "message",
"subject": "<string>",
"previewText": "<string>",
"contentType": "html"
}
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({
name: '<string>',
content: '<string>',
type: 'message',
subject: '<string>',
previewText: '<string>',
contentType: 'html'
})
};
fetch('https://api.1club.ai/v1/platform/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.1club.ai/v1/platform/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'content' => '<string>',
'type' => 'message',
'subject' => '<string>',
'previewText' => '<string>',
'contentType' => 'html'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.1club.ai/v1/platform/templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"message\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"contentType\": \"html\"\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))
}HttpResponse<String> response = Unirest.post("https://api.1club.ai/v1/platform/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"message\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"contentType\": \"html\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.1club.ai/v1/platform/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"message\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"contentType\": \"html\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"type": "message",
"subject": "<string>",
"previewText": "<string>",
"content": {
"html": "<string>",
"blocks": {
"blocks": [
{
"type": "paragraph",
"data": {},
"id": "<string>",
"tunes": {}
}
],
"time": 123,
"version": "<string>"
}
},
"contentType": "html",
"systemTemplateKey": "<string>",
"translatedLocales": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}Create a message template
Creates a reusable template. type defaults to message (applied in the message composer); transactional is for automations. Every {{variable}} in the subject, preview text and body must be one the type resolves - see GET /v1/platform/templates/variables - or the write is a 400 with code TEMPLATE_VARIABLE_NOT_ALLOWED naming the offenders and the allowed set.
content is a string (HTML, or plain text with contentType: text) or { html } / { blocks } in the block editor’s format. An HTML block over the email size limit is a 400 (CONTENT_TOO_LARGE), and so is a button whose link has a {{variable}} inside the address rather than as the whole address (LINK_HAS_BURIED_VARIABLE).
Customizing templates is not available on the Free plan (403, code PLAN_FEATURE_LOCKED). To customize a system email, use POST /v1/platform/templates/system/{key}/copy instead. Supports the Idempotency-Key header.
curl --request POST \
--url https://api.1club.ai/v1/platform/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"content": "<string>",
"type": "message",
"subject": "<string>",
"previewText": "<string>",
"contentType": "html"
}
'import requests
url = "https://api.1club.ai/v1/platform/templates"
payload = {
"name": "<string>",
"content": "<string>",
"type": "message",
"subject": "<string>",
"previewText": "<string>",
"contentType": "html"
}
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({
name: '<string>',
content: '<string>',
type: 'message',
subject: '<string>',
previewText: '<string>',
contentType: 'html'
})
};
fetch('https://api.1club.ai/v1/platform/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.1club.ai/v1/platform/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'content' => '<string>',
'type' => 'message',
'subject' => '<string>',
'previewText' => '<string>',
'contentType' => 'html'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.1club.ai/v1/platform/templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"message\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"contentType\": \"html\"\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))
}HttpResponse<String> response = Unirest.post("https://api.1club.ai/v1/platform/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"message\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"contentType\": \"html\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.1club.ai/v1/platform/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"message\",\n \"subject\": \"<string>\",\n \"previewText\": \"<string>\",\n \"contentType\": \"html\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"type": "message",
"subject": "<string>",
"previewText": "<string>",
"content": {
"html": "<string>",
"blocks": {
"blocks": [
{
"type": "paragraph",
"data": {},
"id": "<string>",
"tunes": {}
}
],
"time": 123,
"version": "<string>"
}
},
"contentType": "html",
"systemTemplateKey": "<string>",
"translatedLocales": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}Authorizations
Organization-scoped bearer credential: a customer API key (1club_sk_live_...) or an MCP OAuth access token.
Headers
Retry-safe key; a repeat of the same request replays the first response
255Body
Fields accepted when creating a template. Unknown fields are refused.
Name, shown to staff when picking a template.
1 - 255The body. A string is HTML (or plain text with contentType: text). The object form is { html } and/or { blocks } in the block editor's format. An HTML block over the email size limit is refused (CONTENT_TOO_LARGE), and so is a button whose link has a {{variable}} inside the address rather than as the whole address (LINK_HAS_BURIED_VARIABLE).
500000message: applied in the message composer. transactional: sent by automations. Decides which {{variables}} the template may use.
message, transactional Email subject. May use variables. null clears it.
255The line an inbox shows after the subject. null clears it.
255How a string body is read.
html, text Response
Template created
A reusable message template.
receipt is a legacy type: listed where it exists, never created.
message, transactional, receipt A template body: html, blocks, or both.
Show child attributes
Show child attributes
html, text Set on the organization's own copy of a system email: the key of the email it replaces, which is then sent as this template.
Locales with their own copy of this template. Per-locale copy is managed in the admin portal.
Was this page helpful?