Start Campaign
curl --request POST \
--url https://api.example.com/v1/campaigns/:id/startimport requests
url = "https://api.example.com/v1/campaigns/:id/start"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/campaigns/:id/start', 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/start",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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/start"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/campaigns/:id/start")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/campaigns/:id/start")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"campaign_id": "<string>",
"status": "<string>",
"task_id": "<string>"
}
}Campaigns
Start Campaign
Launch a campaign (sends to Lexi AI for approval)
POST
/
v1
/
campaigns
/
:id
/
start
Start Campaign
curl --request POST \
--url https://api.example.com/v1/campaigns/:id/startimport requests
url = "https://api.example.com/v1/campaigns/:id/start"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/campaigns/:id/start', 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/start",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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/start"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/campaigns/:id/start")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/campaigns/:id/start")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"campaign_id": "<string>",
"status": "<string>",
"task_id": "<string>"
}
}Request
Path Parameters
string
required
Campaign UUID
Headers
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
Response
object
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/campaigns/campaign-uuid/start \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json"
import requests
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
CAMPAIGN_ID = "campaign-uuid"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(
f"{BASE_URL}/v1/campaigns/{CAMPAIGN_ID}/start",
headers=headers
)
result = response.json()["data"]
if result["status"] == "pending_approval":
print(f"Campaign sent to Lexi for approval: {result['task_id']}")
else:
print("Campaign started!")
const CAMPAIGN_ID = 'campaign-uuid';
const response = await fetch(
`https://data.leadlex.com/functions/v1/api-gateway/v1/campaigns/${CAMPAIGN_ID}/start`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer wbk_your_api_key_here',
'Content-Type': 'application/json'
}
}
);
const { data } = await response.json();
if (data.status === 'pending_approval') {
console.log(`Campaign sent to Lexi: ${data.task_id}`);
} else {
console.log('Campaign started!');
}
Example Response (Approval Required)
{
"data": {
"campaign_id": "campaign-uuid",
"status": "pending_approval",
"task_id": "lexi-task-uuid"
}
}
Example Response (Auto-Started)
{
"data": {
"campaign_id": "campaign-uuid",
"status": "active",
"task_id": null
}
}
Approval Workflow
When a campaign requires approval:- Start the campaign → status becomes
pending_approval - Lexi reviews the campaign (template, target list, timing)
- You approve or dismiss via the Lexi tasks endpoints
- Campaign launches after approval
Check Approval Status
# Poll for task status
tasks_response = requests.get(
f"{BASE_URL}/v1/lexi/tasks",
headers=headers,
params={"status": "pending"}
)
tasks = tasks_response.json()["data"]["tasks"]
for task in tasks:
if task["type"] == "campaign_start":
print(f"Campaign {task['metadata']['campaign_id']} awaiting approval")
Approve the Campaign
# Approve the task to launch the campaign
task_id = "lexi-task-uuid"
requests.post(
f"{BASE_URL}/v1/lexi/tasks/{task_id}/approve",
headers=headers
)
print("Campaign approved and launching!")
Auto-Start vs Manual Approval
Whether a campaign requires Lexi approval depends on your workspace settings. By default, campaigns with >100 recipients require approval.
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Campaign is empty or already running |
| 401 | invalid_key | Invalid API key |
| 403 | insufficient_permissions | Missing write permission |
| 404 | not_found | Campaign not found |
| 429 | rate_limited | Rate limit exceeded |
Example Error (Campaign Already Running)
{
"error": {
"code": "validation_error",
"message": "Campaign is already active"
}
}