Skip to main content
PUT
Upsert

Overview

The upsert endpoint intelligently creates a new company or updates an existing one based on configurable duplicate detection strategies. It automatically handles conflicts and prevents duplicate records using exact matching, fuzzy matching, or AI-powered similarity detection.

Endpoint

Authentication

Requires a valid API key in the Authorization header:

Request Body

object
required
The company data (same structure as Create Company endpoint)
object
Configuration options for upsert behavior
enum
How to handle conflicts when an existing company is found:
  • source_wins - New data overwrites existing data
  • target_wins - Keep existing data, ignore new data
  • manual_review - Flag for manual review without updating
  • smart_merge (default) - Intelligently merge both datasets
enum
Strategy for detecting duplicate companies:
  • exact_match - Match by externalId and taxId (case-insensitive)
  • fuzzy_match - Similarity matching on name and taxId (80% threshold)
  • ai_similarity - AI-powered semantic similarity detection
  • hybrid (recommended) - Exact match with fuzzy fallback
boolean
default:"true"
Whether to automatically create relationships between entities

Response

boolean
Indicates if the operation succeeded
string
The action performed: created or updated
object
The final company state after upsert
object
The company state before update (null if newly created)
number
Confidence score (0-1) for the duplicate detection match
string
Explanation of why the company was created/updated
array
Array of field-level conflicts detected during merge (if any)

Examples

Simple Upsert (Default Behavior)

Upsert with Fuzzy Matching

Response Examples

Created New Company

Updated Existing Company

Use Cases

Data Import from CRM

Progressive Data Enrichment

Best Practices

  1. Choose the Right Strategy:
    • exact_match for clean, structured data with reliable IDs
    • fuzzy_match for user-entered data with potential typos
    • hybrid for most production scenarios
  2. Handle Conflicts Gracefully:
    • Use smart_merge for automatic resolution
    • Use manual_review for critical data
    • Check conflicts array in response for important changes
  3. Monitor Confidence Scores:
    • Scores below 0.7 may indicate weak matches
    • Log low-confidence updates for review

Error Responses

400 Bad Request

500 Internal Server Error

Next Steps