Documentation Index
Fetch the complete documentation index at: https://docs.mailglyph.com/llms.txt
Use this file to discover all available pages before exploring further.
Use a secret key client for template methods.
from mailglyph import MailGlyph
client = MailGlyph("sk_your_secret_key")
List templates (templates.list)
page = client.templates.list(
limit=20,
type="TRANSACTIONAL",
search="welcome",
)
print(page.total, page.total_pages, len(page.data))
Create a template (templates.create)
template = client.templates.create(
name="Welcome",
subject="Welcome to MailGlyph",
body="<h1>Welcome</h1><p>Thanks for joining us.</p>",
type="TRANSACTIONAL",
)
print(template.id, template.name)
Get one template (templates.get)
fetched = client.templates.get(template.id)
print(fetched.subject, fetched.type)
Update a template (templates.update)
updated = client.templates.update(
template.id,
subject="Welcome to MailGlyph!",
body="<h1>Welcome!</h1><p>We are glad to have you.</p>",
)
print(updated.subject)
Delete a template (templates.delete)
client.templates.delete(template.id)
Async equivalents
from mailglyph import AsyncMailGlyph
async def run() -> None:
async with AsyncMailGlyph("sk_your_secret_key") as client:
page = await client.templates.list(limit=20)
created = await client.templates.create(
name="Welcome",
subject="Welcome to MailGlyph",
body="<h1>Welcome</h1>",
type="TRANSACTIONAL",
)
fetched = await client.templates.get(created.id)
updated = await client.templates.update(fetched.id, subject="Welcome!")
await client.templates.delete(updated.id)
See full details in the Templates API reference.