Sending with a template

Sending emails through dynamic templates is one of the main uses of Waypoint. To send an email through a dynamic template, you can use the API call below. Within the call, you can pass data variables that are accessible from your template.

💡 New to using APIs? We recommend viewing our quick start guide with more in-depth descriptions and examples.

POST /v1/email_messages

PropertyDescription
templateIdThe id of the template you want to send (created on the Waypoint dashboard). You can find the template ID from on each template from your templates page or grab it from the template URL. eg. wptemplate_ABc123XYZ
groupIdOptional – unsubscribe group ID
groupKeyOptional – unsubscribe group custom key
variablesOptional – JSON data object that is passed to the template and available as variables on the template.
toEmail address of the receiver(s). It can be an email address or use the “Display Name <email address>” format. Separate multiple email addresses in comma separated string for multiple emails (eg. "joe@example.com, jane@example.com"). Max 50 recipients per message.
fromOptional – email address of the sender. This will override a sender that has been set from the template builder and the email domain must be a verified domain within your workspace. Email address can be a string or with a name with email using the “Display Name <email address>” format.
ccOptional – email address of the receiver(s) that should be CC'd. Use the same format as 'to' attribute.
bccOptional – email address of the receiver(s) that should be BCC'd. Use the same format as 'to' attribute.
metaIdOptional – can be used for internal reference or idempotent requests. Eg. 'order_1234'.

Code examples

💡 Use Node.js? Write even less code in your codebase by using the Waypoint npm package.

const axios = require('axios'); axios({ method: "post", url: "https://live.waypointapi.com/v1/email_messages", headers: { "Content-Type": "application/json" }, auth: { username: API_KEY_USERNAME, password: API_KEY_PASSWORD }, data: { "templateId": "wptemplate_ABc123XYZ", "to": "jordan@usewaypoint.com", "variables": { "user": { "displayName": "Jordan", } "product": { "title": "Beechers Mac & Cheese", "id": "02934203942" } } } }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); })

View a more in depth guide on triggering a template using Node.js, Axios, and Replit.

curl "https://live.waypointapi.com/v1/email_messages" \ -H "Content-Type: application/json" \ -u "API_KEY_USERNAME:API_KEY_PASSWORD" \ -d '{ "templateId": "wptemplate_ABc123XYZ", "to": "jordan@usewaypoint.com", "variables": { "user": { "displayName": "Jordan" }, "product": { "title": "Beechers Mac & Cheese", "id": "02934203942" } } }'

If you are looking to send test emails (not actually deliver the email), see API sandbox requests.