Set Email for Campaign Export Notification
curl --request PUT \
--url https://api.lemlist.com/api/campaigns/{campaignId}/export/{exportId}/email/{email} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.lemlist.com/api/campaigns/{campaignId}/export/{exportId}/email/{email}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.lemlist.com/api/campaigns/{campaignId}/export/{exportId}/email/{email}', 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}/export/{exportId}/email/{email}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
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}/export/{exportId}/email/{email}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"ok": true,
"status": {
"_id": "axp_Vv6lJOc8NlVVmDud5",
"id": "axp_Vv6lJOc8NlVVmDud5",
"teamId": "tea_c123fg5h8ijKL9noP",
"campaignId": "cam_A1B2C3D4E5F6G7H8I9",
"campaignName": "Insights Outreach 2024",
"status": "done",
"startedAt": "2024-07-11T09:49:15.278Z",
"progressIndex": 6,
"progressTime": 1720691355497,
"progressLastStepDuration": 0,
"progressType": "done",
"progress": 0,
"total": 0,
"fileSize": 654,
"endedAt": "2024-07-11T09:49:15.497Z",
"url": "https://api.lemlist.com/api/files/exports/fil_axp_Vv6lJOc8NlVVmDud5_insights_outreach_2024.csv",
"email": "emily.johnson@example.com"
}
}
Campaigns
Set Email for Campaign Export Notification
Configures email notification delivery when a campaign export completes.
PUT
/
campaigns
/
{campaignId}
/
export
/
{exportId}
/
email
/
{email}
Set Email for Campaign Export Notification
curl --request PUT \
--url https://api.lemlist.com/api/campaigns/{campaignId}/export/{exportId}/email/{email} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.lemlist.com/api/campaigns/{campaignId}/export/{exportId}/email/{email}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.lemlist.com/api/campaigns/{campaignId}/export/{exportId}/email/{email}', 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}/export/{exportId}/email/{email}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
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}/export/{exportId}/email/{email}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"ok": true,
"status": {
"_id": "axp_Vv6lJOc8NlVVmDud5",
"id": "axp_Vv6lJOc8NlVVmDud5",
"teamId": "tea_c123fg5h8ijKL9noP",
"campaignId": "cam_A1B2C3D4E5F6G7H8I9",
"campaignName": "Insights Outreach 2024",
"status": "done",
"startedAt": "2024-07-11T09:49:15.278Z",
"progressIndex": 6,
"progressTime": 1720691355497,
"progressLastStepDuration": 0,
"progressType": "done",
"progress": 0,
"total": 0,
"fileSize": 654,
"endedAt": "2024-07-11T09:49:15.497Z",
"url": "https://api.lemlist.com/api/files/exports/fil_axp_Vv6lJOc8NlVVmDud5_insights_outreach_2024.csv",
"email": "emily.johnson@example.com"
}
}
How it works
When you set an email address for an export:- The export continues processing in the background
- When the export status becomes
"done", an automated email is sent to the specified address - The email contains the download URL for the CSV file
Use cases
This is particularly useful for:- Long-running exports: Set an email and continue working without having to poll the status endpoint
- Automated workflows: Set up scripts that trigger exports and notify specific team members
- Multiple recipients: Call this endpoint with different email addresses to notify multiple people
You can set the email notification at any time after starting an export, even if the export is already complete. However, itβs most useful to set it immediately after starting the export.
Email format
The notification email includes:- Campaign name
- Export completion timestamp
- Direct download link to the CSV file
Remember that the CSV file is only available for 24 hours after the export completes.
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 that was exported
The unique identifier of the export returned by the /start endpoint
The email address to send the export URL to when the export is done
Was this page helpful?