Skip to main content
Documentation

Leads

leads.find_duplicates

Find other leads that look like the same person
Read-onlyRead budget

REST

Shipping
POST /api/v1/leads/find_duplicates

MCP tool

Live
leads.find_duplicates

Exposed on: REST API · Shop MCP server · Claude connector · Dash (in-app copilot) · Zapier. Part of the Leads domain.

Operating contract

Scores the shop's open leads against one lead's phone, email, name and car, strongest match first. This is the detection half of the duplicate problem — the half a machine is good at.

confidence is 0-1. Anything at or above 0.8 is what the pipeline itself badges as a likely duplicate; below about 0.5 is a coincidence of a common name and worth ignoring. reason says which signal matched, in one clause.

An empty list is a real and common answer: this lead is not a duplicate of anything.

MERGING IS NOT HERE, AND THAT IS DELIBERATE. Folding two leads together repoints nine tables and retires one of the records, and it cannot be undone by writing a value back. Report the candidates and their confidence and let a person confirm at /leads/duplicates; do not tell a shop owner the duplicates have been dealt with.

TRUNCATION: at most limit candidates come back, strongest first, and omitted says how many more cleared the confidence floor. When it is not 0, raise limit — do not conclude you have seen every duplicate.

Who may call it

Permission
leads.accessThe caller must hold Leads at the ACT level. A read-only dashboard grant on the same section is refused.
Plan
Every planNo plan gate. Available on every Service VIN plan.
Retries
naturalNaturally idempotent — running it twice leaves the same world as running it once. A retrying integration needs no key.
Rate class
readCounted against the read budget — the widest of the four.

Partial answers

omitted is how many matching records are not in the response, and 0 is a real answer meaning you have all of them. There is no cursor here — narrow the filter instead.

Do not summarise from a truncated response

When `omitted` is not 0 there are more candidates above the confidence floor. Call again with a bigger `limit`.

Input

FieldTypeDescription
lead_idrequiredstringuuid

The lead to look for duplicates of, as returned by leads.list or leads.get.

limitinteger1–25

How many candidates to return, 1-25. Defaults to 5.

Default: 5

Output

FieldTypeDescription
itemsobject[]

items[].lead_idstring

items[].namestring

items[].phonestring | null

items[].emailstring | null

items[].statusstring

items[].sourcestring | null

items[].created_atstring

items[].confidencenumber

items[].reasonstring

omittednumber

Examples

Built from this capability's own schema — required fields and the ones carrying a default, and nothing invented. Paste one and it validates.

curl
export SERVICEVIN_API_KEY=svk_live_…

curl -X POST https://www.servicevin.com/api/v1/leads/find_duplicates \
  -H "Authorization: Bearer $SERVICEVIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lead_id":"9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20","limit":5}'

TypeScript (fetch)
const res = await fetch("https://www.servicevin.com/api/v1/leads/find_duplicates", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SERVICEVIN_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "lead_id": "9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20",
    "limit": 5
  }),
});

// Success and failure are both envelopes. Switch on error.code, never
// on error.message — the codes are stable, the messages are for people.
const payload = await res.json();
if (!res.ok) throw new Error(payload.error.code);
const data = payload.data;

Python (requests)
import os, requests

res = requests.post(
    "https://www.servicevin.com/api/v1/leads/find_duplicates",
    headers={"Authorization": f"Bearer {os.environ['SERVICEVIN_API_KEY']}"},
    json={
    "lead_id": "9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20",
    "limit": 5
},
    timeout=30,
)
payload = res.json()
if not res.ok:
    raise RuntimeError(payload["error"]["code"])
data = payload["data"]

MCP tools/call — https://www.servicevin.com/api/mcp
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "leads.find_duplicates",
    "arguments": {
      "lead_id": "9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20",
      "limit": 5
    }
  }
}

Refusals

The four gates run in this order on every surface, and the order is not arbitrary — see Authentication.

StatusCodeWhen
404not_foundThe id is unknown, or the feature is not enabled for this account. Deliberately the same answer for both.
403forbiddenThis login does not hold leads.access.
422validation_errorAn argument was wrong. The message names the field.
429rate_limitedToo many read calls. Back off and retry.
500internal_errorSomething failed on our side. Nothing was changed.