Free Webinar: Using Postmark to send effective emails Learn how to improve the effectiveness of your transactional emails
x

How do I use a template alias?

If you wish to reference a template by an alias instead of its Template ID, you can set an alias that you then use in your API call to send an email with the template. You can set a template's alias using the UI or Templates API.

Set an alias using the UI

Open the template you want to set an alias for and then click Add alias. You can then set an alias for your template to use for referencing it when sending.

Note: Be sure to update your integration codebase that sends using the alias, if you ever change an existing alias.

Set an alias using the Templates API

To set an alias, edit the template using a PUT call to https://api.postmarkapp.com/templates/{templateID} with the alias you want to set included in the body:

{ 	
 "Name": "Template Name"
 "Alias":"my-alias" 
}

Once you have your alias set, you can now use it to send an email with that template. You will still send the request to send to the same endpoint but instead of including a "TemplateId" field for identifying the template, you will use your alias for the template in a "TemplateAlias" field, like this:

{ 
 "TemplateAlias": "my-alias", 
 "TemplateModel": { 
 "user_name": "John Smith",
 "company": { 
 "name": "ACME"
 } 
 }, 
 "From": "sender@example.com",
 "To": "receiver@example.com" 
}
Last updated October 17th, 2018

Still need some help?

Our customer success team has your back!