> This page is for Analytics API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://documentation.babelstreet.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://documentation.babelstreet.com/_mcp/server.

# Deduplicates names from input

POST https://analytics.babelstreet.com/rest/v1/name-deduplication
Content-Type: application/json

Returns a list of cluster IDs to be used for deduplication, given a list of names and a score threshold. Position in the cluster ID list corresponds to the position of a name in the input list, and identical cluster IDs signify names that are considered to be duplicates.

Reference: https://documentation.babelstreet.com/analytics/match-names/name-deduplication/deduplicates-names-from-input

## Authentication

- `X-BabelStreetAPI-Key` header (required) — API Key authentication via header
- `X-RosetteAPI-Key` header (required) — API Key authentication via header

## Servers

- `https://analytics.babelstreet.com/rest/v1` (https://analytics.babelstreet.com/rest/v1/, default)
- `https://api.rosette.com/rest/v1` (https://api.rosette.com/rest/v1/)

## Request

### Body (application/json)

This endpoint expects a NameDeduplicationRequest.

- `names` (list of NameDedup, optional)
- `threshold` (double, optional)

## Response

### 200

OK

- `results` (list of string, optional) — list of cluster IDs

## Types

### NameDedup

- `entityType` (enum, optional) — the entity type of the object
  - Allowed values: `PERSON`, `LOCATION`, `ORGANIZATION`
- `language` (string, optional) — ISO 639-3 code for the name's language
- `script` (string, optional) — ISSO 15924 code for the name's script
- `text` (string, optional) — a name to be matched

## Examples

**Request**

```json
{
  "names": [
    {
      "text": "Joe Smith"
    },
    {
      "text": "Joe Smidge"
    },
    {
      "text": "Alex Black"
    }
  ],
  "threshold": 0.8
}
```

**Response**

```json
{
  "results": [
    "string"
  ]
}
```

**SDK Code**

```python JSON String
import requests

url = "https://analytics.babelstreet.com/rest/v1/name-deduplication"

payload = {
    "names": [{ "text": "Joe Smith" }, { "text": "Joe Smidge" }, { "text": "Alex Black" }],
    "threshold": 0.8
}
headers = {
    "X-BabelStreetAPI-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript JSON String
const url = 'https://analytics.babelstreet.com/rest/v1/name-deduplication';
const options = {
  method: 'POST',
  headers: {'X-BabelStreetAPI-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"names":[{"text":"Joe Smith"},{"text":"Joe Smidge"},{"text":"Alex Black"}],"threshold":0.8}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go JSON String
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://analytics.babelstreet.com/rest/v1/name-deduplication"

	payload := strings.NewReader("{\n  \"names\": [\n    {\n      \"text\": \"Joe Smith\"\n    },\n    {\n      \"text\": \"Joe Smidge\"\n    },\n    {\n      \"text\": \"Alex Black\"\n    }\n  ],\n  \"threshold\": 0.8\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-BabelStreetAPI-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby JSON String
require 'uri'
require 'net/http'

url = URI("https://analytics.babelstreet.com/rest/v1/name-deduplication")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-BabelStreetAPI-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"names\": [\n    {\n      \"text\": \"Joe Smith\"\n    },\n    {\n      \"text\": \"Joe Smidge\"\n    },\n    {\n      \"text\": \"Alex Black\"\n    }\n  ],\n  \"threshold\": 0.8\n}"

response = http.request(request)
puts response.read_body
```

```java JSON String
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://analytics.babelstreet.com/rest/v1/name-deduplication")
  .header("X-BabelStreetAPI-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"names\": [\n    {\n      \"text\": \"Joe Smith\"\n    },\n    {\n      \"text\": \"Joe Smidge\"\n    },\n    {\n      \"text\": \"Alex Black\"\n    }\n  ],\n  \"threshold\": 0.8\n}")
  .asString();
```

```php JSON String
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://analytics.babelstreet.com/rest/v1/name-deduplication', [
  'body' => '{
  "names": [
    {
      "text": "Joe Smith"
    },
    {
      "text": "Joe Smidge"
    },
    {
      "text": "Alex Black"
    }
  ],
  "threshold": 0.8
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-BabelStreetAPI-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp JSON String
using RestSharp;

var client = new RestClient("https://analytics.babelstreet.com/rest/v1/name-deduplication");
var request = new RestRequest(Method.POST);
request.AddHeader("X-BabelStreetAPI-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"names\": [\n    {\n      \"text\": \"Joe Smith\"\n    },\n    {\n      \"text\": \"Joe Smidge\"\n    },\n    {\n      \"text\": \"Alex Black\"\n    }\n  ],\n  \"threshold\": 0.8\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift JSON String
import Foundation

let headers = [
  "X-BabelStreetAPI-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "names": [["text": "Joe Smith"], ["text": "Joe Smidge"], ["text": "Alex Black"]],
  "threshold": 0.8
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://analytics.babelstreet.com/rest/v1/name-deduplication")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```