Campaign Stats
curl --request GET \
--url https://api.example.com/v1/campaigns/{id}/statsimport requests
url = "https://api.example.com/v1/campaigns/{id}/stats"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/campaigns/{id}/stats', 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://api.example.com/v1/campaigns/{id}/stats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/campaigns/{id}/stats"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/campaigns/{id}/stats")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/campaigns/{id}/stats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"stats": {
"sent_count": 123,
"opened_count": 123,
"clicked_count": 123,
"replied_count": 123,
"bounced_count": 123,
"unsubscribed_count": 123,
"open_rate": 123,
"click_rate": 123,
"reply_rate": 123
}
}
}Campaigns
Campaign Stats
Aggregate delivery, engagement, and response metrics for a campaign
GET
/
v1
/
campaigns
/
{id}
/
stats
Campaign Stats
curl --request GET \
--url https://api.example.com/v1/campaigns/{id}/statsimport requests
url = "https://api.example.com/v1/campaigns/{id}/stats"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/campaigns/{id}/stats', 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://api.example.com/v1/campaigns/{id}/stats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/campaigns/{id}/stats"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/campaigns/{id}/stats")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/campaigns/{id}/stats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"stats": {
"sent_count": 123,
"opened_count": 123,
"clicked_count": 123,
"replied_count": 123,
"bounced_count": 123,
"unsubscribed_count": 123,
"open_rate": 123,
"click_rate": 123,
"reply_rate": 123
}
}
}Request
Path Parameters
string
required
The campaign’s unique ID (UUID)
Headers
Authorization: Bearer wbk_your_api_key_here
Requires an API key with the
campaigns:read permission. Stats are aggregated across all steps and enrolled contacts.Response
object
Show properties
Show properties
object
Show Stats object
Show Stats object
integer
Total emails successfully dispatched
integer
Total unique opens (deduplicated per recipient per step)
integer
Total unique link clicks
integer
Recipients who replied at least once
integer
Hard + soft bounces
integer
Recipients who unsubscribed
number
opened_count / sent_count as a float 0–1number
clicked_count / sent_count as a float 0–1number
replied_count / sent_count as a float 0–1curl https://data.leadlex.com/functions/v1/api-gateway/v1/campaigns/cmp_abc123/stats \
-H "Authorization: Bearer wbk_your_api_key_here"
import requests
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
CAMPAIGN_ID = "cmp_abc123"
response = requests.get(
f"{BASE_URL}/v1/campaigns/{CAMPAIGN_ID}/stats",
headers={"Authorization": f"Bearer {API_KEY}"},
)
stats = response.json()["data"]["stats"]
print(f"Open rate: {stats['open_rate']:.1%}")
const CAMPAIGN_ID = 'cmp_abc123';
const response = await fetch(
`https://data.leadlex.com/functions/v1/api-gateway/v1/campaigns/${CAMPAIGN_ID}/stats`,
{ headers: { 'Authorization': 'Bearer wbk_your_api_key_here' } }
);
const { data } = await response.json();
console.log(`Open rate: ${(data.stats.open_rate * 100).toFixed(1)}%`);
Example Response
{
"data": {
"stats": {
"sent_count": 1247,
"opened_count": 612,
"clicked_count": 143,
"replied_count": 89,
"bounced_count": 12,
"unsubscribed_count": 4,
"open_rate": 0.491,
"click_rate": 0.115,
"reply_rate": 0.071
}
}
}
Errors
| Status | Code | Description |
|---|---|---|
| 401 | invalid_key | Invalid or expired API key |
| 403 | insufficient_permissions | Missing campaigns:read permission |
| 404 | campaign_not_found | No campaign with this ID |
| 429 | rate_limited | Rate limit exceeded |