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. 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 April 26th, 2018

Still need some help?

Our customer success team has your back!