Create Email Template
Create a new email template
post
Authorizations
Api-TokenstringRequired
API token in Api-Token header
Body
Responses
201
Email template created successfully.
application/json
idintegerOptional
uuidstring · uuidOptional
namestring · max: 255Optional
categorystring · max: 255Optional
subjectstring · max: 255Optional
body_textstring · max: 10000000Optional
body_htmlstring · max: 10000000Optional
created_atstring · date-timeOptional
updated_atstring · date-timeOptional
401
Returns unauthorized error message. Check your credentials.
application/json
403
Returns forbidden error message. Check your permissions.
application/json
422
Validation errors, or the account has reached its plan's template limit.
application/json
429
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).
application/json
post/api/email_templates
curl -X POST "https://mailtrap.io/api/email_templates" \
-H "Api-Token: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email_template": {
"name": "Welcome Email",
"subject": "Welcome to {{company_name}}!",
"category": "onboarding",
"body_html": "<h1>Welcome {{user_name}}!</h1>",
"body_text": "Welcome {{user_name}}!"
}
}'
{
"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?

