Data model

Relationships

A directional link between two owned contacts. The pair_relationship after_create hook mirrors each row on the target contact so both detail pages see the link.

Model name: relationship
Endpoints: 5
Max page size: 200

Fields

Per-field validation rules. Values that violate any constraint are rejected with 400 before they reach the database.

FieldTypeConstraints
kindenum
enumpartner | spouse | parent | child | sibling | friend | colleague | manager | report | mentor | mentee | other
labelstring
max length80
notesstring
max length2000
sincestring
max length32
parent_idstring
max length64ref →contactowned
target_idstring
max length64ref →contactowned

Mutability

Which fields can you send, and when? Anything without a marker is server-managed - sending it isn't an error, it's silently ignored.

Create-only - read from POST body.Patchable - read from PATCH body.Server-managed - ignored on the body.
FieldCreatePatch
kind
label
notes
since
parent_id
target_id

Fields marked create-only but not patchable are immutable after creation. Server-managed fields include id, timestamps, ownership, and status.

Filtering & sorting

Combinable on list endpoints. Repeating a filter key produces an IN clause; prefixing a sort key with - reverses direction. Example: ?status=open&status=blocked&sort=-created_at.

Filter keys

parent_iddata__parent_id
target_iddata__target_id
kinddata__kind
statusstatus
is_archivedis_archived
owned_byowned_by

Sort keys

created_atcreated_at
kinddata__kind

Default: kind

Endpoints

Each endpoint below lists its HTTP method, path, and the PAT scope it needs. Code samples cover curl, JavaScript, TypeScript, Python, Rust, Java, and WebSocket.

GET/xapi2/data/relationshiprelationship:list

List objects

Returns a paginated list of objects you can read. Default page size is 20; pass ?limit= to change (capped per type). Use ?after=<id> for keyset pagination on created_at-sorted lists, or ?offset= for offset paging.

curl -H "Authorization: Bearer pat_…" \
"https://friendship-tracker.com/xapi2/data/relationship?limit=20"
GET/xapi2/data/relationship/{id}relationship:read

Read one

Returns the object by id. 404 if it does not exist or you cannot read it (the two cases are intentionally conflated).

curl -H "Authorization: Bearer pat_…" \
https://friendship-tracker.com/xapi2/data/relationship/OBJECT_ID
POST/xapi2/data/relationshiprelationship:create

Create

Creates a new object. Body is a flat JSON dict of field values. Server-side fields (id, timestamps, ownership) are filled automatically; only fields listed below as creatable are read from the body.

curl -H "Authorization: Bearer pat_…" \
-H "Content-Type: application/json" \
-X POST https://friendship-tracker.com/xapi2/data/relationship \
-d '{"name": "…"}'
PATCH/xapi2/data/relationship/{id}relationship:update

Update

Partial update. Only fields included in the body are touched; everything else is preserved. Same allow-list as create, minus the fields that are immutable post-create.

curl -H "Authorization: Bearer pat_…" \
-H "Content-Type: application/json" \
-X PATCH https://friendship-tracker.com/xapi2/data/relationship/OBJECT_ID \
-d '{"name": "…"}'
DELETE/xapi2/data/relationship/{id}relationship:delete

Delete

Removes the object. It vanishes from every default list immediately and stops being returned by read / list.

curl -H "Authorization: Bearer pat_…" \
-X DELETE https://friendship-tracker.com/xapi2/data/relationship/OBJECT_ID

Use in CLI

The same endpoints are also exposed via the Friendship Tracker CLI. For scripts, CI, and bulk imports it's usually the faster path.

friendshipcli relationship list --limit 5
friendshipcli relationship get <id>
friendshipcli relationship create --parent-id "Hello"
friendshipcli relationship upsert --unique parent_id --csv items.csv
friendshipcli relationship schema # fields & limits

Full command reference, profiles, CSV import, auto-retry, NDJSON streaming → /docs/cli