curl -X POST https://api.usegately.com/api/v1/email/send \
-H "Authorization: Bearer gately_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "user@example.com",
"subject": "Welcome to {{project}}!",
"html": "<h1>Hello {{name}}!</h1><p>Welcome aboard.</p>",
"template_data": { "name": "John", "project": "Acme" },
"tags": { "type": "welcome" }
}'
const response = await fetch('https://api.usegately.com/api/v1/email/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: 'user@example.com',
subject: 'Welcome to {{project}}!',
html: '<h1>Hello {{name}}!</h1><p>Welcome aboard.</p>',
template_data: { name: 'John', project: 'Acme' },
tags: { type: 'welcome' },
}),
});
const result = await response.json();
import requests
response = requests.post(
'https://api.usegately.com/api/v1/email/send',
headers={
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'to': 'user@example.com',
'subject': 'Welcome to {{project}}!',
'html': '<h1>Hello {{name}}!</h1><p>Welcome aboard.</p>',
'template_data': {'name': 'John', 'project': 'Acme'},
'tags': {'type': 'welcome'},
}
)
print(response.json())
{
"success": true,
"sent": 1,
"failed": 0,
"results": [
{
"email": "user@example.com",
"status": "sent",
"message_id": "0100019fc2ed413a-69325b2f-..."
}
]
}
{
"success": false,
"sent": 2,
"failed": 1,
"results": [
{ "email": "good@example.com", "status": "sent", "message_id": "..." },
{ "email": "bad@example.com", "status": "failed", "error": "Recipient address rejected" }
]
}
{
"error": "Invalid or missing API key"
}
Transactional Email
Send Email
Send a transactional email to one or more recipients.
POST
/
api
/
v1
/
email
/
send
curl -X POST https://api.usegately.com/api/v1/email/send \
-H "Authorization: Bearer gately_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "user@example.com",
"subject": "Welcome to {{project}}!",
"html": "<h1>Hello {{name}}!</h1><p>Welcome aboard.</p>",
"template_data": { "name": "John", "project": "Acme" },
"tags": { "type": "welcome" }
}'
const response = await fetch('https://api.usegately.com/api/v1/email/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: 'user@example.com',
subject: 'Welcome to {{project}}!',
html: '<h1>Hello {{name}}!</h1><p>Welcome aboard.</p>',
template_data: { name: 'John', project: 'Acme' },
tags: { type: 'welcome' },
}),
});
const result = await response.json();
import requests
response = requests.post(
'https://api.usegately.com/api/v1/email/send',
headers={
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'to': 'user@example.com',
'subject': 'Welcome to {{project}}!',
'html': '<h1>Hello {{name}}!</h1><p>Welcome aboard.</p>',
'template_data': {'name': 'John', 'project': 'Acme'},
'tags': {'type': 'welcome'},
}
)
print(response.json())
{
"success": true,
"sent": 1,
"failed": 0,
"results": [
{
"email": "user@example.com",
"status": "sent",
"message_id": "0100019fc2ed413a-69325b2f-..."
}
]
}
{
"success": false,
"sent": 2,
"failed": 1,
"results": [
{ "email": "good@example.com", "status": "sent", "message_id": "..." },
{ "email": "bad@example.com", "status": "failed", "error": "Recipient address rejected" }
]
}
{
"error": "Invalid or missing API key"
}
Headers
string
required
Bearer YOUR_API_KEYstring
required
application/jsonBody
string | string[]
required
Recipient email address or array of up to 50 addresses.
string
required
Email subject line. Supports
{{variable}} template variables.string
HTML body of the email. Supports
{{variable}} substitution. Required if template_id is not provided.string
Plain text fallback body. Recommended alongside
html.string
ID of a saved template to use. Overrides
html / text if provided.object
Key-value pairs for
{{variable}} substitution in the subject, html, or template.string
Override the sender address. Must be a verified sending domain. Defaults to your project’s primary sending domain.
string
Reply-to email address.
object
Arbitrary key-value metadata attached to the log entry for filtering (e.g.
{ "type": "welcome", "user_id": "abc123" }).Response
boolean
true if all recipients were sent successfully.number
Number of successfully sent emails.
number
Number of failed sends.
array
curl -X POST https://api.usegately.com/api/v1/email/send \
-H "Authorization: Bearer gately_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "user@example.com",
"subject": "Welcome to {{project}}!",
"html": "<h1>Hello {{name}}!</h1><p>Welcome aboard.</p>",
"template_data": { "name": "John", "project": "Acme" },
"tags": { "type": "welcome" }
}'
const response = await fetch('https://api.usegately.com/api/v1/email/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: 'user@example.com',
subject: 'Welcome to {{project}}!',
html: '<h1>Hello {{name}}!</h1><p>Welcome aboard.</p>',
template_data: { name: 'John', project: 'Acme' },
tags: { type: 'welcome' },
}),
});
const result = await response.json();
import requests
response = requests.post(
'https://api.usegately.com/api/v1/email/send',
headers={
'Authorization': 'Bearer gately_YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'to': 'user@example.com',
'subject': 'Welcome to {{project}}!',
'html': '<h1>Hello {{name}}!</h1><p>Welcome aboard.</p>',
'template_data': {'name': 'John', 'project': 'Acme'},
'tags': {'type': 'welcome'},
}
)
print(response.json())
{
"success": true,
"sent": 1,
"failed": 0,
"results": [
{
"email": "user@example.com",
"status": "sent",
"message_id": "0100019fc2ed413a-69325b2f-..."
}
]
}
{
"success": false,
"sent": 2,
"failed": 1,
"results": [
{ "email": "good@example.com", "status": "sent", "message_id": "..." },
{ "email": "bad@example.com", "status": "failed", "error": "Recipient address rejected" }
]
}
{
"error": "Invalid or missing API key"
}
Template variables
Use{{variable_name}} syntax anywhere in subject, html, or text, then pass values via template_data:
{
"subject": "Hello {{name}}, your order #{{order_id}} is ready",
"html": "<p>Hi {{name}}, <a href='{{link}}'>track your order</a>.</p>",
"template_data": {
"name": "Jane",
"order_id": "12345",
"link": "https://example.com/track/12345"
}
}
Was this page helpful?