← API reference

Developer · API reference

Competitors & relationships

Manage a company's competitive graph and domain aliases.

The relationships endpoints manage the competitive graph — the competitors LunaLift benchmarks you against — plus the domain aliases that map every domain a company owns to a single entity.

GET /relationships/{company_id}

Get Company Relationships

Get all entity relationships for a company

🔒 Requires Authorization: Bearer ll_… (or X-API-Key).

Path parameters

NameTypeRequiredDescription
company_idstringYes—

Example request

curl -X GET "https://api.lunalift.ai/relationships/COMPANY_ID" \
  -H "Authorization: Bearer ll_your_api_key"

Response · 200 OK

Returns a JSON object on success.

POST /relationships/create/{company_id}

Create Relationship

Create a new entity relationship with optional prompt generation

🔒 Requires Authorization: Bearer ll_… (or X-API-Key).

Path parameters

NameTypeRequiredDescription
company_idstringYes—

Request body· CreateRelationshipRequest

FieldTypeRequiredDescription
parent_idstringYes—
parent_typeEntityTypeYesEntity types in the graph.
child_idstringYes—
child_typeEntityTypeYesEntity types in the graph.
create_promptsbooleanNo—
execute_promptsbooleanNo—

Example request

curl -X POST "https://api.lunalift.ai/relationships/create/COMPANY_ID" \
  -H "Authorization: Bearer ll_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "parent_id": "string",
  "parent_type": {},
  "child_id": "string",
  "child_type": {}
}'

Response · 200 OK

Returns a JSON object on success.

POST /relationships/update/{company_id}

Update Relationship

Update the relationship_type of a company_relationship row. Domain-keyed: the badge surfaces carry the target domain, not the int PK. Normalises the domain (shared helper), resolves slim_company via domain_hash, and scopes the UPDATE to (company_id, slim_company_id). Mutates ONLY relationship_type — tracked/source/confidence/enriched_at are left untouched (a label correction is not a re-enrichment).

🔒 Requires Authorization: Bearer ll_… (or X-API-Key).

Path parameters

NameTypeRequiredDescription
company_idstringYes—

Request body· UpdateRelationshipRequest

FieldTypeRequiredDescription
domainstringYes—
relationship_typeRelationshipTypeYesClassification of company relationship to customer.

Example request

curl -X POST "https://api.lunalift.ai/relationships/update/COMPANY_ID" \
  -H "Authorization: Bearer ll_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "string",
  "relationship_type": {}
}'

Response · 200 OK

Returns a JSON object on success.

DELETE /relationships/delete/{company_id}

Delete Relationship

Delete an entity relationship with prompt management options

🔒 Requires Authorization: Bearer ll_… (or X-API-Key).

Path parameters

NameTypeRequiredDescription
company_idstringYes—

Request body· DeleteRelationshipRequest

FieldTypeRequiredDescription
parent_idstringYes—
child_idstringYes—
deactivate_promptsbooleanNo—
delete_promptsbooleanNo—
remove_referencesbooleanNo—

Example request

curl -X DELETE "https://api.lunalift.ai/relationships/delete/COMPANY_ID" \
  -H "Authorization: Bearer ll_your_api_key"

Response · 200 OK

Returns a JSON object on success.

GET /relationships/competitors/{company_id}

List Competitors

List all manually tracked competitors for a company.

🔒 Requires Authorization: Bearer ll_… (or X-API-Key).

Path parameters

NameTypeRequiredDescription
company_idstringYes—

Example request

curl -X GET "https://api.lunalift.ai/relationships/competitors/COMPANY_ID" \
  -H "Authorization: Bearer ll_your_api_key"

Response · 200 OK

Returns a JSON object on success.

POST /relationships/competitors/{company_id}

Add Competitor

Add a manually tracked competitor to a company.

🔒 Requires Authorization: Bearer ll_… (or X-API-Key).

Path parameters

NameTypeRequiredDescription
company_idstringYes—

Request body· AddCompetitorRequest

FieldTypeRequiredDescription
namestringYes—
domainstringYes—

Example request

curl -X POST "https://api.lunalift.ai/relationships/competitors/COMPANY_ID" \
  -H "Authorization: Bearer ll_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "domain": "string"
}'

Response · 200 OK

Returns a JSON object on success.

POST /relationships/generate-prompts/{company_id}

Generate Prompts For Relationships

Generate prompts for existing relationships

🔒 Requires Authorization: Bearer ll_… (or X-API-Key).

Path parameters

NameTypeRequiredDescription
company_idstringYes—

Example request

curl -X POST "https://api.lunalift.ai/relationships/generate-prompts/COMPANY_ID" \
  -H "Authorization: Bearer ll_your_api_key"

Response · 200 OK

Returns a JSON object on success.

GET /relationships/domain-alias/{company_id}

List Domain Aliases

The company's EFFECTIVE alias set — its own merges UNION the global tier (global winning a same-alias conflict), one row per alias. Each row is tagged ``scope`` ('company' | 'global') so the UI can offer Undo on the company's own merges and render globally-folded pairs as non-revertible. This is what makes the "same as <canonical>" hint DURABLE across reloads — the read fold hides aliases, so without this endpoint the UI can't know they exist.

🔒 Requires Authorization: Bearer ll_… (or X-API-Key).

Path parameters

NameTypeRequiredDescription
company_idstringYes—

Example request

curl -X GET "https://api.lunalift.ai/relationships/domain-alias/COMPANY_ID" \
  -H "Authorization: Bearer ll_your_api_key"

Response · 200 OK

Returns a JSON object on success.

POST /relationships/domain-alias/{company_id}

Add Domain Alias

Declare ``alias_domain`` a "same as" (alias of) ``canonical_domain`` for THIS company. Read-time dedup: every leaderboard fold collapses the alias into its canonical at query time. Pure lookup — no reprocessing, no backfill, instantly reversible via DELETE. Auto-promotes to the global tier once >= 2 distinct companies set the same pair.

🔒 Requires Authorization: Bearer ll_… (or X-API-Key).

Path parameters

NameTypeRequiredDescription
company_idstringYes—

Request body· DomainAliasRequest

FieldTypeRequiredDescription
alias_domainstringYes—
canonical_domainstringYes—

Example request

curl -X POST "https://api.lunalift.ai/relationships/domain-alias/COMPANY_ID" \
  -H "Authorization: Bearer ll_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "alias_domain": "string",
  "canonical_domain": "string"
}'

Response · 200 OK

Returns a JSON object on success.