curl --request POST \
--url https://api.mailbeast.ai/v1/campaigns/{id}/test-email \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"variantId": "550e8400-e29b-41d4-a716-446655440000",
"accountId": "3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93",
"recipient": "[email protected]",
"personalization": "dummy",
"leadId": "c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37"
}
'import requests
url = "https://api.mailbeast.ai/v1/campaigns/{id}/test-email"
payload = {
"variantId": "550e8400-e29b-41d4-a716-446655440000",
"accountId": "3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93",
"recipient": "[email protected]",
"personalization": "dummy",
"leadId": "c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37"
}
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({
variantId: '550e8400-e29b-41d4-a716-446655440000',
accountId: '3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93',
recipient: '[email protected]',
personalization: 'dummy',
leadId: 'c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37'
})
};
fetch('https://api.mailbeast.ai/v1/campaigns/{id}/test-email', 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.mailbeast.ai/v1/campaigns/{id}/test-email",
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([
'variantId' => '550e8400-e29b-41d4-a716-446655440000',
'accountId' => '3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93',
'recipient' => '[email protected]',
'personalization' => 'dummy',
'leadId' => 'c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37'
]),
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://api.mailbeast.ai/v1/campaigns/{id}/test-email"
payload := strings.NewReader("{\n \"variantId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"accountId\": \"3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93\",\n \"recipient\": \"[email protected]\",\n \"personalization\": \"dummy\",\n \"leadId\": \"c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37\"\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://api.mailbeast.ai/v1/campaigns/{id}/test-email")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variantId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"accountId\": \"3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93\",\n \"recipient\": \"[email protected]\",\n \"personalization\": \"dummy\",\n \"leadId\": \"c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mailbeast.ai/v1/campaigns/{id}/test-email")
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 \"variantId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"accountId\": \"3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93\",\n \"recipient\": \"[email protected]\",\n \"personalization\": \"dummy\",\n \"leadId\": \"c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37\"\n}"
response = http.request(request)
puts response.read_body{
"sent": true,
"messageId": "<[email protected]>"
}{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "One or more fields are invalid.",
"status": 400,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f",
"details": [
"name should not be empty"
]
}
}{
"error": {
"type": "authentication_error",
"code": "unauthenticated",
"message": "Missing or invalid API key.",
"status": 401,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "authorization_error",
"code": "permission_denied",
"message": "This API key is missing the required scope.",
"status": 403,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "not_found",
"message": "Resource not found.",
"status": 404,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "conflict",
"message": "The request conflicts with an existing resource.",
"status": 409,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "idempotency_key_reused",
"message": "The Idempotency-Key was already used with a different request body. Use a new key for a new operation.",
"status": 422,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Too many requests. Retry after the interval in the Retry-After header.",
"status": 429,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f",
"retryAfter": 30
}
}{
"error": {
"type": "api_error",
"code": "upstream_unavailable",
"message": "A dependency is temporarily unavailable.",
"status": 503,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}Send a test email
Send yourself a rendered preview of one step variant before launching. It goes from a real mailbox and counts toward that mailbox’s daily limit, but not your monthly quota. Capped at 12 per day per workspace.
Requires one of the following scopes: campaigns:lifecycle, campaigns:all, all:all.
curl --request POST \
--url https://api.mailbeast.ai/v1/campaigns/{id}/test-email \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"variantId": "550e8400-e29b-41d4-a716-446655440000",
"accountId": "3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93",
"recipient": "[email protected]",
"personalization": "dummy",
"leadId": "c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37"
}
'import requests
url = "https://api.mailbeast.ai/v1/campaigns/{id}/test-email"
payload = {
"variantId": "550e8400-e29b-41d4-a716-446655440000",
"accountId": "3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93",
"recipient": "[email protected]",
"personalization": "dummy",
"leadId": "c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37"
}
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({
variantId: '550e8400-e29b-41d4-a716-446655440000',
accountId: '3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93',
recipient: '[email protected]',
personalization: 'dummy',
leadId: 'c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37'
})
};
fetch('https://api.mailbeast.ai/v1/campaigns/{id}/test-email', 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.mailbeast.ai/v1/campaigns/{id}/test-email",
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([
'variantId' => '550e8400-e29b-41d4-a716-446655440000',
'accountId' => '3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93',
'recipient' => '[email protected]',
'personalization' => 'dummy',
'leadId' => 'c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37'
]),
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://api.mailbeast.ai/v1/campaigns/{id}/test-email"
payload := strings.NewReader("{\n \"variantId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"accountId\": \"3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93\",\n \"recipient\": \"[email protected]\",\n \"personalization\": \"dummy\",\n \"leadId\": \"c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37\"\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://api.mailbeast.ai/v1/campaigns/{id}/test-email")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variantId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"accountId\": \"3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93\",\n \"recipient\": \"[email protected]\",\n \"personalization\": \"dummy\",\n \"leadId\": \"c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mailbeast.ai/v1/campaigns/{id}/test-email")
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 \"variantId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"accountId\": \"3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93\",\n \"recipient\": \"[email protected]\",\n \"personalization\": \"dummy\",\n \"leadId\": \"c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37\"\n}"
response = http.request(request)
puts response.read_body{
"sent": true,
"messageId": "<[email protected]>"
}{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "One or more fields are invalid.",
"status": 400,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f",
"details": [
"name should not be empty"
]
}
}{
"error": {
"type": "authentication_error",
"code": "unauthenticated",
"message": "Missing or invalid API key.",
"status": 401,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "authorization_error",
"code": "permission_denied",
"message": "This API key is missing the required scope.",
"status": 403,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "not_found",
"message": "Resource not found.",
"status": 404,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "conflict",
"message": "The request conflicts with an existing resource.",
"status": 409,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "invalid_request_error",
"code": "idempotency_key_reused",
"message": "The Idempotency-Key was already used with a different request body. Use a new key for a new operation.",
"status": 422,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Too many requests. Retry after the interval in the Retry-After header.",
"status": 429,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f",
"retryAfter": 30
}
}{
"error": {
"type": "api_error",
"code": "upstream_unavailable",
"message": "A dependency is temporarily unavailable.",
"status": 503,
"requestId": "e4f1c0b2-6a3d-4b8e-9f21-0a1b2c3d4e5f"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Optional. A unique key you generate (max 255 chars, such as a UUID) that makes this request safe to retry. Retrying with the same key replays the original response instead of repeating the operation. Reusing a key with a different body returns 422.
255"a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Path Parameters
"a7d4e2f1-08b3-4c65-9e7a-1b2c3d4e5f60"
Body
The step variant to render. Take it from the campaign detail view.
"550e8400-e29b-41d4-a716-446655440000"
The mailbox to send from. It must be one of yours and within its daily limit.
"3f1c2b7e-9a4d-4e18-b2c1-6d8f5a0e7c93"
Where to send the test. A single address. It is refused if the address, or its domain, is on your blacklist.
Where merge variables come from. dummy fills placeholders. lead uses a real lead, named by leadId. There is no fallback: lead without leadId is rejected.
dummy, lead "dummy"
The lead whose data fills the merge variables. Required when personalization is lead, and must be omitted otherwise.
"c9e5b1a3-7f24-4d80-a6b9-2e4f8c0d1a37"
Response
The test email was handed to the mail server.
true
RFC 5322 Message-ID assigned by the sending server. null if the server did not return one.