Send a test email
Personalizes an email and sends it from the mailbox through the workspace's sending servers, the same way campaign emails and the dashboard's "Send test" are sent. 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 request waits up to about 15 seconds for the send to finish:
200- sent;messageIdis returned.422with codeSEND_FAILED- the mailbox could not send it (e.g. login rejected);messagehas the reason.202- still sending; the email will still go out. PollGET /v1/campaigns/{campaignId}/send-test-email/{jobId}for the result instead of retrying, or the recipient gets a second copy.
The step's saved attachments are included. 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>",
"jobId": "preview_email_665a1b2c3d4e5f6a7b8c9d0e_test_example_com_1730000000000_k3x9q2",
"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": true,
"data": {
"message": "Test email queued; it is still being sent. Check GET /v1/campaigns/{id}/send-test-email/{jobId} for the result.",
"status": "processing",
"jobId": "preview_email_665a1b2c3d4e5f6a7b8c9d0e_test_example_com_1730000000000_k3x9q2",
"recipient": "test@example.com",
"mailbox": "sarah@sendkit.ai",
"lastError": "Invalid login: 535 Authentication failed"
}
}
{
"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"
}
}
{
"success": false,
"error": {
"code": "SEND_FAILED",
"message": "Failed to send test email: Invalid login: 535 Authentication failed",
"jobId": "preview_email_665a1b2c3d4e5f6a7b8c9d0e_test_example_com_1730000000000_k3x9q2",
"recipient": "test@example.com",
"mailbox": "sarah@sendkit.ai"
}
}
/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