curl --request POST \
--url https://api.hubapi.com/email/public/v1/singleEmail/send \
--header 'Content-Type: application/json' \
--data '
{
"emailId": 123,
"message": {
"to": "<string>",
"from": "<string>",
"sendId": "<string>",
"replyTo": "<string>",
"replyToList": [
"<string>"
],
"cc": [
"<string>"
],
"bcc": [
"<string>"
]
},
"contactProperties": [
{
"name": "<string>",
"value": "<string>"
}
],
"customProperties": [
{
"name": "<string>",
"value": "<string>"
}
]
}
'import requests
url = "https://api.hubapi.com/email/public/v1/singleEmail/send"
payload = {
"emailId": 123,
"message": {
"to": "<string>",
"from": "<string>",
"sendId": "<string>",
"replyTo": "<string>",
"replyToList": ["<string>"],
"cc": ["<string>"],
"bcc": ["<string>"]
},
"contactProperties": [
{
"name": "<string>",
"value": "<string>"
}
],
"customProperties": [
{
"name": "<string>",
"value": "<string>"
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
emailId: 123,
message: {
to: '<string>',
from: '<string>',
sendId: '<string>',
replyTo: '<string>',
replyToList: ['<string>'],
cc: ['<string>'],
bcc: ['<string>']
},
contactProperties: [{name: '<string>', value: '<string>'}],
customProperties: [{name: '<string>', value: '<string>'}]
})
};
fetch('https://api.hubapi.com/email/public/v1/singleEmail/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hubapi.com/email/public/v1/singleEmail/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'emailId' => 123,
'message' => [
'to' => '<string>',
'from' => '<string>',
'sendId' => '<string>',
'replyTo' => '<string>',
'replyToList' => [
'<string>'
],
'cc' => [
'<string>'
],
'bcc' => [
'<string>'
]
],
'contactProperties' => [
[
'name' => '<string>',
'value' => '<string>'
]
],
'customProperties' => [
[
'name' => '<string>',
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hubapi.com/email/public/v1/singleEmail/send"
payload := strings.NewReader("{\n \"emailId\": 123,\n \"message\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"sendId\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"replyToList\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ]\n },\n \"contactProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hubapi.com/email/public/v1/singleEmail/send")
.header("Content-Type", "application/json")
.body("{\n \"emailId\": 123,\n \"message\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"sendId\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"replyToList\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ]\n },\n \"contactProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hubapi.com/email/public/v1/singleEmail/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"emailId\": 123,\n \"message\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"sendId\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"replyToList\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ]\n },\n \"contactProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"eventId": {
"id": "<string>",
"created": 123
}
}{
"category": "<string>",
"correlationId": "<string>",
"message": "<string>",
"subCategory": "<string>",
"errors": [
{
"message": "<string>",
"in": "<string>",
"code": "<string>",
"subCategory": "<string>",
"context": {}
}
],
"context": {},
"links": {}
}Send a single transactional email
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.
curl --request POST \
--url https://api.hubapi.com/email/public/v1/singleEmail/send \
--header 'Content-Type: application/json' \
--data '
{
"emailId": 123,
"message": {
"to": "<string>",
"from": "<string>",
"sendId": "<string>",
"replyTo": "<string>",
"replyToList": [
"<string>"
],
"cc": [
"<string>"
],
"bcc": [
"<string>"
]
},
"contactProperties": [
{
"name": "<string>",
"value": "<string>"
}
],
"customProperties": [
{
"name": "<string>",
"value": "<string>"
}
]
}
'import requests
url = "https://api.hubapi.com/email/public/v1/singleEmail/send"
payload = {
"emailId": 123,
"message": {
"to": "<string>",
"from": "<string>",
"sendId": "<string>",
"replyTo": "<string>",
"replyToList": ["<string>"],
"cc": ["<string>"],
"bcc": ["<string>"]
},
"contactProperties": [
{
"name": "<string>",
"value": "<string>"
}
],
"customProperties": [
{
"name": "<string>",
"value": "<string>"
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
emailId: 123,
message: {
to: '<string>',
from: '<string>',
sendId: '<string>',
replyTo: '<string>',
replyToList: ['<string>'],
cc: ['<string>'],
bcc: ['<string>']
},
contactProperties: [{name: '<string>', value: '<string>'}],
customProperties: [{name: '<string>', value: '<string>'}]
})
};
fetch('https://api.hubapi.com/email/public/v1/singleEmail/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hubapi.com/email/public/v1/singleEmail/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'emailId' => 123,
'message' => [
'to' => '<string>',
'from' => '<string>',
'sendId' => '<string>',
'replyTo' => '<string>',
'replyToList' => [
'<string>'
],
'cc' => [
'<string>'
],
'bcc' => [
'<string>'
]
],
'contactProperties' => [
[
'name' => '<string>',
'value' => '<string>'
]
],
'customProperties' => [
[
'name' => '<string>',
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hubapi.com/email/public/v1/singleEmail/send"
payload := strings.NewReader("{\n \"emailId\": 123,\n \"message\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"sendId\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"replyToList\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ]\n },\n \"contactProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hubapi.com/email/public/v1/singleEmail/send")
.header("Content-Type", "application/json")
.body("{\n \"emailId\": 123,\n \"message\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"sendId\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"replyToList\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ]\n },\n \"contactProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hubapi.com/email/public/v1/singleEmail/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"emailId\": 123,\n \"message\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"sendId\": \"<string>\",\n \"replyTo\": \"<string>\",\n \"replyToList\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ]\n },\n \"contactProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"customProperties\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"eventId": {
"id": "<string>",
"created": 123
}
}{
"category": "<string>",
"correlationId": "<string>",
"message": "<string>",
"subCategory": "<string>",
"errors": [
{
"message": "<string>",
"in": "<string>",
"code": "<string>",
"subCategory": "<string>",
"context": {}
}
],
"context": {},
"links": {}
}Scope requirements
Scope requirements
ボディ
The ID of the email to send. This is content ID for the transactional email, which can be found in email tool UI.
Show child attributes
Show child attributes
A list of JSON objects representing contact property values to set when sending the email.
Show child attributes
Show child attributes
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.
Show child attributes
Show child attributes
レスポンス
Email send request processed
The result of the send operation
SENT, QUEUED, PORTAL_SUSPENDED, INVALID_TO_ADDRESS, BLOCKED_DOMAIN, PREVIOUSLY_BOUNCED, PREVIOUS_SPAM, INVALID_FROM_ADDRESS, MISSING_CONTENT, MISSING_TEMPLATE_PROPERTIES A description of the send result details
If sent, the id and created timestamp of the sent event
Show child attributes
Show child attributes