Send a test email
Personalizes an email and sends it synchronously via SMTP. Supports two modes:
- Send to lead: Provide
leadId- email is personalized with lead data and sent to the lead's email. - Send to custom email: Provide
customEmailand optionallycustomVariables- useful for testing with your own inbox.
The email is sent synchronously - the response confirms delivery. Counts toward email usage quota. Requires an active subscription.
curl -X POST "https://api.sendkit.ai/v1/campaigns/example_string/send-test-email" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"sequenceStep": 1,
"mailboxId": "665b1c2d3e4f5a6b7c8d9e0f",
"customEmail": "test@example.com",
"customVariables": {
"firstName": "John",
"company": "Acme Corp"
}
}'
import requests
import json
url = "https://api.sendkit.ai/v1/campaigns/example_string/send-test-email"
headers = {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
data = {
"sequenceStep": 1,
"mailboxId": "665b1c2d3e4f5a6b7c8d9e0f",
"customEmail": "test@example.com",
"customVariables": {
"firstName": "John",
"company": "Acme Corp"
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.sendkit.ai/v1/campaigns/example_string/send-test-email", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"sequenceStep": 1,
"mailboxId": "665b1c2d3e4f5a6b7c8d9e0f",
"customEmail": "test@example.com",
"customVariables": {
"firstName": "John",
"company": "Acme Corp"
}
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"sequenceStep": 1,
"mailboxId": "665b1c2d3e4f5a6b7c8d9e0f",
"customEmail": "test@example.com",
"customVariables": {
"firstName": "John",
"company": "Acme Corp"
}
}`)
req, err := http.NewRequest("POST", "https://api.sendkit.ai/v1/campaigns/example_string/send-test-email", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.sendkit.ai/v1/campaigns/example_string/send-test-email')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-Api-Key'] = 'YOUR_API_KEY'
request.body = '{
"sequenceStep": 1,
"mailboxId": "665b1c2d3e4f5a6b7c8d9e0f",
"customEmail": "test@example.com",
"customVariables": {
"firstName": "John",
"company": "Acme Corp"
}
}'
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"message": "Test email sent successfully",
"messageId": "<abc123@smtp.gmail.com>",
"recipient": "test@example.com",
"mailbox": "sarah@sendkit.ai",
"preview": {
"subject": "Quick question, John",
"body": "<p>Hi John,</p><p>I noticed Acme Corp is growing fast...</p>",
"text": "Hi John,
I noticed Acme Corp is growing fast..."
}
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "sequenceStep and mailboxId are required"
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Either leadId or customEmail is required"
}
}
{
"success": false,
"error": {
"code": "SUBSCRIPTION_INACTIVE",
"message": "Active subscription required to send test emails"
}
}
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Email limit exceeded. Usage: 1000/1000"
}
}
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Campaign not found"
}
}
/v1/campaigns/{campaignId}/send-test-emailTarget server for requests. Edit to use your own host.
Platform API key (sk_user_...) or Workspace API key (sk_...)
Campaign ID
The media type of the request body
1-based index of the email step to send (only counts email steps, skips wait steps)
Mailbox to send from
Lead ID - send to this lead's email with their data
Custom recipient email (alternative to leadId)
Variable values when using customEmail
A/B variant label
Override step content for unsaved drafts
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Platform API key (sk_user_...) or Workspace API key (sk_...)
Path Parameters
Campaign ID
Body
1-based index of the email step to send (only counts email steps, skips wait steps)
1Mailbox to send from
Lead ID - send to this lead's email with their data
Custom recipient email (alternative to leadId)
Variable values when using customEmail
A/B variant label
Override step content for unsaved drafts
Responses
SMTP message ID
Email address the test was sent to
Sender mailbox email
HTML body (only if HTML formatting detected)
Plain text version
Missing required fields or invalid configuration
Subscription inactive or email limit exceeded
Campaign, mailbox, or lead not found