Skip to content

Relationships

Relationships connect two people in your network (parent/child, sibling, partner, friend, and so on). Nametag handles bidirectionality automatically: creating a relationship also creates its inverse.

All endpoints require authentication and operate only on the authenticated user’s own data.

GET /api/relationships

Returns every relationship in your network, including the two people and the relationship type.

Terminal window
curl https://your-instance.example.com/api/relationships \
-H "Authorization: Bearer ntag_xxx"
{
"relationships": [
{
"id": "clxrel1",
"personId": "clx1",
"relatedPersonId": "clx2",
"relationshipTypeId": "clxtype1",
"person": { "id": "clx1", "name": "Ada" },
"relatedPerson": { "id": "clx2", "name": "Charles" },
"relationshipType": { "id": "clxtype1", "label": "Friend" }
}
]
}
POST /api/relationships

Creates a directional relationship and its inverse in one call.

FieldTypeNotes
personIdstringRequired, first person.
relatedPersonIdstringRequired, second person.
relationshipTypeIdstring or nullThe relationship type to apply.
notesstring or nullUp to 1,000 characters.
Terminal window
curl -X POST https://your-instance.example.com/api/relationships \
-H "Authorization: Bearer ntag_xxx" \
-H "Content-Type: application/json" \
-d '{ "personId": "clx1", "relatedPersonId": "clx2", "relationshipTypeId": "clxtype1" }'
{ "relationship": { "id": "clxrel1", "personId": "clx1", "relatedPersonId": "clx2" } }
GET /api/relationships/{id}
Terminal window
curl https://your-instance.example.com/api/relationships/clxrel1 \
-H "Authorization: Bearer ntag_xxx"
{ "relationship": { "id": "clxrel1", "personId": "clx1", "relatedPersonId": "clx2" } }
PUT /api/relationships/{id}

Changes the type and/or notes. The inverse relationship is updated to match.

Terminal window
curl -X PUT https://your-instance.example.com/api/relationships/clxrel1 \
-H "Authorization: Bearer ntag_xxx" \
-H "Content-Type: application/json" \
-d '{ "relationshipTypeId": "clxtype2", "notes": "Met at a conference" }'
{ "relationship": { "id": "clxrel1", "relationshipTypeId": "clxtype2" } }
DELETE /api/relationships/{id}

Soft-deletes the relationship and its inverse.

Terminal window
curl -X DELETE https://your-instance.example.com/api/relationships/clxrel1 \
-H "Authorization: Bearer ntag_xxx"
{ "message": "Relationship deleted" }
POST /api/relationships/{id}/restore
Terminal window
curl -X POST https://your-instance.example.com/api/relationships/clxrel1/restore \
-H "Authorization: Bearer ntag_xxx"
{ "relationship": { "id": "clxrel1", "deletedAt": null } }

Relationship types are your own vocabulary for categorizing relationships, e.g. Parent/Child, Friend, Manager. A type can be symmetric (its own inverse, like Friend) or asymmetric with a distinct inverse (Parent -> Child).

GET /api/relationship-types
Terminal window
curl https://your-instance.example.com/api/relationship-types \
-H "Authorization: Bearer ntag_xxx"
{
"relationshipTypes": [
{ "id": "clxtype1", "name": "PARENT", "label": "Parent", "inverseId": "clxtype2" }
]
}
POST /api/relationship-types
FieldTypeNotes
namestringRequired, 1-50 characters, stored upper-cased.
labelstringRequired, 1-50 characters, display label.
colorstring or nullHex color.
inverseIdstring or nullID of an existing type to use as the inverse.
inverseLabelstringLabel for a new inverse type to auto-create, if inverseId isn’t given.
symmetricbooleanIf true, the type is its own inverse (e.g. Friend).
Terminal window
curl -X POST https://your-instance.example.com/api/relationship-types \
-H "Authorization: Bearer ntag_xxx" \
-H "Content-Type: application/json" \
-d '{ "name": "PARENT", "label": "Parent", "inverseLabel": "Child" }'
{ "relationshipType": { "id": "clxtype1", "name": "PARENT", "label": "Parent", "inverseId": "clxtype2" } }
GET /api/relationship-types/{id}
Terminal window
curl https://your-instance.example.com/api/relationship-types/clxtype1 \
-H "Authorization: Bearer ntag_xxx"
{ "relationshipType": { "id": "clxtype1", "label": "Parent" } }
PUT /api/relationship-types/{id}

Same body as create.

Terminal window
curl -X PUT https://your-instance.example.com/api/relationship-types/clxtype1 \
-H "Authorization: Bearer ntag_xxx" \
-H "Content-Type: application/json" \
-d '{ "name": "PARENT", "label": "Parent", "color": "#4287f5" }'
{ "relationshipType": { "id": "clxtype1", "color": "#4287f5" } }
DELETE /api/relationship-types/{id}

Soft-deletes the type. Fails with 400 if the type is currently in use by any relationship.

Terminal window
curl -X DELETE https://your-instance.example.com/api/relationship-types/clxtype1 \
-H "Authorization: Bearer ntag_xxx"
{ "success": true }
POST /api/relationship-types/{id}/restore
Terminal window
curl -X POST https://your-instance.example.com/api/relationship-types/clxtype1/restore \
-H "Authorization: Bearer ntag_xxx"
{ "relationshipType": { "id": "clxtype1", "deletedAt": null } }