Skip to main content
GET
/
campaigns
/
{campaignId}
/
export
/
start
Start Campaign Stats Export
curl --request GET \
  --url https://api.lemlist.com/api/campaigns/{campaignId}/export/start \
  --header 'Authorization: Basic <encoded-value>'
{
  "_id": "axp_7dKLTwqpjxzR5vh2n",
  "id": "axp_7dKLTwqpjxzR5vh2n",
  "teamId": "tea_c123fg5h8ijKL9noP",
  "campaignId": "cam_A1B2C3D4E5F6G7H8I9",
  "campaignName": "Insights Outreach 2024",
  "status": "pending",
  "startedAt": "2024-07-09T13:43:52.124Z",
  "progressIndex": 0,
  "progressTime": 1720532632124,
  "progressLastStepDuration": 0,
  "progressType": "starting",
  "progress": 0,
  "total": 0
}
This endpoint starts an asynchronous export of all campaign statistics. The final export result is a CSV file. You first start an export, get an export ID, and then periodically check the status of the export with the Get Campaign Export Status endpoint. You should stop polling as soon as you have a status that is different than “pending”. Multiple exports on the same campaign can be done simultaneously as it is export ID based.

How it works

  1. Start the export: Call this endpoint to initiate the export process. You’ll receive an exportId in the response.
  2. Check status: Use the exportId with the Get Campaign Export Status endpoint to periodically check the export status.
  3. Download: Once the status is "done", use the provided URL to download the CSV file.
The export is ID-based rather than campaign-based, allowing multiple simultaneous exports of the same campaign (e.g., one by a user in the application and another by a script).

Response

The response includes:
  • exportId: Use this to check the export status
  • status: Will be "pending" initially, then "done" or "error"
  • progress information: Track the export progress

Next steps

After starting an export, use the Get Campaign Export Status endpoint to monitor progress and retrieve the download URL when ready.

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Path Parameters

campaignId
string
required

The unique identifier of the campaign to export

Response

Export started successfully

_id
string

The unique identifier of the export

id
string

The unique identifier of the export (same as _id)

teamId
string

The team identifier

campaignId
string

The campaign identifier

campaignName
string

The name of the campaign

status
enum<string>

Current status of the export

Available options:
pending,
done,
error
startedAt
string<date-time>

When the export was started

progressIndex
integer

Current progress index

progressTime
integer

Timestamp of progress

progressLastStepDuration
integer

Duration of last step in milliseconds

progressType
string

Type of current progress step

progress
integer

Number of items processed

total
integer

Total number of items to process