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" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"sequenceStep": 0,
"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",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"sequenceStep": 0,
"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",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"sequenceStep": 0,
"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": 0,
"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")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
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['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"sequenceStep": 0,
"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/{id}/send-test-emailPlatform API key (sk_user_...) or Workspace API key (sk_...)
Resource ID
The media type of the request body
Zero-based index of the sequence step
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 (e.g. {"firstName":"John"})
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_...)
Bearer token. API key as Bearer token
Path Parameters
Resource ID
Body
Zero-based index of the sequence step
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 (e.g. \\{"firstName":"John"\\})
A/B variant label
Override step content for unsaved drafts
Responses
Last updated today
Built with Documentation.AI