Templates & API Keys
Templates
Templates let you store reusable email bodies with variable placeholders.
curl -X POST https://api.purpletoadmail.com/api/v1/templates \
-H "Authorization: Bearer pt_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "welcome",
"description": "Sent to new signups",
"subject": "Welcome, {{name}}!",
"text_body": "Hi {{name}}, welcome to {{product}}.",
"html_body": "<p>Hi {{name}}, welcome to <strong>{{product}}</strong>.</p>"
}'
The response contains the template's UUID. Use that id when sending with the template.
Send with a template:
curl -X POST https://api.purpletoadmail.com/api/v1/outbound/send-template \
-H "Authorization: Bearer pt_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"from_email": "hello@yourdomain.com",
"to": ["user@example.com"],
"template_id": "7d871e40-32c1-4e8a-9030-29f876f69f27",
"variables": {"name": "Ada", "product": "Acme"}
}'
API key best practices
- Use separate keys for each service or environment.
- Restrict keys to specific domains or IP ranges when possible.
- Rotate keys from the dashboard if they are leaked.
- Never commit keys to source control.