# Relationships

> Link records to each other — parent company and branches, people who work with several companies, a partner or dealer on an opportunity; define your own relationship types.

A company's parent, the second company a person consults for, a company acting as dealer on an opportunity… These links don't fit standard fields. A **relationship** joins two records with a named link and shows on **both pages**: *Parent company* on the branch, *Branches / affiliates* on the parent.

## Built-in relationship types {#builtin}

| Source → target | On the source | On the target | Rule |
|---|---|---|---|
| Company → company | Parent company | Branches / affiliates | A company has one parent; cycles in the chain are blocked |
| Person → company | Other companies | Related people from other companies | Many |
| Opportunity → company | Partner / dealer | Opportunities as partner | Many |

The names of built-in types can be changed and a type can be switched off; they can't be deleted. (Labels are shown in Turkish in the app.)

## Your own relationship types {#custom}

An admin adds new types under **Settings → Relationships**: source object, target object (company · person · opportunity, possibly the same object), the names shown on each side, and an optional single-link rule (*source links to at most one target* / *target links to at most one source*). Examples: *Supplier ↔ Customers*, *Competing opportunity ↔ Competing opportunity*, *Decision maker ↔ Opportunities decided*.

Each type has a permanent key (generated from the name, e.g. `tedarikcisi`) used by table-view columns and the API. Deleting a custom type deletes all its links.

## Adding and removing on a page {#card}

The **Relationships** section on company and opportunity pages (a person's relationships are added from the company page, via *Related people from other companies*): pick the type, search and pick the record, optionally add a short note (*Aegean branch*), **Add**. The × next to a link removes it. A person's relationships show briefly on their row on the company page.

- Adding and removing requires **edit** rights on the record (a sales rep on their own company); seeing them is the same as seeing the record.
- On a single-link type a new link replaces the old one (when a branch's parent changes, the old parent is removed).
- A record can't be related to itself.

## In tables and merges {#views}

In [table views](/guides/views-and-lists) each relationship type can be added as two columns (*Parent company*, *Branches / affiliates*); filters use *contains*, *empty* and *not empty*. When [merging](/guides/merge), the kept record takes over the duplicate's relationships; a link between the two records is deleted because it would relate the record to itself.

## API {#api}

Company and opportunity responses (`GET /api/v1/customers/{id}`, `GET /api/v1/opportunities/{id}`) and person objects (`GET /api/v1/contacts`, `contacts` on the company) include a `relations` array:

```json
"relations": [
  {"type": "parent", "label": "Ana firma", "kind": "customer", "id": 12, "name": "Egemen Holding A.Ş."},
  {"type": "opp_partner", "label": "Ortak olduğu fırsatlar", "kind": "opp", "id": 88, "name": "Yeni hat · 2026"}
]
```

`label` is the name as read from the record's side. Adding relationships isn't available in the REST API — it's done on the web page.