API DOCUMENTATION Last Update: July 2025

Email Templates - Create New

Allows you to add a new email template to an existing loyalty account. Email templates allow you to send customers a different email based on the following activity types: Positive transactions, Redemptions, New customer accounts.

 

The data to be submitted to the API is composed of the following fields:

 

Headers

  Key   Value   Note
api_access_key user_api_key Optional

 

 

Fields common to all campaign types:

  field   Example   Note
API 1.5 Required
user_id john1970 Required
user_api_key 1959caadac9b13dcb3 Required if not included in the headers
type manage_email_templates Required
action new Required
account_id greatwidgets Required
template_name Welcome Email Required
template_description This is the email that new customers will receive when enrolling in the loyalty program Optional
template_rule record, redeem, or new_accounts Required
campaign_id all or campaign id(s) Required
template_subject Welcome to Amazing Rewards Required
template_content [HTML Content] Required
include_balance Y Optional
include_rewards Y Optional
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

 

Notes:

  • Headers: the user_api_key value can be included in either the header section or the body of the request. If the key is provided in both locations, the API will process and validate only the value provided in the headers.

  • Template Rule: Use "record" for positive transactions, "redeem" for deductions, and "new_accounts" for new customer accounts (enrollment/registration).
  • Template Content: [HTML Content] Must keep format with escape variables in special characters.
  • Only one tempalte can be created at a time. Loop this call in your program to create multiple templates at once.

Example PHP Request:

If you are using PHP, the $data array would look like this:

  1. $data['API'] = '1.5';
  2. $data['user_id'] = 'john1970';
  3. $data['user_api_key'] = '1959caadac9b13dcb3';
  4. $data['account_id'] = 'greatwidgets';
  5. $data['type'] = 'manage_email_templates';
  6. $data['action'] = 'new';
  7. $data['template_name'] = 'Welcome Email'
  8. $data['template_description'] = 'Welcome Email';
  9. $data['template_rule'] = 'new_accounts';
  10. $data['campaign_id'] = '1111222233334444';
  11. $data['template_subject'] = 'Welcome to Amazing Rewards';
  12. $data['template_content'] = 'Test Email Content';

 

Success XML Response:

  1. <response status="success">
  2. <template_id>7</template_id>
  3. </response>

 

Error XML Response:

  1. <response status="error">
  2. <error>Error message</error>
  3. </response>