ts.rel.create

Create a relationship between two entities.

Create a relationship between two entities.

Requires authentication

Description

Creates a typed, directed relationship between any two entities in Taskschmiede.

This is the core of the Flexible Relationship Model (FRM). Instead of hard-coded foreign keys, entities are connected through generic relations. Common relationship types include:

  • belongs_to: task belongs_to endeavour
  • assigned_to: task assigned_to resource
  • has_member: organization has_member resource
  • governs: ritual governs endeavour
  • uses: task uses artifact

Entity types include: task, endeavour, organization, resource, user, demand, artifact, ritual, ritual_run.

Relations can carry metadata (e.g., a role on a membership relation).

Parameters

NameTypeRequiredDefaultDescription
relationship_typestringYesRelationship type (e.g., belongs_to, assigned_to, has_member, governs, uses)
source_entity_typestringYesSource entity type (e.g., task, organization, user, ritual)
source_entity_idstringYesSource entity ID
target_entity_typestringYesTarget entity type (e.g., endeavour, resource, artifact)
target_entity_idstringYesTarget entity ID
metadataobjectOptional metadata on the relationship (e.g., role)

Response

Returns the created relation.

{
  "created_at": "2026-02-09T10:00:00Z",
  "id": "rel_x1y2z3...",
  "metadata": {},
  "relationship_type": "governs",
  "source_entity_id": "rtl_a1b2c3d4e5f6...",
  "source_entity_type": "ritual",
  "target_entity_id": "edv_bd159eb7bb9a877a...",
  "target_entity_type": "endeavour"
}

Errors

CodeDescription
not_authenticatedNo active login for this session
invalid_inputAll five required fields must be provided

Examples

Create a governs relation so the ritual applies to the endeavour.

Request:

{
  "relationship_type": "governs",
  "source_entity_id": "rtl_a1b2c3d4e5f6...",
  "source_entity_type": "ritual",
  "target_entity_id": "edv_bd159eb7bb9a877a...",
  "target_entity_type": "endeavour"
}

Response:

{
  "created_at": "2026-02-09T10:00:00Z",
  "id": "rel_x1y2z3...",
  "relationship_type": "governs",
  "source_entity_id": "rtl_a1b2c3d4e5f6...",
  "source_entity_type": "ritual",
  "target_entity_id": "edv_bd159eb7bb9a877a...",
  "target_entity_type": "endeavour"
}

Record that a task uses an artifact.

Request:

{
  "relationship_type": "uses",
  "source_entity_id": "tsk_68e9623ade9b1631...",
  "source_entity_type": "task",
  "target_entity_id": "art_d4e5f6a1b2c3...",
  "target_entity_type": "artifact"
}

Response:

{
  "created_at": "2026-02-09T10:00:00Z",
  "id": "rel_a2b3c4...",
  "relationship_type": "uses",
  "source_entity_id": "tsk_68e9623ade9b1631...",
  "source_entity_type": "task",
  "target_entity_id": "art_d4e5f6a1b2c3...",
  "target_entity_type": "artifact"
}