Entities

REST endpoints for golden-record entities. List entities, inspect detail with source lineage, and merge duplicates. All operations require Clerk JWT auth.

Entities

Endpoints for querying golden records, inspecting entity detail with lineage, and merging entities.

GET/api/entitiesAUTH

List entities with optional filtering and pagination.

Request

Query parameters:

ParamTypeRequiredDescription
typestringNoFilter by entity type (e.g. customer, vendor)
limitintegerNoPage size (default 50)
offsetintegerNoNumber of records to skip

Response

{
  "entities": [
    {
      "id": "ent_01",
      "type": "customer",
      "name": "Acme Corp",
      "member_count": 3,
      "created_at": "2026-03-20T14:00:00Z"
    }
  ],
  "total": 1842
}

Errors

StatusMeaning
401 UnauthorizedMissing or invalid token
422 Unprocessable EntityInvalid query parameters
GET/api/entities/{id}AUTH

Retrieve a single entity including its golden record, member records, and lineage.

Response

{
  "id": "ent_01",
  "type": "customer",
  "golden_record": {
    "name": "Acme Corp",
    "email": "info@acme.com",
    "phone": "+1-555-0100"
  },
  "members": [
    {
      "source_id": "src_01",
      "source_name": "CRM Export",
      "record": { "name": "Acme Corporation", "email": "info@acme.com" }
    }
  ],
  "lineage": {
    "name": { "source": "src_01", "strategy": "most_recent" },
    "email": { "source": "src_01", "strategy": "most_complete" },
    "phone": { "source": "src_02", "strategy": "source_priority" }
  }
}

Errors

StatusMeaning
404 Not FoundEntity not found
POST/api/entities/mergeAUTH

Manually merge two entities into one. The target entity absorbs the source entity's members.

Request

{
  "source_id": "ent_02",
  "target_id": "ent_01"
}
FieldTypeRequiredDescription
source_idstringYesEntity to merge from (will be retired)
target_idstringYesEntity to merge into (survives)

Response

{
  "merged_entity_id": "ent_01"
}

Errors

StatusMeaning
404 Not FoundOne or both entity IDs not found
409 ConflictEntities are already the same record
422 Unprocessable EntityInvalid request body
Was this page helpful?
Edit this page on GitHub