curl -X POST "https://api.usegately.com/api/v1/campaigns/ai-generate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Project-ID: YOUR_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{
"campaignName": "Summer Sale",
"subject": "50% off everything this weekend",
"tone": "friendly"
}'
import { GatelyCampaigns } from '@gately/sdk'
const campaigns = new GatelyCampaigns({ projectId: 'YOUR_PROJECT_ID' })
const { html } = await campaigns.aiGenerate({
campaignName: 'Summer Sale',
subject: '50% off everything this weekend',
tone: 'friendly',
})
import { GatelyCampaigns } from '@gately/sdk'
const campaigns = new GatelyCampaigns({ projectId: 'YOUR_PROJECT_ID' })
const result = await campaigns.aiSend({
campaignName: 'Summer Sale',
subject: '50% off everything this weekend',
tone: 'friendly',
recipient_all_contacts: true,
})
console.log(`Sent to ${result.successful_sends} recipients`)
{
"html": "<div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; padding: 30px;\">\n <h1 style=\"color: #333;\">Summer Sale — 50% Off!</h1>\n <p style=\"color: #555; line-height: 1.6;\">Hi there,</p>\n <p style=\"color: #555; line-height: 1.6;\">We're excited to announce our biggest sale of the year...</p>\n <a href=\"#\" style=\"display: inline-block; background: #FE551B; color: white; padding: 12px 24px; border-radius: 6px; text-decoration: none; font-weight: bold;\">Shop Now</a>\n</div>"
}
{
"error": "campaignName is required"
}
Email Campaigns
AI Generate Content
Generate a complete HTML email body using Gately’s built-in AI
POST
/
api
/
v1
/
campaigns
/
ai-generate
curl -X POST "https://api.usegately.com/api/v1/campaigns/ai-generate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Project-ID: YOUR_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{
"campaignName": "Summer Sale",
"subject": "50% off everything this weekend",
"tone": "friendly"
}'
import { GatelyCampaigns } from '@gately/sdk'
const campaigns = new GatelyCampaigns({ projectId: 'YOUR_PROJECT_ID' })
const { html } = await campaigns.aiGenerate({
campaignName: 'Summer Sale',
subject: '50% off everything this weekend',
tone: 'friendly',
})
import { GatelyCampaigns } from '@gately/sdk'
const campaigns = new GatelyCampaigns({ projectId: 'YOUR_PROJECT_ID' })
const result = await campaigns.aiSend({
campaignName: 'Summer Sale',
subject: '50% off everything this weekend',
tone: 'friendly',
recipient_all_contacts: true,
})
console.log(`Sent to ${result.successful_sends} recipients`)
{
"html": "<div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; padding: 30px;\">\n <h1 style=\"color: #333;\">Summer Sale — 50% Off!</h1>\n <p style=\"color: #555; line-height: 1.6;\">Hi there,</p>\n <p style=\"color: #555; line-height: 1.6;\">We're excited to announce our biggest sale of the year...</p>\n <a href=\"#\" style=\"display: inline-block; background: #FE551B; color: white; padding: 12px 24px; border-radius: 6px; text-decoration: none; font-weight: bold;\">Shop Now</a>\n</div>"
}
{
"error": "campaignName is required"
}
Uses Gately’s AI model (Kimi K2) to produce inline-styled, email-client-compatible HTML based on your campaign name, subject, and desired tone. The returned HTML can be passed directly to the Send Campaign endpoint.
Headers
string
required
Bearer YOUR_API_KEYstring
Your project UUID. Not required if the API key already encodes the project.
Request Body
string
required
Name of the campaign — used as the primary context for generation
string
Email subject line — provides additional context for the AI
string
default:"professional"
Writing tone:
professional · friendly · casual · urgentResponse
string
Complete, inline-styled HTML email body ready to send
curl -X POST "https://api.usegately.com/api/v1/campaigns/ai-generate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Project-ID: YOUR_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{
"campaignName": "Summer Sale",
"subject": "50% off everything this weekend",
"tone": "friendly"
}'
import { GatelyCampaigns } from '@gately/sdk'
const campaigns = new GatelyCampaigns({ projectId: 'YOUR_PROJECT_ID' })
const { html } = await campaigns.aiGenerate({
campaignName: 'Summer Sale',
subject: '50% off everything this weekend',
tone: 'friendly',
})
import { GatelyCampaigns } from '@gately/sdk'
const campaigns = new GatelyCampaigns({ projectId: 'YOUR_PROJECT_ID' })
const result = await campaigns.aiSend({
campaignName: 'Summer Sale',
subject: '50% off everything this weekend',
tone: 'friendly',
recipient_all_contacts: true,
})
console.log(`Sent to ${result.successful_sends} recipients`)
{
"html": "<div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; padding: 30px;\">\n <h1 style=\"color: #333;\">Summer Sale — 50% Off!</h1>\n <p style=\"color: #555; line-height: 1.6;\">Hi there,</p>\n <p style=\"color: #555; line-height: 1.6;\">We're excited to announce our biggest sale of the year...</p>\n <a href=\"#\" style=\"display: inline-block; background: #FE551B; color: white; padding: 12px 24px; border-radius: 6px; text-decoration: none; font-weight: bold;\">Shop Now</a>\n</div>"
}
{
"error": "campaignName is required"
}
Was this page helpful?
⌘I