Send a preview of an email message
curl --request POST \
--url https://app.loops.so/api/v1/email-messages/{emailMessageId}/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
"alex@company.com"
],
"contactProperties": {
"firstName": "Alex"
},
"eventProperties": {
"planName": "Pro"
},
"dataVariables": {
"loginUrl": "https://app.company.com/login"
}
}
'import requests
url = "https://app.loops.so/api/v1/email-messages/{emailMessageId}/preview"
payload = {
"emails": ["alex@company.com"],
"contactProperties": { "firstName": "Alex" },
"eventProperties": { "planName": "Pro" },
"dataVariables": { "loginUrl": "https://app.company.com/login" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
emails: ['alex@company.com'],
contactProperties: {firstName: 'Alex'},
eventProperties: {planName: 'Pro'},
dataVariables: {loginUrl: 'https://app.company.com/login'}
})
};
fetch('https://app.loops.so/api/v1/email-messages/{emailMessageId}/preview', 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://app.loops.so/api/v1/email-messages/{emailMessageId}/preview",
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([
'emails' => [
'alex@company.com'
],
'contactProperties' => [
'firstName' => 'Alex'
],
'eventProperties' => [
'planName' => 'Pro'
],
'dataVariables' => [
'loginUrl' => 'https://app.company.com/login'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://app.loops.so/api/v1/email-messages/{emailMessageId}/preview"
payload := strings.NewReader("{\n \"emails\": [\n \"alex@company.com\"\n ],\n \"contactProperties\": {\n \"firstName\": \"Alex\"\n },\n \"eventProperties\": {\n \"planName\": \"Pro\"\n },\n \"dataVariables\": {\n \"loginUrl\": \"https://app.company.com/login\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.loops.so/api/v1/email-messages/{emailMessageId}/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n \"alex@company.com\"\n ],\n \"contactProperties\": {\n \"firstName\": \"Alex\"\n },\n \"eventProperties\": {\n \"planName\": \"Pro\"\n },\n \"dataVariables\": {\n \"loginUrl\": \"https://app.company.com/login\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.loops.so/api/v1/email-messages/{emailMessageId}/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n \"alex@company.com\"\n ],\n \"contactProperties\": {\n \"firstName\": \"Alex\"\n },\n \"eventProperties\": {\n \"planName\": \"Pro\"\n },\n \"dataVariables\": {\n \"loginUrl\": \"https://app.company.com/login\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "cle5f7g9h1i3j5k7l9m1n3p5"
}{
"message": "Email message not found."
}{
"message": "Email message not found."
}{
"message": "Email message not found."
}Email messages
Send a preview of an email message
Send a test preview of an email message to one or more addresses.
POST
/
v1
/
email-messages
/
{emailMessageId}
/
preview
Send a preview of an email message
curl --request POST \
--url https://app.loops.so/api/v1/email-messages/{emailMessageId}/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
"alex@company.com"
],
"contactProperties": {
"firstName": "Alex"
},
"eventProperties": {
"planName": "Pro"
},
"dataVariables": {
"loginUrl": "https://app.company.com/login"
}
}
'import requests
url = "https://app.loops.so/api/v1/email-messages/{emailMessageId}/preview"
payload = {
"emails": ["alex@company.com"],
"contactProperties": { "firstName": "Alex" },
"eventProperties": { "planName": "Pro" },
"dataVariables": { "loginUrl": "https://app.company.com/login" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
emails: ['alex@company.com'],
contactProperties: {firstName: 'Alex'},
eventProperties: {planName: 'Pro'},
dataVariables: {loginUrl: 'https://app.company.com/login'}
})
};
fetch('https://app.loops.so/api/v1/email-messages/{emailMessageId}/preview', 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://app.loops.so/api/v1/email-messages/{emailMessageId}/preview",
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([
'emails' => [
'alex@company.com'
],
'contactProperties' => [
'firstName' => 'Alex'
],
'eventProperties' => [
'planName' => 'Pro'
],
'dataVariables' => [
'loginUrl' => 'https://app.company.com/login'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://app.loops.so/api/v1/email-messages/{emailMessageId}/preview"
payload := strings.NewReader("{\n \"emails\": [\n \"alex@company.com\"\n ],\n \"contactProperties\": {\n \"firstName\": \"Alex\"\n },\n \"eventProperties\": {\n \"planName\": \"Pro\"\n },\n \"dataVariables\": {\n \"loginUrl\": \"https://app.company.com/login\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.loops.so/api/v1/email-messages/{emailMessageId}/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n \"alex@company.com\"\n ],\n \"contactProperties\": {\n \"firstName\": \"Alex\"\n },\n \"eventProperties\": {\n \"planName\": \"Pro\"\n },\n \"dataVariables\": {\n \"loginUrl\": \"https://app.company.com/login\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.loops.so/api/v1/email-messages/{emailMessageId}/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n \"alex@company.com\"\n ],\n \"contactProperties\": {\n \"firstName\": \"Alex\"\n },\n \"eventProperties\": {\n \"planName\": \"Pro\"\n },\n \"dataVariables\": {\n \"loginUrl\": \"https://app.company.com/login\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "cle5f7g9h1i3j5k7l9m1n3p5"
}{
"message": "Email message not found."
}{
"message": "Email message not found."
}{
"message": "Email message not found."
}Send a test email message to one or more addresses. Accepted variable fields depend on the parent’s type:
- Campaign accepts
contactProperties. - Workflow accepts
contactPropertiesandeventProperties. - Transactional accepts
dataVariables.
400 Bad Request error.
Each team can send up to 100 preview emails per day.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the email message.
Example:
"cle5f7g9h1i3j5k7l9m1n3p5"
Body
application/json
One or more addresses to send the preview to.
Minimum array length:
1Contact property values to render. Accepted for campaign and workflow previews.
Show child attributes
Show child attributes
Example:
{ "firstName": "Alex" }
Event property values to render. Accepted for workflow previews only.
Show child attributes
Show child attributes
Example:
{ "planName": "Pro" }
Transactional data variables to render. Accepted for transactional previews only.
Show child attributes
Show child attributes
Example:
{
"loginUrl": "https://app.company.com/login"
}
Response
Preview scheduled.
The ID of the email message the preview was sent for.
Example:
"cle5f7g9h1i3j5k7l9m1n3p5"
Last modified on July 20, 2026
Was this page helpful?
⌘I

