Replace Campaign Senders
curl --request PUT \
--url https://api.lemlist.com/api/campaigns/{campaignId}/senders \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"senders": [
{
"userId": "usr_A1b2C3d4E5f6G7h8N",
"channels": [
{
"type": "email",
"id": "usm_A1b2C3d4E5f6G7h8P"
}
]
}
]
}
'import requests
url = "https://api.lemlist.com/api/campaigns/{campaignId}/senders"
payload = { "senders": [
{
"userId": "usr_A1b2C3d4E5f6G7h8N",
"channels": [
{
"type": "email",
"id": "usm_A1b2C3d4E5f6G7h8P"
}
]
}
] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
senders: [
{
userId: 'usr_A1b2C3d4E5f6G7h8N',
channels: [{type: 'email', id: 'usm_A1b2C3d4E5f6G7h8P'}]
}
]
})
};
fetch('https://api.lemlist.com/api/campaigns/{campaignId}/senders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/campaigns/{campaignId}/senders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"senders\": [\n {\n \"userId\": \"usr_A1b2C3d4E5f6G7h8N\",\n \"channels\": [\n {\n \"type\": \"email\",\n \"id\": \"usm_A1b2C3d4E5f6G7h8P\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/campaigns/{campaignId}/senders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'senders' => [
[
'userId' => 'usr_A1b2C3d4E5f6G7h8N',
'channels' => [
[
'type' => 'email',
'id' => 'usm_A1b2C3d4E5f6G7h8P'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"campaignId": "cam_A1b2C3d4E5f6G7h8M",
"senderStrategy": "random",
"espMatching": false,
"readOnly": false,
"senders": [
{
"userId": "usr_A1b2C3d4E5f6G7h8N",
"name": "Jane Smith",
"email": "jane@example.com",
"channels": [
{
"type": "email",
"id": "usm_A1b2C3d4E5f6G7h8P",
"label": "jane@example.com",
"alias": "jane@example.com",
"esp": "microsoft",
"diagnostics": []
}
],
"diagnostics": []
}
],
"diagnostics": []
},
"impact": {
"contactedLeads": 12
}
}{
"error": "No step of the campaign uses this channel type. Add a step of this type first",
"code": "SENDER_CAMPAIGN_CHANNEL_TYPE_NOT_REQUIRED"
}The authentication you supplied is incorrectroute is available starting emailPro plan{
"error": "Campaign not found",
"code": "SENDER_CAMPAIGN_NOT_FOUND"
}{
"error": "Route bad method",
"code": "ROUTE_BAD_METHOD"
}{
"error": "The campaign uses a dynamic sender strategy: the leads select the senders",
"code": "SENDER_CAMPAIGN_DYNAMIC_STRATEGY"
}Senders
Replace Campaign Senders
Replaces the sender pool of a campaign.
PUT
/
campaigns
/
{campaignId}
/
senders
Replace Campaign Senders
curl --request PUT \
--url https://api.lemlist.com/api/campaigns/{campaignId}/senders \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"senders": [
{
"userId": "usr_A1b2C3d4E5f6G7h8N",
"channels": [
{
"type": "email",
"id": "usm_A1b2C3d4E5f6G7h8P"
}
]
}
]
}
'import requests
url = "https://api.lemlist.com/api/campaigns/{campaignId}/senders"
payload = { "senders": [
{
"userId": "usr_A1b2C3d4E5f6G7h8N",
"channels": [
{
"type": "email",
"id": "usm_A1b2C3d4E5f6G7h8P"
}
]
}
] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
senders: [
{
userId: 'usr_A1b2C3d4E5f6G7h8N',
channels: [{type: 'email', id: 'usm_A1b2C3d4E5f6G7h8P'}]
}
]
})
};
fetch('https://api.lemlist.com/api/campaigns/{campaignId}/senders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/campaigns/{campaignId}/senders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"senders\": [\n {\n \"userId\": \"usr_A1b2C3d4E5f6G7h8N\",\n \"channels\": [\n {\n \"type\": \"email\",\n \"id\": \"usm_A1b2C3d4E5f6G7h8P\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/campaigns/{campaignId}/senders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'senders' => [
[
'userId' => 'usr_A1b2C3d4E5f6G7h8N',
'channels' => [
[
'type' => 'email',
'id' => 'usm_A1b2C3d4E5f6G7h8P'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"campaignId": "cam_A1b2C3d4E5f6G7h8M",
"senderStrategy": "random",
"espMatching": false,
"readOnly": false,
"senders": [
{
"userId": "usr_A1b2C3d4E5f6G7h8N",
"name": "Jane Smith",
"email": "jane@example.com",
"channels": [
{
"type": "email",
"id": "usm_A1b2C3d4E5f6G7h8P",
"label": "jane@example.com",
"alias": "jane@example.com",
"esp": "microsoft",
"diagnostics": []
}
],
"diagnostics": []
}
],
"diagnostics": []
},
"impact": {
"contactedLeads": 12
}
}{
"error": "No step of the campaign uses this channel type. Add a step of this type first",
"code": "SENDER_CAMPAIGN_CHANNEL_TYPE_NOT_REQUIRED"
}The authentication you supplied is incorrectroute is available starting emailPro plan{
"error": "Campaign not found",
"code": "SENDER_CAMPAIGN_NOT_FOUND"
}{
"error": "Route bad method",
"code": "ROUTE_BAD_METHOD"
}{
"error": "The campaign uses a dynamic sender strategy: the leads select the senders",
"code": "SENDER_CAMPAIGN_DYNAMIC_STRATEGY"
}The sender pool requires at least the Email Pro plan.
To pin the sender of one step, outside the pool, see
Set Step Sender in the
Sequences group.
A sender or a channel that is not in the body leaves the pool. To add one
sender, use Add Campaign Senders.
An empty list (
{ "senders": [] }) clears the pool.Effects on the leads
- The leads not contacted yet get a sender of the new pool at their next step.
- The contacted leads keep their sender. When their sender or channel leaves the pool, their next steps stop with a “Send user is missing” error, until the sender comes back in the pool.
impact.contactedLeadsgives the number of these leads. It is present when the change removes a sender or a channel.
Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Path Parameters
The unique identifier of the campaign
Body
application/json
Show child attributes
Show child attributes
Was this page helpful?