Email APIs

1. Overview

This page contains the APIs for managing Email Templates as well as emailing users using those templates. Here are the APIs:

2. Create an Email Template

This API is used to create an Email Template. Specifying an Id on the URI will instruct Passport to use that Id when creating the Email Template. Otherwise, Passport will generate an Id for the Email Template.

2.1. Request

Create an Email Template without providing an Id. An Id will be automatically generated.

URI

POST /api/email/template

Create an Email Template with the provided Id

URI

POST /api/email/template/{emailTemplateId}

Table 1. Request Parameters

emailTemplateId [UUID] Optional defaults to secure random UUID

The Id to use for the new Email Template. If not specified a secure random UUID will be generated.

Table 2. Request Body

emailTemplate.defaultFromName [String (FreeMarker Enabled)] Required

The default From Name used when sending emails. This is the display name part of the email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.defaultHtmlTemplate [String (FreeMarker Enabled)] Required

The default HTML Email Template.

emailTemplate.defaultSubject [String (FreeMarker Enabled)] Required

The default Subject used when sending emails.

emailTemplate.defaultTextTemplate [String (FreeMarker Enabled)] Required

The default Text Email Template.

emailTemplate.fromEmail [String] Required

The email address that this email will be sent from. This is the address part email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.localizedFromNames [Map<Locale,String (FreeMarker Enabled)>] Optional

The From Name used when sending emails to users who speak other languages. This overrides the default From Name based on the user’s list of preferred languages.

emailTemplate.localizedHtmlTemplates [Map<Locale,String (FreeMarker Enabled)>] Optional

The HTML Email Template used when sending emails to users who speak other languages. This overrides the default HTML Email Template based on the user’s list of preferred languages.

emailTemplate.localizedSubjects [Map<Locale,String (FreeMarker Enabled)>] Optional

The Subject used when sending emails to users who speak other languages. This overrides the default Subject based on the user’s list of preferred languages.

emailTemplate.localizedTextTemplates [Map<Locale,String (FreeMarker Enabled)>] Optional

The Text Email Template used when sending emails to users who speak other languages. This overrides the default Text Email Template based on the user’s list of preferred languages.

emailTemplate.name [String] Required

A descriptive name for the email template (i.e. "April 2016 Coupon Email")

Example Request JSON
{
  "emailTemplate": {
    "name": "Hello World",
    "fromEmail": "email@example.com",
    "defaultFromName": "Administrator",
    "defaultSubject": "Hello World",
    "defaultHtmlTemplate": "<p>Hello ${user.username}</p><p>Welcome To Passport!</p>",
    "defaultTextTemplate": "Hello ${user.username},\nWelcome To Passport!",
    "localizedFromNames": {
      "de": "Verwalter",
      "fr": "Administrateur"
    },
    "localizedHtmlTemplates": {
      "de": "<p>Hallo ${user.username}</p><p>Willkommen auf der Passport!<p>",
      "fr": "<p>Bonjour ${user.username}</p><p>Bienvenue à Passport!<p>"
    },
    "localizedTextTemplates": {
      "de": "Hallo ${user.username},\nWillkommen auf der Passport!",
      "fr": "Bonjour ${user.username},\nBienvenue à Passport!"
    },
    "localizedSubjects": {
      "de": "Hallo Welt",
      "fr": "Bonjour le monde"
    }
  }
}

2.2. Response

The response for this API contains the information for the Email Template that was created.

Table 3. Response Codes
Code Description

200

The request was successful. The response will contain a JSON body.

400

The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors.

401

You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication.

402

Your license has expired. The response will be empty. Contact sales@inversoft.com for assistance.

500

There was an internal error. A stack trace is provided and logged in the Passport log files. The response will be empty.

Table 4. Response Body for a single Email Template

emailTemplate.defaultFromName [String]

The default From Name used when sending emails. This is the display name part of the email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.defaultHtmlTemplate [String]

The default HTML Email Template.

emailTemplate.defaultSubject [String]

The default Subject used when sending emails.

emailTemplate.defaultTextTemplate [String]

The default Text Email Template.

emailTemplate.fromEmail [String]

The email address that this email will be sent from. This is the address part email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.id [UUID]

The Id of Email Template.

emailTemplate.localizedFromNames [Map<Locale,String>]

The From Name used when sending emails to users who speak other languages. This overrides the default From Name based on the user’s list of preferred languages.

emailTemplate.localizedHtmlTemplates [Map<Locale,String>]

The HTML Email Template used when sending emails to users who speak other languages. This overrides the default HTML Email Template based on the user’s list of preferred languages.

emailTemplate.localizedSubjects [Map<Locale,String>]

The Subject used when sending emails to users who speak other languages. This overrides the default Subject based on the user’s list of preferred languages.

emailTemplate.localizedTextTemplates [Map<Locale,String>]

The Text Email Template used when sending emails to users who speak other languages. This overrides the default Text Email Template based on the user’s list of preferred languages.

emailTemplate.name [String]

A descriptive name for the email template (i.e. "April 2016 Coupon Email")

Example Response JSON for a Single Email Template
{
  "emailTemplate": {
    "id": "00000000-0000-0000-0000-0000000000ab",
    "name": "Hello World",
    "fromEmail": "email@example.com",
    "defaultFromName": "Administrator",
    "defaultSubject": "Hello World",
    "defaultHtmlTemplate": "<p>Hello ${user.username}</p><p>Welcome To Passport!</p>",
    "defaultTextTemplate": "Hello ${user.username},\nWelcome To Passport!",
    "localizedFromNames": {
      "de": "Verwalter",
      "fr": "Administrateur"
    },
    "localizedHtmlTemplates": {
      "de": "<p>Hallo ${user.username}</p><p>Willkommen auf der Passport!<p>",
      "fr": "<p>Bonjour ${user.username}</p><p>Bienvenue à Passport!<p>"
    },
    "localizedTextTemplates": {
      "de": "Hallo ${user.username},\nWillkommen auf der Passport!",
      "fr": "Bonjour ${user.username},\nBienvenue à Passport!"
    },
    "localizedSubjects": {
      "de": "Hallo Welt",
      "fr": "Bonjour le monde"
    }
  }
}

3. Retrieve an Email Template

This API is used to retrieve one or all of the configured Email Templates. Specifying an Id on the URI will retrieve a single Email Template. Leaving off the Id will retrieve all of the Email Templates.

3.1. Request

Retrieve all of the Email Templates

URI

GET /api/email/template

Retrieve a single Email Template by Id

URI

GET /api/email/template/{emailTemplateId}

Table 5. Request Parameters

emailTemplateId [UUID] Optional

The Id of the Email Template to retrieve.

3.2. Response

The response for this API contains either a single Email Template or all of the Email Templates. When you call this API with an Id the response will contain just that Email Template. When you call this API without an Id the response will contain all of the Email Templates. Both response types are defined below along with an example JSON response.

Table 6. Response Codes
Code Description

200

The request was successful. The response will contain a JSON body.

401

You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication.

402

Your license has expired. The response will be empty. Contact sales@inversoft.com for assistance.

404

The object you requested doesn’t exist. The response will be empty.

500

There was an internal error. A stack trace is provided and logged in the Passport log files. The response will be empty.

Table 7. Response Body for a single Email Template

emailTemplate.defaultFromName [String]

The default From Name used when sending emails. This is the display name part of the email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.defaultHtmlTemplate [String]

The default HTML Email Template.

emailTemplate.defaultSubject [String]

The default Subject used when sending emails.

emailTemplate.defaultTextTemplate [String]

The default Text Email Template.

emailTemplate.fromEmail [String]

The email address that this email will be sent from. This is the address part email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.id [UUID]

The Id of Email Template.

emailTemplate.localizedFromNames [Map<Locale,String>]

The From Name used when sending emails to users who speak other languages. This overrides the default From Name based on the user’s list of preferred languages.

emailTemplate.localizedHtmlTemplates [Map<Locale,String>]

The HTML Email Template used when sending emails to users who speak other languages. This overrides the default HTML Email Template based on the user’s list of preferred languages.

emailTemplate.localizedSubjects [Map<Locale,String>]

The Subject used when sending emails to users who speak other languages. This overrides the default Subject based on the user’s list of preferred languages.

emailTemplate.localizedTextTemplates [Map<Locale,String>]

The Text Email Template used when sending emails to users who speak other languages. This overrides the default Text Email Template based on the user’s list of preferred languages.

emailTemplate.name [String]

A descriptive name for the email template (i.e. "April 2016 Coupon Email")

Example Response JSON for a Single Email Template
{
  "emailTemplate": {
    "id": "00000000-0000-0000-0000-0000000000ab",
    "name": "Hello World",
    "fromEmail": "email@example.com",
    "defaultFromName": "Administrator",
    "defaultSubject": "Hello World",
    "defaultHtmlTemplate": "<p>Hello ${user.username}</p><p>Welcome To Passport!</p>",
    "defaultTextTemplate": "Hello ${user.username},\nWelcome To Passport!",
    "localizedFromNames": {
      "de": "Verwalter",
      "fr": "Administrateur"
    },
    "localizedHtmlTemplates": {
      "de": "<p>Hallo ${user.username}</p><p>Willkommen auf der Passport!<p>",
      "fr": "<p>Bonjour ${user.username}</p><p>Bienvenue à Passport!<p>"
    },
    "localizedTextTemplates": {
      "de": "Hallo ${user.username},\nWillkommen auf der Passport!",
      "fr": "Bonjour ${user.username},\nBienvenue à Passport!"
    },
    "localizedSubjects": {
      "de": "Hallo Welt",
      "fr": "Bonjour le monde"
    }
  }
}
Table 8. Response Body for all Email Templates

emailTemplates [Array]

The list of all the Email Templates.

emailTemplates[x].defaultFromName [String]

The default From Name used when sending emails. This is the display name part of the email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplates[x].defaultHtmlTemplate [String]

The default HTML Email Template.

emailTemplates[x].defaultSubject [String]

The default Subject used when sending emails.

emailTemplates[x].defaultTextTemplate [String]

The default Text Email Template.

emailTemplates[x].fromEmail [String]

The email address that this email will be sent from. This is the address part email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplates[x].id [UUID]

The Id of Email Template.

emailTemplates[x].localizedFromNames [Map<Locale,String>]

The From Name used when sending emails to users who speak other languages. This overrides the default From Name based on the user’s list of preferred languages.

emailTemplates[x].localizedHtmlTemplates [Map<Locale,String>]

The HTML Email Template used when sending emails to users who speak other languages. This overrides the default HTML Email Template based on the user’s list of preferred languages.

emailTemplates[x].localizedSubjects [Map<Locale,String>]

The Subject used when sending emails to users who speak other languages. This overrides the default Subject based on the user’s list of preferred languages.

emailTemplates[x].localizedTextTemplates [Map<Locale,String>]

The Text Email Template used when sending emails to users who speak other languages. This overrides the default Text Email Template based on the user’s list of preferred languages.

emailTemplates[x].name [String]

A descriptive name for the email template (i.e. "April 2016 Coupon Email")

Example Response JSON for all the Email Templates
{
  "emailTemplates": [
    {
      "id": "00000000-0000-0000-0000-0000000000ab",
      "name": "Hello World",
      "fromEmail": "email@example.com",
      "defaultFromName": "Administrator",
      "defaultSubject": "Hello World",
      "defaultHtmlTemplate": "<p>Hello ${user.username}</p><p>Welcome To Passport!</p>",
      "defaultTextTemplate": "Hello ${user.username},\nWelcome To Passport!",
      "localizedFromNames": {
        "de": "Verwalter",
        "fr": "Administrateur"
      },
      "localizedHtmlTemplates": {
        "de": "<p>Hallo ${user.username}</p><p>Willkommen auf der Passport!<p>",
        "fr": "<p>Bonjour ${user.username}</p><p>Bienvenue à Passport!<p>"
      },
      "localizedTextTemplates": {
        "de": "Hallo ${user.username},\nWillkommen auf der Passport!",
        "fr": "Bonjour ${user.username},\nBienvenue à Passport!"
      },
      "localizedSubjects": {
        "de": "Hallo Welt",
        "fr": "Bonjour le monde"
      }
    }
  ]
}

4. Update an Email Template

This API is used to update an Email Template. You must specify the Id of the Email Template to update on the URI.

4.1. Request

Update an Email Template by Id

URI

PUT /api/email/template/{emailTemplateId}

Table 9. Request Parameters

emailTemplateId [UUID] Required

The Id of the Email Template to update.

Table 10. Request Body

emailTemplate.defaultFromName [String (FreeMarker Enabled)] Required

The default From Name used when sending emails. This is the display name part of the email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.defaultHtmlTemplate [String (FreeMarker Enabled)] Required

The default HTML Email Template.

emailTemplate.defaultSubject [String (FreeMarker Enabled)] Required

The default Subject used when sending emails.

emailTemplate.defaultTextTemplate [String (FreeMarker Enabled)] Required

The default Text Email Template.

emailTemplate.fromEmail [String] Required

The email address that this email will be sent from. This is the address part email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.localizedFromNames [Map<Locale,String (FreeMarker Enabled)>] Optional

The From Name used when sending emails to users who speak other languages. This overrides the default From Name based on the user’s list of preferred languages.

emailTemplate.localizedHtmlTemplates [Map<Locale,String (FreeMarker Enabled)>] Optional

The HTML Email Template used when sending emails to users who speak other languages. This overrides the default HTML Email Template based on the user’s list of preferred languages.

emailTemplate.localizedSubjects [Map<Locale,String (FreeMarker Enabled)>] Optional

The Subject used when sending emails to users who speak other languages. This overrides the default Subject based on the user’s list of preferred languages.

emailTemplate.localizedTextTemplates [Map<Locale,String (FreeMarker Enabled)>] Optional

The Text Email Template used when sending emails to users who speak other languages. This overrides the default Text Email Template based on the user’s list of preferred languages.

emailTemplate.name [String] Required

A descriptive name for the email template (i.e. "April 2016 Coupon Email")

Example Request JSON
{
  "emailTemplate": {
    "name": "Hello World",
    "fromEmail": "email@example.com",
    "defaultFromName": "Administrator",
    "defaultSubject": "Hello World",
    "defaultHtmlTemplate": "<p>Hello ${user.username}</p><p>Welcome To Passport!</p>",
    "defaultTextTemplate": "Hello ${user.username},\nWelcome To Passport!",
    "localizedFromNames": {
      "de": "Verwalter",
      "fr": "Administrateur"
    },
    "localizedHtmlTemplates": {
      "de": "<p>Hallo ${user.username}</p><p>Willkommen auf der Passport!<p>",
      "fr": "<p>Bonjour ${user.username}</p><p>Bienvenue à Passport!<p>"
    },
    "localizedTextTemplates": {
      "de": "Hallo ${user.username},\nWillkommen auf der Passport!",
      "fr": "Bonjour ${user.username},\nBienvenue à Passport!"
    },
    "localizedSubjects": {
      "de": "Hallo Welt",
      "fr": "Bonjour le monde"
    }
  }
}

4.2. Response

The response for this API contains the new information for the Email Template that was updated.

Table 11. Response Codes
Code Description

200

The request was successful. The response will contain a JSON body.

400

The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors.

401

You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication.

402

Your license has expired. The response will be empty. Contact sales@inversoft.com for assistance.

404

The object you are trying to updated doesn’t exist. The response will be empty.

500

There was an internal error. A stack trace is provided and logged in the Passport log files. The response will be empty.

Table 12. Response Body for a single Email Template

emailTemplate.defaultFromName [String]

The default From Name used when sending emails. This is the display name part of the email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.defaultHtmlTemplate [String]

The default HTML Email Template.

emailTemplate.defaultSubject [String]

The default Subject used when sending emails.

emailTemplate.defaultTextTemplate [String]

The default Text Email Template.

emailTemplate.fromEmail [String]

The email address that this email will be sent from. This is the address part email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.id [UUID]

The Id of Email Template.

emailTemplate.localizedFromNames [Map<Locale,String>]

The From Name used when sending emails to users who speak other languages. This overrides the default From Name based on the user’s list of preferred languages.

emailTemplate.localizedHtmlTemplates [Map<Locale,String>]

The HTML Email Template used when sending emails to users who speak other languages. This overrides the default HTML Email Template based on the user’s list of preferred languages.

emailTemplate.localizedSubjects [Map<Locale,String>]

The Subject used when sending emails to users who speak other languages. This overrides the default Subject based on the user’s list of preferred languages.

emailTemplate.localizedTextTemplates [Map<Locale,String>]

The Text Email Template used when sending emails to users who speak other languages. This overrides the default Text Email Template based on the user’s list of preferred languages.

emailTemplate.name [String]

A descriptive name for the email template (i.e. "April 2016 Coupon Email")

Example Response JSON for a Single Email Template
{
  "emailTemplate": {
    "id": "00000000-0000-0000-0000-0000000000ab",
    "name": "Hello World",
    "fromEmail": "email@example.com",
    "defaultFromName": "Administrator",
    "defaultSubject": "Hello World",
    "defaultHtmlTemplate": "<p>Hello ${user.username}</p><p>Welcome To Passport!</p>",
    "defaultTextTemplate": "Hello ${user.username},\nWelcome To Passport!",
    "localizedFromNames": {
      "de": "Verwalter",
      "fr": "Administrateur"
    },
    "localizedHtmlTemplates": {
      "de": "<p>Hallo ${user.username}</p><p>Willkommen auf der Passport!<p>",
      "fr": "<p>Bonjour ${user.username}</p><p>Bienvenue à Passport!<p>"
    },
    "localizedTextTemplates": {
      "de": "Hallo ${user.username},\nWillkommen auf der Passport!",
      "fr": "Bonjour ${user.username},\nBienvenue à Passport!"
    },
    "localizedSubjects": {
      "de": "Hallo Welt",
      "fr": "Bonjour le monde"
    }
  }
}

5. Delete an Email Template

This API is used to delete an Email Template. You must specify the Id of the Email Template on the URI.

5.1. Request

Delete an Email Template By Id

URI

DELETE /api/email/template/{emailTemplateId}

Table 13. Request Parameters

emailTemplateId [UUID] Required

The Id of the Email Template to delete.

5.2. Response

This API does not return a JSON response body.

Table 14. Response Codes
Code Description

200

The request was successful. The response will be empty.

400

The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors.

401

You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication.

402

Your license has expired. The response will be empty. Contact sales@inversoft.com for assistance.

404

The object you are trying to delete doesn’t exist. The response will be empty.

500

There was an internal error. A stack trace is provided and logged in the Passport log files. The response will be empty.

6. Preview an Email Template

This API is used to preview an Email Template. You simply pass all of the information for the Email Template in the request and rendered version of the Email is sent back to you in the response. The Email Template in the request does not need to be completely filled out either. You can send in a partial Email Template and the response will contain only what you provided.

6.1. Request

Preview an Email Template

URI

POST /api/email/template/preview

Table 15. Request Body

emailTemplate.defaultFromName [String (FreeMarker Enabled)] Required

The default From Name used when sending emails. This is the display name part of the email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.defaultHtmlTemplate [String (FreeMarker Enabled)] Required

The default HTML Email Template.

emailTemplate.defaultSubject [String (FreeMarker Enabled)] Required

The default Subject used when sending emails.

emailTemplate.defaultTextTemplate [String (FreeMarker Enabled)] Required

The default Text Email Template.

emailTemplate.fromEmail [String] Required

The email address that this email will be sent from. This is the address part email address (i.e. Brian Pontarelli <brian@inversoft.com>).

emailTemplate.localizedFromNames [Map<Locale,String (FreeMarker Enabled)>] Optional

The From Name used when sending emails to users who speak other languages. This overrides the default From Name based on the user’s list of preferred languages.

emailTemplate.localizedHtmlTemplates [Map<Locale,String (FreeMarker Enabled)>] Optional

The HTML Email Template used when sending emails to users who speak other languages. This overrides the default HTML Email Template based on the user’s list of preferred languages.

emailTemplate.localizedSubjects [Map<Locale,String (FreeMarker Enabled)>] Optional

The Subject used when sending emails to users who speak other languages. This overrides the default Subject based on the user’s list of preferred languages.

emailTemplate.localizedTextTemplates [Map<Locale,String (FreeMarker Enabled)>] Optional

The Text Email Template used when sending emails to users who speak other languages. This overrides the default Text Email Template based on the user’s list of preferred languages.

locale [Locale] Optional

The locale to use when rendering the Email Template. If this is null, the defaults will be used and the localized versions will be ignored.

Example Request JSON
{
  "emailTemplate": {
    "fromEmail": "email@example.com",
    "defaultFromName": "Administrator",
    "defaultSubject": "Hello World",
    "defaultHtmlTemplate": "<p>Hello ${user.username}</p><p>Welcome To Passport!</p>",
    "defaultTextTemplate": "Hello ${user.username},\nWelcome To Passport!",
    "localizedFromNames": {
      "de": "Verwalter",
      "fr": "Administrateur"
    },
    "localizedHtmlTemplates": {
      "de": "<p>Hallo ${user.username}</p><p>Willkommen auf der Passport!<p>",
      "fr": "<p>Bonjour ${user.username}</p><p>Bienvenue à Passport!<p>"
    },
    "localizedTextTemplates": {
      "de": "Hallo ${user.username},\nWillkommen auf der Passport!",
      "fr": "Bonjour ${user.username},\nBienvenue à Passport!"
    },
    "localizedSubjects": {
      "de": "Hallo Welt",
      "fr": "Bonjour le monde"
    }
  },
  "locale": "de"
}

6.2. Response

The response for this API contains the rendered Email and also an Errors that contains any rendering issues Passport found. The template might have syntax or logic errors and Passport will put these errors into the response.

Table 16. Response Codes
Code Description

200

The request was successful. The response will contain a JSON body.

400

The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors.

401

You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication.

402

Your license has expired. The response will be empty. Contact sales@inversoft.com for assistance.

500

There was an internal error. A stack trace is provided and logged in the Passport log files. The response will be empty.

Table 17. Response Body

email.from.address [String]

The email address that this email will be sent from. This is the address part email address (i.e. Brian Pontarelli <brian@inversoft.com>).

email.from.display [String]

The From display name this email will be sent from. This is the name part email address (i.e. Brian Pontarelli <brian@inversoft.com>).

email.html [String]

The HTML Email.

email.subject [String]

The Subject used when sending the email.

email.text [String]

The Text Email.

email.errors [Errors]

An Errors object that contains any errors in the Email Template.

Example Response JSON
{
  "email": {
    "from": {
      "address": "email@example.com",
      "display": "Verwalter"
    },
    "html": "<p>Hallo {{user.username}}</p><p>Willkommen auf der Passport!<p>",
    "subject": "Hallo Welt",
    "text": "Hallo {{user.username}},\nWillkommen auf der Passport!"
  },
  "errors": {

  }
}

7. Send an Email

This API is used to send an Email to one or more users using an Email Template.

7.1. Request

Send an email using a template by Id

URI

POST /api/email/send/{emailTemplateId}

Table 18. Request Parameters

emailTemplateId [UUID] Required

The Id of the Email Template to use to generate the Email from.

Table 19. Request Body

bccAddresses [Array<String>] Optional

A list of email addresses to BCC when sending the Email.

ccAddresses [Array<String>] Optional

A list of email addresses to CC when sending the Email.

requestData [Object] Optional

An optional JSON object that is passed to the Email Template during rendering. The variables in the JSON object will be accessible to the FreeMarker templates of the Email Template.

userIds [Array<UUID>] Required

The list of User Ids to send the Email to. You must specify at least one Id.

Example Request JSON
{
  "bccAddresses": [
    "brian@inversoft.com"
  ],
  "ccAddresses": [
    "james@bond.com"
  ],
  "requestData": {
    "paymentAmount": 42,
    "message": "Thank you for purchasing the answer to the universe. We appreciate your business"
  },
  "userIds": [
    "ce485a91-906f-4615-af75-81d37dc71e90"
  ]
}

7.2. Response

Table 20. Response Codes
Code Description

202

The request was successful. The response will contain a JSON body. If the JSON body is empty the template was rendered correctly and queued to be sent for all user Ids provided. If one or more failed the response will contain errors in the response format documented below.

400

The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors.

401

You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication.

402

Your license has expired. The response will be empty. Contact sales@inversoft.com for assistance.

500

There was an internal error. A stack trace is provided and logged in the Passport log files. The response will be empty.

Table 21. Response Body

results [Map<UUID,Object>]

This is a Mapping between the User Ids that had errors and the errors that were encountered.

results[userId].parseErrors [Map<String,String>]

Contains any parse errors that occurred while parsing the Email Template parts. The key of the Map is the field that failed (i.e. from) and the value is the error message.

results[userId].renderErrors [Map<String,String>]

Contains any template errors that occurred while executing the Email Template parts. The key of the Map is the field that failed (i.e. from) and the value is the error message.

Example Response JSON
{
  "results": {
    "00000000-0000-0001-0000-000000000000": {
      "renderErrors": {
        "html": "freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:\n==> requestData.not  [in nameless template at line 1, column 3]\n\n----\nTip: It's the step after the last dot that caused this error, not those before it.\n----\nTip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use [#if myOptionalVar??]when-present[#else]when-missing[/#if]. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??\n----\n\n----\nFTL stack trace (\"~\" means nesting-related):\n\t- Failed at: ${requestData.not.here}  [in nameless template at line 1, column 1]\n----"
      }
    }
  }
}