Update Email Template (Experimental)
Updates an email template and returns it in a data envelope. PUT is accepted on the same path and behaves identically.
The request body is flat, where PATCH /api/email_templates/{email_template_id} expects the attributes wrapped in email_template. That wrapper is still accepted here, so you can switch the path first and flatten the body afterwards.
Every attribute is optional. A request carrying none of them returns 200 with the template unchanged.
API token in Api-Token header
Email template ID
60927OK.
Returns unauthorized error message. Check your credentials.
Returns forbidden error message. Check your permissions.
Resource not found
Validation errors.
Too many requests. The public API is rate limited to 150 requests per 10 seconds per
API token. Retry after the window resets (see the x-ratelimit-reset header).
curl -X PATCH "https://mailtrap.io/api/templates/{template_id}" \
-H "Api-Token: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome Email v2",
"subject": "Welcome aboard, {{user_name}}!"
}'
{
"data": {
"id": 26730,
"uuid": "018dd5e3-f6d2-7c00-8f9b-e5c3f2d8a132",
"name": "My Email Template",
"subject": "Promotional Email",
"category": "Promotional",
"body_html": "<div>Template Body</div>",
"body_text": "Template Body",
"created_at": "2021-01-01T00:00:00Z",
"updated_at": "2021-01-01T00:00:00Z"
}
}Last updated
Was this helpful?

