Add leads to campaign
Add leads to a campaign using one of three modes:
Mode 1 — Explicit leads (max 5,000 per request):
Provide a leads array with objects containing either leadId (existing lead) or email (creates a new lead if not found).
Mode 2 — Filter-based:
Provide a filters object to match workspace leads by tags, search text, email verification status, country, or specific lead IDs.
Mode 3 — Select all:
Set selectAll: true to add all workspace leads. Use excludeIds to skip specific leads.
Duplicate leads (already in the campaign) are automatically skipped. If the campaign is active, new leads are added with "active" status; otherwise they start as "pending".
curl -X POST "https://api.sendkit.ai/v1/campaigns/example_string/leads" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"leads": [
{
"email": "john@acme.com",
"firstName": "John",
"lastName": "Doe",
"companyName": "Acme Corp"
},
{
"email": "jane@example.com",
"firstName": "Jane"
},
{
"leadId": "665d4e5f6a7b8c9d0e1f2a3b"
}
]
}'
import requests
import json
url = "https://api.sendkit.ai/v1/campaigns/example_string/leads"
headers = {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"leads": [
{
"email": "john@acme.com",
"firstName": "John",
"lastName": "Doe",
"companyName": "Acme Corp"
},
{
"email": "jane@example.com",
"firstName": "Jane"
},
{
"leadId": "665d4e5f6a7b8c9d0e1f2a3b"
}
]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.sendkit.ai/v1/campaigns/example_string/leads", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"leads": [
{
"email": "john@acme.com",
"firstName": "John",
"lastName": "Doe",
"companyName": "Acme Corp"
},
{
"email": "jane@example.com",
"firstName": "Jane"
},
{
"leadId": "665d4e5f6a7b8c9d0e1f2a3b"
}
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"leads": [
{
"email": "john@acme.com",
"firstName": "John",
"lastName": "Doe",
"companyName": "Acme Corp"
},
{
"email": "jane@example.com",
"firstName": "Jane"
},
{
"leadId": "665d4e5f6a7b8c9d0e1f2a3b"
}
]
}`)
req, err := http.NewRequest("POST", "https://api.sendkit.ai/v1/campaigns/example_string/leads", 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/leads')
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 = '{
"leads": [
{
"email": "john@acme.com",
"firstName": "John",
"lastName": "Doe",
"companyName": "Acme Corp"
},
{
"email": "jane@example.com",
"firstName": "Jane"
},
{
"leadId": "665d4e5f6a7b8c9d0e1f2a3b"
}
]
}'
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"added": 2,
"skipped": 1,
"errors": [
{
"entry": {
"email": "invalid@"
},
"message": "Either leadId or email is required"
}
]
}
}
{
"success": true,
"data": {
"added": 45,
"skipped": 5,
"matched": 50
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Provide leads array, filters, or selectAll: true"
}
}
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Campaign not found"
}
}
/v1/campaigns/{id}/leadsPlatform API key (sk_user_...) or Workspace API key (sk_...)
Resource ID
The media type of the request body
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
Raw application/json data
Responses
Last updated today
Built with Documentation.AI