Detect Duplicates
curl --request POST \
--url https://api.example.com/v1/ai/detect-duplicates \
--header 'Content-Type: application/json' \
--data '
{
"entity_type": "<string>",
"threshold": 123,
"limit": 123,
"scope": {}
}
'import requests
url = "https://api.example.com/v1/ai/detect-duplicates"
payload = {
"entity_type": "<string>",
"threshold": 123,
"limit": 123,
"scope": {}
}
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({entity_type: '<string>', threshold: 123, limit: 123, scope: {}})
};
fetch('https://api.example.com/v1/ai/detect-duplicates', 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/ai/detect-duplicates",
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([
'entity_type' => '<string>',
'threshold' => 123,
'limit' => 123,
'scope' => [
]
]),
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/ai/detect-duplicates"
payload := strings.NewReader("{\n \"entity_type\": \"<string>\",\n \"threshold\": 123,\n \"limit\": 123,\n \"scope\": {}\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/ai/detect-duplicates")
.header("Content-Type", "application/json")
.body("{\n \"entity_type\": \"<string>\",\n \"threshold\": 123,\n \"limit\": 123,\n \"scope\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/ai/detect-duplicates")
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 \"entity_type\": \"<string>\",\n \"threshold\": 123,\n \"limit\": 123,\n \"scope\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"pairs": [
{
"primary_id": "<string>",
"duplicate_id": "<string>",
"similarity": 123,
"matched_fields": [
{}
],
"reason": "<string>"
}
],
"total_candidates": 123,
"credits_remaining": 123
}
}AI Analysis
Detect Duplicates
Find likely duplicate contacts, companies, or deals using semantic matching
POST
/
v1
/
ai
/
detect-duplicates
Detect Duplicates
curl --request POST \
--url https://api.example.com/v1/ai/detect-duplicates \
--header 'Content-Type: application/json' \
--data '
{
"entity_type": "<string>",
"threshold": 123,
"limit": 123,
"scope": {}
}
'import requests
url = "https://api.example.com/v1/ai/detect-duplicates"
payload = {
"entity_type": "<string>",
"threshold": 123,
"limit": 123,
"scope": {}
}
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({entity_type: '<string>', threshold: 123, limit: 123, scope: {}})
};
fetch('https://api.example.com/v1/ai/detect-duplicates', 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/ai/detect-duplicates",
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([
'entity_type' => '<string>',
'threshold' => 123,
'limit' => 123,
'scope' => [
]
]),
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/ai/detect-duplicates"
payload := strings.NewReader("{\n \"entity_type\": \"<string>\",\n \"threshold\": 123,\n \"limit\": 123,\n \"scope\": {}\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/ai/detect-duplicates")
.header("Content-Type", "application/json")
.body("{\n \"entity_type\": \"<string>\",\n \"threshold\": 123,\n \"limit\": 123,\n \"scope\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/ai/detect-duplicates")
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 \"entity_type\": \"<string>\",\n \"threshold\": 123,\n \"limit\": 123,\n \"scope\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"pairs": [
{
"primary_id": "<string>",
"duplicate_id": "<string>",
"similarity": 123,
"matched_fields": [
{}
],
"reason": "<string>"
}
],
"total_candidates": 123,
"credits_remaining": 123
}
}This endpoint consumes AI credits. Each scan costs 3 credits for workspaces up to 10,000 records, 5 credits up to 100,000, and 10 credits beyond that. If the workspace balance is insufficient, the API returns
402 insufficient_credits.Request
Headers
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
string
Optional UUID for retry deduplication. A 60-minute cache applies to the result.
Body Parameters
string
required
One of
contact, company, or deal.number
default:"0.85"
Minimum similarity score (0.0 - 1.0) for a pair to be flagged. Lower values surface more candidates; higher values reduce noise.
integer
default:"100"
Maximum number of duplicate pairs to return in a single response. Maximum 1000.
object
Optional additional filters:
created_after (ISO 8601), tag, list_id.Response
object
Show properties
Show properties
array
integer
Number of records scanned
integer
Balance after this call
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-Request-ID.
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/ai/detect-duplicates \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"entity_type": "contact", "threshold": 0.9}'
import requests
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
r = requests.post(
f"{BASE_URL}/v1/ai/detect-duplicates",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={"entity_type": "contact", "threshold": 0.9, "limit": 200},
)
for pair in r.json()["data"]["pairs"]:
print(pair["primary_id"], "<=>", pair["duplicate_id"], pair["similarity"])
const res = await fetch(
'https://data.leadlex.com/functions/v1/api-gateway/v1/ai/detect-duplicates',
{
method: 'POST',
headers: {
'Authorization': 'Bearer wbk_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({ entity_type: 'contact', threshold: 0.9 }),
}
);
const { data } = await res.json();
console.log(data.pairs.length);
Example Response
{
"data": {
"pairs": [
{
"primary_id": "123e4567-e89b-12d3-a456-426614174000",
"duplicate_id": "aaaa1111-bbbb-2222-cccc-333344445555",
"similarity": 0.96,
"matched_fields": ["email", "full_name", "company_name"],
"reason": "Both records share the same email domain and nearly identical name."
}
],
"total_candidates": 4821,
"credits_remaining": 4863
}
}
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Unsupported entity_type or invalid threshold |
| 401 | invalid_key | Invalid or expired API key |
| 402 | insufficient_credits | Workspace credit balance is exhausted |
| 403 | insufficient_permissions | Missing write:ai permission |
| 429 | rate_limited | Rate limit exceeded |