Create Campaign
curl --request POST \
--url https://api.example.com/v1/campaigns \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"list_id": "<string>",
"template": "<string>"
}
'import requests
url = "https://api.example.com/v1/campaigns"
payload = {
"name": "<string>",
"list_id": "<string>",
"template": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', list_id: '<string>', template: '<string>'})
};
fetch('https://api.example.com/v1/campaigns', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'list_id' => '<string>',
'template' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/campaigns"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"list_id\": \"<string>\",\n \"template\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"list_id\": \"<string>\",\n \"template\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"list_id\": \"<string>\",\n \"template\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"status": "<string>",
"list_id": "<string>",
"created_at": "<string>"
}
}Campaigns
Create Campaign
Create a new outreach campaign
POST
/
v1
/
campaigns
Create Campaign
curl --request POST \
--url https://api.example.com/v1/campaigns \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"list_id": "<string>",
"template": "<string>"
}
'import requests
url = "https://api.example.com/v1/campaigns"
payload = {
"name": "<string>",
"list_id": "<string>",
"template": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', list_id: '<string>', template: '<string>'})
};
fetch('https://api.example.com/v1/campaigns', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'list_id' => '<string>',
'template' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/campaigns"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"list_id\": \"<string>\",\n \"template\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"list_id\": \"<string>\",\n \"template\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"list_id\": \"<string>\",\n \"template\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"status": "<string>",
"list_id": "<string>",
"created_at": "<string>"
}
}Request
Headers
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
Body Parameters
string
required
Campaign name
string
required
UUID of the target contact list
string
required
Email template text (supports variables:
{{name}}, {{company}}, {{title}})Response
object
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/campaigns \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Q2 Outreach",
"list_id": "list-uuid-here",
"template": "Hi {{name}}, I noticed your work at {{company}}..."
}'
import requests
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
data = {
"name": "Q2 Outreach",
"list_id": "list-uuid-here",
"template": "Hi {{name}}, I noticed your work at {{company}}..."
}
response = requests.post(f"{BASE_URL}/v1/campaigns", headers=headers, json=data)
campaign = response.json()["data"]
print(f"Created campaign: {campaign['id']}")
const response = await fetch(
'https://data.leadlex.com/functions/v1/api-gateway/v1/campaigns',
{
method: 'POST',
headers: {
'Authorization': 'Bearer wbk_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Q2 Outreach',
list_id: 'list-uuid-here',
template: 'Hi {{name}}, I noticed your work at {{company}}...'
})
}
);
const { data } = await response.json();
console.log(`Created campaign: ${data.id}`);
Example Response
{
"data": {
"id": "new-campaign-uuid",
"name": "Q2 Outreach",
"status": "draft",
"list_id": "list-uuid-here",
"created_at": "2026-02-24T16:00:00Z"
}
}
Template Variables
Use these variables in your template to personalize emails:| Variable | Description | Example |
|---|---|---|
{{name}} | Contact’s first name | John |
{{full_name}} | Contact’s full name | John Smith |
{{company}} | Company name | Acme Corp |
{{title}} | Job title | CEO |
Example Template
Hi {{name}},
I noticed you're the {{title}} at {{company}}. I wanted to reach out because...
Best regards,
Your Name
Next Steps
After creating a campaign:- Review the draft in your dashboard
- Use the Start Campaign endpoint to launch it
- Or send it to Lexi AI for automated optimization
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Missing required fields or invalid list ID |
| 401 | invalid_key | Invalid API key |
| 403 | insufficient_permissions | Missing write permission |
| 404 | not_found | List not found |
| 429 | rate_limited | Rate limit exceeded |