Add Contacts to List
curl --request POST \
--url https://api.example.com/v1/lists/:id/contacts \
--header 'Content-Type: application/json' \
--data '
{
"contact_ids": [
{}
]
}
'import requests
url = "https://api.example.com/v1/lists/:id/contacts"
payload = { "contact_ids": [{}] }
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({contact_ids: [{}]})
};
fetch('https://api.example.com/v1/lists/:id/contacts', 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/lists/:id/contacts",
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([
'contact_ids' => [
[
]
]
]),
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/lists/:id/contacts"
payload := strings.NewReader("{\n \"contact_ids\": [\n {}\n ]\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/lists/:id/contacts")
.header("Content-Type", "application/json")
.body("{\n \"contact_ids\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/lists/:id/contacts")
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 \"contact_ids\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"added": 123,
"list_id": "<string>",
"contact_count": 123
}
}Lists
Add Contacts to List
Add one or more contacts to an existing list
POST
/
v1
/
lists
/
:id
/
contacts
Add Contacts to List
curl --request POST \
--url https://api.example.com/v1/lists/:id/contacts \
--header 'Content-Type: application/json' \
--data '
{
"contact_ids": [
{}
]
}
'import requests
url = "https://api.example.com/v1/lists/:id/contacts"
payload = { "contact_ids": [{}] }
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({contact_ids: [{}]})
};
fetch('https://api.example.com/v1/lists/:id/contacts', 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/lists/:id/contacts",
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([
'contact_ids' => [
[
]
]
]),
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/lists/:id/contacts"
payload := strings.NewReader("{\n \"contact_ids\": [\n {}\n ]\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/lists/:id/contacts")
.header("Content-Type", "application/json")
.body("{\n \"contact_ids\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/lists/:id/contacts")
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 \"contact_ids\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"added": 123,
"list_id": "<string>",
"contact_count": 123
}
}Request
Path Parameters
string
required
List UUID
Headers
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
Body Parameters
array
required
Array of contact UUIDs to add to the list
Response
object
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/lists/abc-123/contacts \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"contact_ids": [
"123e4567-e89b-12d3-a456-426614174000",
"789e0123-e45b-67c8-a901-234567890abc"
]
}'
import requests
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
LIST_ID = "abc-123"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
data = {
"contact_ids": [
"123e4567-e89b-12d3-a456-426614174000",
"789e0123-e45b-67c8-a901-234567890abc"
]
}
response = requests.post(
f"{BASE_URL}/v1/lists/{LIST_ID}/contacts",
headers=headers,
json=data
)
result = response.json()["data"]
print(f"Added {result['added']} contacts to list")
const LIST_ID = 'abc-123';
const response = await fetch(
`https://data.leadlex.com/functions/v1/api-gateway/v1/lists/${LIST_ID}/contacts`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer wbk_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
contact_ids: [
'123e4567-e89b-12d3-a456-426614174000',
'789e0123-e45b-67c8-a901-234567890abc'
]
})
}
);
const { data } = await response.json();
console.log(`Added ${data.added} contacts`);
Example Response
{
"data": {
"added": 2,
"list_id": "abc12345-678d-90ef-1234-567890abcdef",
"contact_count": 47
}
}
Duplicate Handling
If a contact is already in the list, it will be silently skipped (not an error). The
added count reflects only newly added contacts.Example with Duplicates
If you try to add 5 contacts but 2 are already in the list:{
"data": {
"added": 3,
"list_id": "abc-123",
"contact_count": 50
}
}
Bulk Operations
You can add up to 100 contacts in a single request:# Add 100 contacts at once
contact_ids = [...] # List of up to 100 UUIDs
response = requests.post(
f"{BASE_URL}/v1/lists/{LIST_ID}/contacts",
headers=headers,
json={"contact_ids": contact_ids}
)
Requests with more than 100 contact IDs will be rejected with a validation error.
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Invalid contact IDs or exceeds 100 limit |
| 401 | invalid_key | Invalid API key |
| 403 | insufficient_permissions | Missing write permission |
| 404 | not_found | List not found or not in your workspace |
| 429 | rate_limited | Rate limit exceeded |
Example Error (Invalid Contact ID)
{
"error": {
"code": "validation_error",
"message": "One or more contact IDs are invalid or not in your workspace",
"details": {
"invalid_ids": ["not-a-real-uuid"]
}
}
}