send0
API Reference

Templates

Create, update, and manage reusable email templates.

Create a template

POST /v1/templates

Creates a new reusable email template. Templates support variable interpolation using {{variable}} syntax.

Parameters

ParameterTypeRequiredDescription
namestringYesTemplate name
subjectstringYesEmail subject line
htmlstringYesHTML content
textstringNoPlain text fallback

Examples

TypeScript SDK

const template = await send0.templates.create({
  name: 'welcome',
  subject: 'Welcome to {{company}}!',
  html: '<h1>Welcome, {{name}}!</h1><p>Thanks for joining {{company}}.</p>',
  text: 'Welcome, {{name}}! Thanks for joining {{company}}.',
});

Python SDK

template = client.templates.create(
    name="welcome",
    subject="Welcome to {{company}}!",
    html="<h1>Welcome, {{name}}!</h1><p>Thanks for joining {{company}}.</p>",
    text="Welcome, {{name}}! Thanks for joining {{company}}.",
)

Go SDK

template, err := client.Templates.Create(ctx, &send0.CreateTemplateParams{
    Name:    "welcome",
    Subject: "Welcome to {{company}}!",
    HTML:    "<h1>Welcome, {{name}}!</h1><p>Thanks for joining {{company}}.</p>",
    Text:    "Welcome, {{name}}! Thanks for joining {{company}}.",
})

curl

curl -X POST https://api.send0.dev/v1/templates \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "welcome",
    "subject": "Welcome to {{company}}!",
    "html": "<h1>Welcome, {{name}}!</h1><p>Thanks for joining {{company}}.</p>"
  }'

Response (201)

{
  "id": "tmpl_9xKq3mNpLvRw",
  "object": "template",
  "name": "welcome",
  "subject": "Welcome to {{company}}!",
  "html": "<h1>Welcome, {{name}}!</h1>...",
  "text": null,
  "created_at": "2026-04-12T10:30:00Z",
  "updated_at": "2026-04-12T10:30:00Z"
}

Get a template

GET /v1/templates/:id

Retrieves a single template by ID.

Examples

TypeScript SDK

const template = await send0.templates.get('tmpl_9xKq3mNpLvRw');

Python SDK

template = client.templates.get("tmpl_9xKq3mNpLvRw")

Go SDK

template, err := client.Templates.Get(ctx, "tmpl_9xKq3mNpLvRw")

curl

curl https://api.send0.dev/v1/templates/tmpl_9xKq3mNpLvRw \
  -H "Authorization: Bearer sk_live_..."

List templates

GET /v1/templates

Returns a paginated list of templates. Uses cursor-based pagination.

Parameters

ParameterTypeDefaultDescription
limitnumber20Results per page (max 100)
cursorstringPagination cursor

Examples

TypeScript SDK

const { data, has_more, cursor } = await send0.templates.list({ limit: 50 });

Python SDK

result = client.templates.list(limit=50)
for tmpl in result.data:
    print(tmpl.id, tmpl.name)

Go SDK

list, err := client.Templates.List(ctx, &send0.ListTemplatesParams{
    Limit: 50,
})
for _, tmpl := range list.Data {
    fmt.Println(tmpl.ID, tmpl.Name)
}

curl

curl "https://api.send0.dev/v1/templates?limit=50" \
  -H "Authorization: Bearer sk_live_..."

Update a template

PATCH /v1/templates/:id

Partially update a template. Only include fields you want to change.

Examples

TypeScript SDK

const template = await send0.templates.update('tmpl_9xKq3mNpLvRw', {
  subject: 'Welcome aboard, {{name}}!',
});

Python SDK

template = client.templates.update(
    "tmpl_9xKq3mNpLvRw",
    subject="Welcome aboard, {{name}}!",
)

Go SDK

template, err := client.Templates.Update(ctx, "tmpl_9xKq3mNpLvRw", &send0.UpdateTemplateParams{
    Subject: send0.String("Welcome aboard, {{name}}!"),
})

curl

curl -X PATCH https://api.send0.dev/v1/templates/tmpl_9xKq3mNpLvRw \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "subject": "Welcome aboard, {{name}}!" }'

Replace a template

PUT /v1/templates/:id

Fully replace a template. All required fields must be provided.

Examples

TypeScript SDK

const template = await send0.templates.replace('tmpl_9xKq3mNpLvRw', {
  name: 'welcome-v2',
  subject: 'Welcome to {{company}}!',
  html: '<h1>Welcome!</h1><p>New design.</p>',
});

Python SDK

template = client.templates.replace(
    "tmpl_9xKq3mNpLvRw",
    name="welcome-v2",
    subject="Welcome to {{company}}!",
    html="<h1>Welcome!</h1><p>New design.</p>",
)

Go SDK

template, err := client.Templates.Replace(ctx, "tmpl_9xKq3mNpLvRw", &send0.ReplaceTemplateParams{
    Name:    "welcome-v2",
    Subject: "Welcome to {{company}}!",
    HTML:    "<h1>Welcome!</h1><p>New design.</p>",
})

curl

curl -X PUT https://api.send0.dev/v1/templates/tmpl_9xKq3mNpLvRw \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "welcome-v2",
    "subject": "Welcome to {{company}}!",
    "html": "<h1>Welcome!</h1><p>New design.</p>"
  }'

Delete a template

DELETE /v1/templates/:id

Permanently deletes a template. This action cannot be undone.

Examples

TypeScript SDK

await send0.templates.delete('tmpl_9xKq3mNpLvRw');

Python SDK

client.templates.delete("tmpl_9xKq3mNpLvRw")

Go SDK

err := client.Templates.Delete(ctx, "tmpl_9xKq3mNpLvRw")

curl

curl -X DELETE https://api.send0.dev/v1/templates/tmpl_9xKq3mNpLvRw \
  -H "Authorization: Bearer sk_live_..."

Preview a template

POST /v1/templates/:id/preview

Render a template with sample data without sending. Useful for testing variable substitution before triggering a send.

Examples

TypeScript SDK

const preview = await send0.templates.preview('tmpl_9xKq3mNpLvRw', {
  data: { name: 'Jane', company: 'Acme' },
});

console.log(preview.subject); // "Welcome to Acme!"
console.log(preview.html);    // rendered HTML

Python SDK

preview = client.templates.preview(
    "tmpl_9xKq3mNpLvRw",
    data={"name": "Jane", "company": "Acme"},
)
print(preview.subject)  # "Welcome to Acme!"
print(preview.html)     # rendered HTML

Go SDK

preview, err := client.Templates.Preview(ctx, "tmpl_9xKq3mNpLvRw", &send0.PreviewTemplateParams{
    Data: map[string]any{"name": "Jane", "company": "Acme"},
})
fmt.Println(preview.Subject) // "Welcome to Acme!"
fmt.Println(preview.HTML)    // rendered HTML

curl

curl -X POST https://api.send0.dev/v1/templates/tmpl_9xKq3mNpLvRw/preview \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "data": { "name": "Jane", "company": "Acme" } }'

Response (200)

{
  "subject": "Welcome to Acme!",
  "html": "<h1>Welcome, Jane!</h1><p>Thanks for joining Acme.</p>",
  "text": "Welcome, Jane! Thanks for joining Acme."
}

Using templates with emails

Reference a template by ID when sending an email. Pass data to populate template variables.

await send0.emails.send({
  from: 'hello@acme.com',
  to: 'user@example.com',
  subject: 'Welcome!',
  template: 'tmpl_9xKq3mNpLvRw',
  data: { name: 'Jane', company: 'Acme' },
});