API Docs

Global settings

Get duplicated customers by team

Returns partial and/or exact duplicated customers from a selected team

POST/https://api-get-duplicated-customers-by-team-kigtdz23uq-ew.a.run.app

Headers

Content-Type
application/json
string
x-api-key
<API_KEY>
string

Body Parameters

team_id
Required, not empty.
wDeNREzIZOd9MHtR7ILz
string
comparison_mode
Required. Must be EXACT or PARTIAL.
PARTIAL
EXACT | PARTIAL
minimum_score
Optional numeric value between 0.5 and 1.
0.7
number
excluded_words
Optional comma-separated string of words to exclude.
ras, dave
string

cURL

curl -i \
  -X POST \
  -H "Content-Type: application/json" \
  -H "x-api-key: <API_KEY>" \
  -d '{
    "team_id": "wDeNREzIZOd9MHtR7ILz",
    "comparison_mode": "PARTIAL",
    "minimum_score": 0.7,
    "excluded_words": "ras, dave"
  }' \
  https://api-get-duplicated-customers-by-team-kigtdz23uq-ew.a.run.app

Response

200 Success

{
  "team_id": "selected-team-id",
  "comparison_mode": "PARTIAL",
  "count": 1,
  "matches": [
    {
      "match_type": "PARTIAL",
      "score": 0.8,
      "shared_tokens": [
        "luis",
        "jimenez"
      ],
      "customers": [
        {
          "id": "customerId1",
          "name": "Luis",
          "surname": "Jiménez",
          "normalized_name": "luis jimenez"
        },
        {
          "id": "customerId2",
          "name": "Luis Alejandro",
          "surname": "Jiménez",
          "normalized_name": "luis alejandro jimenez"
        }
      ]
    }
  ]
}

count represents the number of candidate pairs, not the number of unique customers.

Each item in matches contains exactly two customers.

In EXACT mode, matches have match_type: "EXACT" and score: 1.

In PARTIAL mode, both exact and partial matches may be returned.

200 Success - No matches

The endpoint returns a successful response when the team exists but no duplicate candidates are found.

{
  "team_id": "selected-team-id",
  "comparison_mode": "PARTIAL",
  "count": 0,
  "matches": []
}

204 No Content

Returned for a valid OPTIONS preflight request from an allowed local origin.

The response has no body.

400 Invalid payload

{
  "success": false,
  "message": "Invalid payload",
  "errors": [
    {
      "path": "comparison_mode",
      "message": "Invalid option: expected one of \"EXACT\"|\"PARTIAL\""
    }
  ]
}

Returned when team_id is missing, empty, or not a string.

Returned when comparison_mode is missing or is not EXACT or PARTIAL.

Returned when the request contains unsupported additional properties.

The errors array may contain more than one validation error.

400 Invalid payload - EXACT minimum score

Returned in EXACT mode when minimum_score is sent with a value different from 1.

{
  "success": false,
  "message": "Invalid payload",
  "errors": [
    {
      "path": "minimum_score",
      "message": "minimum_score must be 1 when comparison_mode is EXACT"
    }
  ]
}

401 Unauthorized

Returned when the x-api-key header is missing or does not match the configured API key.

{
  "error": "Unauthorized"
}

403 Origin not allowed

Returned only for an OPTIONS preflight request sent from a disallowed origin.

{
  "error": "Origin not allowed"
}

This restriction does not apply to server-to-server requests without an Origin header.

404 Team not found

Returned when no document exists at teams/{team_id}.

{
  "error": "Team not found"
}

The customers query and duplicate analysis are not executed when the team does not exist.

405 Method not allowed

Returned when the endpoint is called using a method other than POST or OPTIONS.

{
  "error": "Method not allowed"
}

The response includes:

Allow: POST

500 API key is not configured

Returned when the PRODUCT_PRICES_API_KEY secret is unavailable in the function runtime.

{
  "error": "API key is not configured"
}