API · v1 · stabiel
CODEMETA OSDeveloper Center
NL
Console openen
Entity · party_relationships

Party Relationship Schema

Schema-ID
party_relationship
Collection
party_relationships
Permissions
  • Lezenparty_relationship_view
  • Aanmakenparty_relationship_create
  • Wijzigenparty_relationship_edit
  • Verwijderenparty_relationship_delete

Velden

Party Relationship Schema

party_relationships4 permissions

Schema for modeling labeled edges between PERSON and ORGANIZATION parties

personPartyIduuidvereist

ID of the PERSON party

organizationPartyIduuidvereist

ID of the ORGANIZATION party

functionstringoptioneel

Function/role at this organization (e.g. IT-Leiter, Geschäftsführer)

max. 200 tekensnullable
functionRolesstring[]optioneel

Structured function/role slugs from FUNCTION_ROLES taxonomy. Enables recipient-resolver for campaigns (e.g. "IT_LEAD", "MANAGING_DIRECTOR"). Free-text "function" field remains for descriptive context.

Default: []
functionRoleCustomstringoptioneel

Free-text role description used when functionRoles contains "OTHER".

max. 200 tekensnullable
marketingConsentobjectoptioneel

DSGVO/§7 UWG marketing consent on the contact-relationship level. Required for newsletter and sales-outreach campaigns.

nullable
statusstringoptioneel
NONEGRANTEDREVOKED
Default: "NONE"
grantedAtdatetimeoptioneel
nullable
grantedByuuidoptioneel

User ID who recorded the consent

nullable
sourcestringoptioneel
MANUALDOUBLE_OPT_INCONTRACTIMPORTFORM
nullable
legalBasisstringoptioneel
CONSENTLEGITIMATE_INTERESTEXISTING_CUSTOMER
nullable
notesstringoptioneel

Free-text documentation (e.g. "Verbally confirmed on 2026-04-17 call")

max. 1000 tekensnullable
revokedAtdatetimeoptioneel
nullable
revokedReasonstringoptioneel
max. 500 tekensnullable
channelsstring[]optioneel
Default: []
categoriesstring[]optioneel
nullable
emailstringoptioneel

Organization-specific email address

max. 255 tekensnullable
phoneLandlinestringoptioneel

Organization-specific landline phone number

max. 50 tekensnullable
phoneMobilestringoptioneel

Organization-specific mobile phone number

max. 50 tekensnullable
isPrimarybooleanoptioneel

Whether this person is a primary contact (Hauptansprechpartner) OF THE ORGANIZATION. Read from the organization side everywhere (customer list column, campaign recipients, DQ score); several primaries per organization are allowed (ADR 0545). NOT "the primary organization of this person" — that reading led the weclapp sync and the email contact wizard to flag every created contact until 2026-09-15. Only an explicit user choice sets it; imports, syncs and pre-filled create dialogs leave it false.

Default: false
isEmergencyContactbooleanoptioneel

Whether this person is an emergency contact for the organization

Default: false
isDefaultCcbooleanoptioneel

Standard-CC: this contact is put on CC of every outbound mail to this organization, even when the sender did not add them (typically the IT lead on the customer side who wants to see all correspondence). Resolved by `resolveDefaultCcRecipients()` (apps/api/src/services/email/default-cc.service.ts) and enforced on the message DRAFT->SENT send path; the compose dialog pre-fills the same addresses as removable chips. Only triggers when a recipient actually belongs to this organization - the entity context alone (e.g. a ticket of this customer) is not enough, so a mail to a supplier on that ticket does not silently CC the customer. Runtime fallback: missing/null counts as false - no backfill needed.

Default: falsenullable
isActivebooleanoptioneel

Whether this contact relationship is still active. Set to false when the person has left the organization ("ausgetreten"): the contact is greyed out with an "inactive" badge in the CRM and is no longer offered in contact pickers, so it cannot be linked to new tickets/activities. Existing links are untouched. Runtime fallback: a missing field counts as active (isActive !== false) — no backfill needed for pre-existing relationships.

Default: truenullable
weclappContactSyncedAtdatetimeoptioneel

ADR 1064 (Review #1628) — set by the worker once this person stands in the "contacts" list of the weclapp organization. The organization-level job only adds relationships WITHOUT this marker, so a contact removed in weclapp does not silently come back with the next change to the organization. Missing = not yet transferred (no backfill). Server-managed (protected field).

read-onlynullable
emergencyPhonestringoptioneel

Emergency phone number

max. 50 tekensnullable
roleSlugstringoptioneel

Role slug determining permissions for this person at this organization

max. 100 tekensnullable
shopRoleIduuidoptioneel

Optional FK to shop_roles. Determines which customer-portal capabilities and product visibility this person has at this organization.

nullable
notesstringoptioneel

Free-text notes about this relationship

max. 2000 tekensnullable
noteSeveritystringoptioneel

Traffic-light importance of the contact note (`notes`). NONE = neutral grey italic (default, matches the rendering before this field existed), GREEN = uncritical, YELLOW = attention, RED = important. Drives the colour of the note on the contact card and in the "important contacts" hero cards. Runtime fallback: a missing or null field counts as NONE — no backfill needed for pre-existing relationships.

NONEGREENYELLOWRED
Default: "NONE"nullable
noteValidFromdateoptioneel

Optional start of the contact note's validity window (YYYY-MM-DD, inclusive — same semantics as party.notices[].validFrom). Before this date the note is hidden on the contact card and the "important contacts" hero cards; the edit dialogs always show it. Missing/null = valid immediately — no backfill needed for pre-existing relationships.

nullable
noteValidUntildateoptioneel

Optional end of the contact note's validity window (YYYY-MM-DD, inclusive). After this date the note disappears from the display surfaces automatically without anyone having to clear it (e.g. "on parental leave until …"). Missing/null = valid indefinitely — no backfill needed.

nullable
invitationOnlybooleanoptioneel

True when this relationship was created solely as part of a portal-invite flow and the user never accepted. Used by the revoke handler to soft-delete the stub when the pending invitation gets cancelled, so cancelled invites do not leave orphan CRM contacts in the Portal-Zugänge list.

Default: falsenullable
customerOrgUnitIduuidoptioneel

FK to a customer_org_unit. Only valid when organizationPartyId references a customer ORGANIZATION party — the referenced OU must have customerOrgUnit.customerPartyId === organizationPartyId. Used by the customer org chart and the CUSTOMER_OU_HEAD approver-DSL node (ADR 0130a).

Default: nullnullable
workAddressIduuidoptioneel

Site the contact actually works at: the `_id` of an entry in the ORGANIZATION party's `addresses[]` (same id space as `ticket.partyAddressId`). Independent of `workLocationMode` — a contact can be assigned to "Niederlassung Berlin" and still work HOME_OFFICE most of the time. Runtime fallback: missing/null = unknown site, the contact card simply shows no site chip — no backfill needed.

Default: nullnullable
workLocationModestringoptioneel

Where the contact primarily works: ON_SITE (at `workAddressId`), HOME_OFFICE (predominantly from home), HYBRID (split between site and home), REMOTE (mobile / no fixed site). Runtime fallback: missing/null = no statement made — no backfill needed.

ON_SITEHOME_OFFICEHYBRIDREMOTEnull
Default: nullnullable
reportsToPersonPartyIduuidoptioneel

PERSON party-id of the disciplinary manager inside the same customer organization. The referenced person must have an active party_relationship with the same organizationPartyId. Used by the CUSTOMER_MANAGER approver-DSL node (ADR 0130a). Self-reference is rejected; cycles are detected at resolve time, not on write.

Default: nullnullable

Standaard-endpoints

Deze resource volgt het generieke CRUD-contract van het platform. Lees de conventies voor paginering, idempotentie, optimistic locking en audit. De belangrijkste endpoints:

  • GET /api/v1/party_relationships — Lijst, gepagineerd + filterbaar
  • GET /api/v1/party_relationships/<id> — Enkele entity
  • POST /api/v1/party_relationships — Aanmaken
  • PATCH /api/v1/party_relationships/<id> — Gedeeltelijke update
  • DELETE /api/v1/party_relationships/<id> — Soft-delete
  • GET /api/v1/party_relationships/<id>/timeline — Audit + activiteiten

Zoeken