Get suggested user account matches
curl --request GET \
--url http://localhost:2000/user/match-suggestions \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:2000/user/match-suggestions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:2000/user/match-suggestions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "2000",
CURLOPT_URL => "http://localhost:2000/user/match-suggestions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:2000/user/match-suggestions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:2000/user/match-suggestions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:2000/user/match-suggestions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": {
"suggestions": [
[
{
"_id": "64ef3c29f9a1c27e1b2c3a4d",
"emails": [
"user@example.com"
],
"personalInformation": {
"firstName": "John",
"lastName": "Doe",
"name": "John Doe"
}
}
]
]
}
}User Administration
Get Match Suggestions
Admin-only endpoint that returns suggested user pairs that may represent the same person. Suggestions are generated by comparing emails and personal information (first name, last name, name).
GET
/
user
/
match-suggestions
Get suggested user account matches
curl --request GET \
--url http://localhost:2000/user/match-suggestions \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:2000/user/match-suggestions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:2000/user/match-suggestions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "2000",
CURLOPT_URL => "http://localhost:2000/user/match-suggestions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:2000/user/match-suggestions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:2000/user/match-suggestions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:2000/user/match-suggestions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": {
"suggestions": [
[
{
"_id": "64ef3c29f9a1c27e1b2c3a4d",
"emails": [
"user@example.com"
],
"personalInformation": {
"firstName": "John",
"lastName": "Doe",
"name": "John Doe"
}
}
]
]
}
}Admin-only endpoint that returns suggested user pairs that may represent the same person. Suggestions are generated by comparing emails and personal information (first name, last name, name).
Request
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token |
Response
200 OK - Successfully retrieved match suggestions
{
"message": "Match suggestions retrieved successfully",
"data": {
"suggestions": [
[
{
"_id": "64b7f1a2e4b0a5d3f9c12345",
"emails": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"name": "John Doe",
"matchScore": 0.95
},
{
"_id": "64b7f2b3e4b0a5d3f9c54321",
"emails": "j.doe@company.com",
"firstName": "John",
"lastName": "Doe",
"name": "John Doe",
"matchScore": 0.95
}
],
[
{
"_id": "64b7f3c4e4b0a5d3f9c98765",
"emails": "jane.smith@example.com",
"firstName": "Jane",
"lastName": "Smith",
"name": "Jane Smith",
"matchScore": 0.87
},
{
"_id": "64b7f4d5e4b0a5d3f9c11111",
"emails": "jane.s@company.com",
"firstName": "Jane",
"lastName": "Smith",
"name": "Jane Smith",
"matchScore": 0.87
}
]
]
}
}
401 Unauthorized
{
"error": {
"code": "UNAUTHORIZED",
"message": "Missing or invalid token or insufficient permissions"
}
}
500 Internal Server Error
{
"error": {
"code": "SERVER_ERROR",
"message": "Internal server error"
}
}
Example
curl -X GET 'http://localhost:2000/user/match-suggestions' \
-H 'Authorization: Bearer your-jwt-token'
Notes
- This is an admin-only endpoint - requires administrative privileges
- Suggestions are based on similarity of emails and personal information
- Each suggestion is an array of 2 users that may represent the same person
- The match score indicates confidence level (0.0 to 1.0)
- Higher scores indicate stronger matches
- Use these suggestions to identify potential duplicate accounts
- After reviewing, use the link-accounts endpoint to merge duplicates
- The algorithm compares: email domains, names, and other personal data
- Suggestions are generated in real-time and may change as user data updates
Matching Criteria
The system considers the following when generating suggestions:- Email address similarity (same domain, similar local parts)
- Exact name matches (first and last name)
- Similar email patterns (e.g., john.doe vs j.doe)
- Phone number matches
- Department and role similarities
Usage Workflow
- Call this endpoint to get potential duplicate pairs
- Review each suggestion manually
- Use the
/user/link-accountsendpoint to merge confirmed duplicates - Repeat periodically to catch new potential duplicates
Was this page helpful?