Grosend|Docs
Getting Started
  • Introduction
  • Quick Start
Sending
  • SMTP Relay
  • Authentication
Automation
  • Overview
API Reference
  • Overview
  • Send Email
  • Domains
  • Templates
  • API Keys
  • Webhooks
Analytics
  • Tracking
Docs
Getting Started
  • Introduction
  • Quick Start
Sending
  • SMTP Relay
  • Authentication
Automation
  • Overview
API Reference
  • Overview
  • Send Email
  • Domains
  • Templates
  • API Keys
  • Webhooks
Analytics
  • Tracking

Templates

Create reusable email templates with dynamic merge tags.

Create a template

Terminal
curl -X POST https://api.grosend.com/api/v1/templates \
  -H "Authorization: Bearer sv_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome Email",
    "subject": "Welcome {{name}}!",
    "htmlBody": "<h1>Welcome {{name}}</h1><p>Thanks for joining {{company}}.</p>",
    "variables": ["name", "company"]
  }'
The template body uses {{variable}} syntax. All variables are HTML-escaped by default.

Use a template in an email

Terminal
curl -X POST https://api.grosend.com/api/v1/emails \
  -H "Authorization: Bearer sv_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "from": "hello@yourdomain.com",
    "to": ["user@example.com"],
    "template_id": "template-uuid",
    "variables": {
      "name": "Alice",
      "company": "Acme Inc"
    }
  }'

List templates

Terminal
curl https://api.grosend.com/api/v1/templates \
  -H "Authorization: Bearer sv_live_..."

Update a template

Terminal
curl -X PUT https://api.grosend.com/api/v1/templates/{template-id} \
  -H "Authorization: Bearer sv_live_..." \
  -H "Content-Type: application/json" \
  -d '{"name": "Updated Name", "subject": "New subject"}'

Delete a template

Terminal
curl -X DELETE https://api.grosend.com/api/v1/templates/{template-id} \
  -H "Authorization: Bearer sv_live_..."