Skip to main content
GET
/
user
/
match-suggestions
Get suggested user account matches
curl --request GET \
  --url http://localhost:2000/user/match-suggestions \
  --header 'Authorization: Bearer <token>'
{
  "message": "<string>",
  "data": {
    "suggestions": [
      [
        {
          "_id": "64ef3c29f9a1c27e1b2c3a4d",
          "emails": [
            "[email protected]"
          ],
          "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

NameTypeRequiredDescription
AuthorizationstringYesBearer token

Response

200 OK - Successfully retrieved match suggestions

{
  "message": "Match suggestions retrieved successfully",
  "data": {
    "suggestions": [
      [
        {
          "_id": "64b7f1a2e4b0a5d3f9c12345",
          "emails": "[email protected]",
          "firstName": "John",
          "lastName": "Doe",
          "name": "John Doe",
          "matchScore": 0.95
        },
        {
          "_id": "64b7f2b3e4b0a5d3f9c54321",
          "emails": "[email protected]",
          "firstName": "John",
          "lastName": "Doe",
          "name": "John Doe",
          "matchScore": 0.95
        }
      ],
      [
        {
          "_id": "64b7f3c4e4b0a5d3f9c98765",
          "emails": "[email protected]",
          "firstName": "Jane",
          "lastName": "Smith",
          "name": "Jane Smith",
          "matchScore": 0.87
        },
        {
          "_id": "64b7f4d5e4b0a5d3f9c11111",
          "emails": "[email protected]",
          "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

  1. Call this endpoint to get potential duplicate pairs
  2. Review each suggestion manually
  3. Use the /user/link-accounts endpoint to merge confirmed duplicates
  4. Repeat periodically to catch new potential duplicates

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Response

Successfully retrieved match suggestions

message
string
data
object