curl --request POST \
--url https://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"members": [
{
"email": "jane@example.com"
},
{
"email": "john@example.com",
"status": "Attended"
},
{
"email": "sam@example.com",
"statusId": "8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c"
}
]
}
'import requests
url = "https://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch"
payload = { "members": [
{ "email": "jane@example.com" },
{
"email": "john@example.com",
"status": "Attended"
},
{
"email": "sam@example.com",
"statusId": "8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c"
}
] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
members: [
{email: 'jane@example.com'},
{email: 'john@example.com', status: 'Attended'},
{email: 'sam@example.com', statusId: '8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c'}
]
})
};
fetch('https://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch', 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://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch",
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([
'members' => [
[
'email' => 'jane@example.com'
],
[
'email' => 'john@example.com',
'status' => 'Attended'
],
[
'email' => 'sam@example.com',
'statusId' => '8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch"
payload := strings.NewReader("{\n \"members\": [\n {\n \"email\": \"jane@example.com\"\n },\n {\n \"email\": \"john@example.com\",\n \"status\": \"Attended\"\n },\n {\n \"email\": \"sam@example.com\",\n \"statusId\": \"8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"members\": [\n {\n \"email\": \"jane@example.com\"\n },\n {\n \"email\": \"john@example.com\",\n \"status\": \"Attended\"\n },\n {\n \"email\": \"sam@example.com\",\n \"statusId\": \"8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"members\": [\n {\n \"email\": \"jane@example.com\"\n },\n {\n \"email\": \"john@example.com\",\n \"status\": \"Attended\"\n },\n {\n \"email\": \"sam@example.com\",\n \"statusId\": \"8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"processed": 2,
"succeeded": 1,
"failed": 1,
"results": [
{
"email": "jane@example.com",
"success": true,
"campaignMemberId": "0a1b2c3d-4e5f-4a6b-8c7d-8e9f0a1b2c3d",
"contactId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
{
"email": "john@example.com",
"success": false,
"error": "invalid_campaign_status",
"message": "status is not valid for this campaign"
}
]
}
}{
"error": {
"code": "invalid_request",
"message": "request validation failed"
}
}{
"error": {
"code": "unauthorized",
"message": "API key is required"
}
}{
"error": {
"code": "campaign_not_found",
"message": "campaign not found"
}
}{
"error": {
"code": "internal_error",
"message": "failed to add campaign members"
}
}Batch Add Campaign Members
Add up to 200 members to a custom campaign by email, creating contacts that do not exist yet. Adding is an idempotent upsert: a contact already in the campaign has its status updated instead of being added twice.
Status progression is forward-only for existing members; requesting their current or an earlier status leaves it unchanged. Set a status by statusId or status from GET /v2/campaigns/{campaignId}, or omit both to use the campaign type’s first status. Members are processed independently, so one can fail while the rest of the batch succeeds.
curl --request POST \
--url https://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"members": [
{
"email": "jane@example.com"
},
{
"email": "john@example.com",
"status": "Attended"
},
{
"email": "sam@example.com",
"statusId": "8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c"
}
]
}
'import requests
url = "https://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch"
payload = { "members": [
{ "email": "jane@example.com" },
{
"email": "john@example.com",
"status": "Attended"
},
{
"email": "sam@example.com",
"statusId": "8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c"
}
] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
members: [
{email: 'jane@example.com'},
{email: 'john@example.com', status: 'Attended'},
{email: 'sam@example.com', statusId: '8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c'}
]
})
};
fetch('https://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch', 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://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch",
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([
'members' => [
[
'email' => 'jane@example.com'
],
[
'email' => 'john@example.com',
'status' => 'Attended'
],
[
'email' => 'sam@example.com',
'statusId' => '8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch"
payload := strings.NewReader("{\n \"members\": [\n {\n \"email\": \"jane@example.com\"\n },\n {\n \"email\": \"john@example.com\",\n \"status\": \"Attended\"\n },\n {\n \"email\": \"sam@example.com\",\n \"statusId\": \"8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"members\": [\n {\n \"email\": \"jane@example.com\"\n },\n {\n \"email\": \"john@example.com\",\n \"status\": \"Attended\"\n },\n {\n \"email\": \"sam@example.com\",\n \"statusId\": \"8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pub-api.conversion.ai/api/v2/campaigns/{campaignId}/members/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"members\": [\n {\n \"email\": \"jane@example.com\"\n },\n {\n \"email\": \"john@example.com\",\n \"status\": \"Attended\"\n },\n {\n \"email\": \"sam@example.com\",\n \"statusId\": \"8f9a0b1c-2d3e-4f4a-9b5c-6d7e8f9a0b1c\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"processed": 2,
"succeeded": 1,
"failed": 1,
"results": [
{
"email": "jane@example.com",
"success": true,
"campaignMemberId": "0a1b2c3d-4e5f-4a6b-8c7d-8e9f0a1b2c3d",
"contactId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
{
"email": "john@example.com",
"success": false,
"error": "invalid_campaign_status",
"message": "status is not valid for this campaign"
}
]
}
}{
"error": {
"code": "invalid_request",
"message": "request validation failed"
}
}{
"error": {
"code": "unauthorized",
"message": "API key is required"
}
}{
"error": {
"code": "campaign_not_found",
"message": "campaign not found"
}
}{
"error": {
"code": "internal_error",
"message": "failed to add campaign members"
}
}Authorizations
Your Conversion API key. Found in Settings > Integrations in the dashboard. Format: sk_live_<key_id>_<secret>.
Path Parameters
The Conversion campaign id, as returned by GET /v2/campaigns.
Body
An array of members to add to the campaign.
1 - 200 elementsShow child attributes
Show child attributes
Response
Batch processed. Check the counts and each result for per-member success or failure.
Show child attributes
Show child attributes
Was this page helpful?