curl -X POST https://api.usegately.com/api/v1/email/templates \
-H "Authorization: Bearer gately_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome Email",
"subject": "Welcome to {{project}}, {{name}}!",
"html_content": "<h1>Hi {{name}},</h1><p>Welcome to <strong>{{project}}</strong>. Get started at <a href=\"{{url}}\">{{url}}</a>.</p>",
"text_content": "Hi {{name}}, welcome to {{project}}. Get started at {{url}}.",
"category": "welcome"
}'
const response = await fetch('https://api.usegately.com/api/v1/email/templates', {
method: 'POST',
headers: {
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Welcome Email',
subject: 'Welcome to {{project}}, {{name}}!',
html_content: '<h1>Hi {{name}},</h1><p>Welcome to <strong>{{project}}</strong>.</p>',
text_content: 'Hi {{name}}, welcome to {{project}}.',
category: 'welcome',
}),
});
const template = await response.json();
import requests
response = requests.post(
'https://api.usegately.com/api/v1/email/templates',
headers={
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'name': 'Welcome Email',
'subject': 'Welcome to {{project}}, {{name}}!',
'html_content': '<h1>Hi {{name}},</h1>',
'category': 'welcome',
}
)
print(response.json())
{
"id": "tmpl_abc123",
"name": "Welcome Email",
"subject": "Welcome to {{project}}, {{name}}!",
"category": "welcome",
"created_at": "2026-08-02T10:00:00Z"
}
{
"error": "name and subject are required"
}
{
"error": "Invalid or missing API key"
}
Transactional Email
Create Template
Create a reusable email template with variable substitution.
POST
/
api
/
v1
/
email
/
templates
curl -X POST https://api.usegately.com/api/v1/email/templates \
-H "Authorization: Bearer gately_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome Email",
"subject": "Welcome to {{project}}, {{name}}!",
"html_content": "<h1>Hi {{name}},</h1><p>Welcome to <strong>{{project}}</strong>. Get started at <a href=\"{{url}}\">{{url}}</a>.</p>",
"text_content": "Hi {{name}}, welcome to {{project}}. Get started at {{url}}.",
"category": "welcome"
}'
const response = await fetch('https://api.usegately.com/api/v1/email/templates', {
method: 'POST',
headers: {
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Welcome Email',
subject: 'Welcome to {{project}}, {{name}}!',
html_content: '<h1>Hi {{name}},</h1><p>Welcome to <strong>{{project}}</strong>.</p>',
text_content: 'Hi {{name}}, welcome to {{project}}.',
category: 'welcome',
}),
});
const template = await response.json();
import requests
response = requests.post(
'https://api.usegately.com/api/v1/email/templates',
headers={
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'name': 'Welcome Email',
'subject': 'Welcome to {{project}}, {{name}}!',
'html_content': '<h1>Hi {{name}},</h1>',
'category': 'welcome',
}
)
print(response.json())
{
"id": "tmpl_abc123",
"name": "Welcome Email",
"subject": "Welcome to {{project}}, {{name}}!",
"category": "welcome",
"created_at": "2026-08-02T10:00:00Z"
}
{
"error": "name and subject are required"
}
{
"error": "Invalid or missing API key"
}
Headers
string
required
Bearer YOUR_API_KEYstring
required
application/jsonBody
string
required
Human-readable template name.
string
required
Default subject line. Supports
{{variable}} syntax.string
HTML body with
{{variable}} placeholders.string
Plain text body with
{{variable}} placeholders.string
default:"transactional"
Template category. Values:
transactional, marketing, notification, welcome, custom.Response
string
Template ID — use this as
template_id when sending emails.string
Template name.
string
Default subject line.
string
Template category.
string
ISO 8601 creation timestamp.
curl -X POST https://api.usegately.com/api/v1/email/templates \
-H "Authorization: Bearer gately_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome Email",
"subject": "Welcome to {{project}}, {{name}}!",
"html_content": "<h1>Hi {{name}},</h1><p>Welcome to <strong>{{project}}</strong>. Get started at <a href=\"{{url}}\">{{url}}</a>.</p>",
"text_content": "Hi {{name}}, welcome to {{project}}. Get started at {{url}}.",
"category": "welcome"
}'
const response = await fetch('https://api.usegately.com/api/v1/email/templates', {
method: 'POST',
headers: {
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Welcome Email',
subject: 'Welcome to {{project}}, {{name}}!',
html_content: '<h1>Hi {{name}},</h1><p>Welcome to <strong>{{project}}</strong>.</p>',
text_content: 'Hi {{name}}, welcome to {{project}}.',
category: 'welcome',
}),
});
const template = await response.json();
import requests
response = requests.post(
'https://api.usegately.com/api/v1/email/templates',
headers={
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'name': 'Welcome Email',
'subject': 'Welcome to {{project}}, {{name}}!',
'html_content': '<h1>Hi {{name}},</h1>',
'category': 'welcome',
}
)
print(response.json())
{
"id": "tmpl_abc123",
"name": "Welcome Email",
"subject": "Welcome to {{project}}, {{name}}!",
"category": "welcome",
"created_at": "2026-08-02T10:00:00Z"
}
{
"error": "name and subject are required"
}
{
"error": "Invalid or missing API key"
}
Was this page helpful?
⌘I