There's a new version of the HubSpot API
We're also working on a new documentation website, you're invited to check it out and give us your feedback.
HTTP Methods:
POST
Content Type:
application/json
Response Format:
json
Requires Authentication?
Yes
Rate Limited?
Headers
Products:
Marketing
Required Scope:
Please note: The use of this API requires the Transactional Email add-on.
This method is used to send an email designed in the marketing email tool.
After you design and publish a transactional email in your HubSpot account, you can use this API to include customization options to the email, then send it to the intended recipient. The Email ID provided in the marketing email tool specifies which template to include in your API request.
Any emails sent through this API will automatically be associated with contact records based on the email address. If there is no contact with a matching email address, a new contact with that email will be created. Note: If you want to send emails without creating contacts, use the SMTP API.
Use case for this API: This capability would be useful in a situation where an event on an external system should trigger an email send, for example.
First, design your transactional email in your HubSpot account using the email editor tool:
Review the other parameters available in the table below.
Required parameters | How to use | Description |
---|---|---|
OAuth access token or private app access token | Authorization: Bearer {token} header | Used to authenticate the request. Please see this page for more details about authentication. |
Email ID | Used in the request body JSON (see below) | The ID of the email to send, from the email tool when viewing a transactional email. |
Message | Used in the request body JSON (see below) | A JSON object holding the recipient (in its to field) as well as other customizations that can be made on the fly. (See below.) |
Optional parameters | How to use | Description |
---|---|---|
Contact properties | Used in the request body JSON (see below) | A list of JSON objects representing contact property values to set when sending
the email. Useful if you have more information about the contact when
sending the email. You can get the full list of available contact properties and their names using the Contact Properties API. |
Custom properties | Used in the request body JSON (see examples below) | A list of JSON objects representing property values to set when sending the email. Useful if you have context in the email you don't want to set on the contact record. |
Other message options | Used in the request body JSON | Other data about the email you want to send. |
The request body must be a JSON-formatted object with the properties listed above.
The emailId field is the content ID for the transactional email, which can be found in email tool UI.
The message field is a JSON object containing anything that you want to override. At the minimum, the to field must be present.
Message object fields:
"from":"Sender Name <sender@hubspot.com>"
The contactProperties field is a JSON array of contact property values. Each contact property value contains a name and value property. Each property will get set on the contact record and will be visible in the template under {{ contact.NAME }}. Use these properties when you want to set a contact property while you’re sending the email. For example, when sending a receipt you may want to set a last_paid_date property, as the sending of the receipt will have information about the last payment.
The customProperties field is a JSON array of property values. Each property value contains a name and value property. Each property will be visible in the template under {{ custom.NAME }}.
Note: Custom properties do not currently support arrays. To provide a listing in an email, one workaround is to build an HTML list (either with tables or ul) and specify it as a custom property.
Note: Custom properties are not stored in HubSpot, and will only be included in the email sent to the contact. These properties will not appear in the web page version of the email, or in the view of the email from the contact's timeline.
abuse
, no-reply
, noreply
, root
, spam
, security
, undisclosed-recipients
, unsubscribe
, inoc
, postmaster
, or privacy
.customProperties
sent in the request.Example URL to POST to: https://api.hubapi.com/email/public/v1/singleEmail/send