Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/DrDigett/Babel/llms.txt

Use this file to discover all available pages before exploring further.

Relation endpoints manage the directed edges between nodes in the knowledge graph. Each relation is a typed, directed edge that connects a source node to a target node. Every relation carries a weight value between 0.0 and 1.0 that influences both the graph physics simulation and edge visibility — only edges whose weight is ≥ 0.7 are rendered in the graph view. Lower-weight relations are stored in the database and queryable through the API but are hidden from the visual graph.

GET /api/relations

List all relations. Optionally scope the result to edges that originate from or point to a specific node.

Query parameters

sourceId
string
Return only relations whose source is this node ID.
targetId
string
Return only relations whose target is this node ID.
Both filters may be combined to find a relation between two specific nodes. If neither parameter is supplied, all relations in the database are returned.

Response

Returns a JSON array of Relation objects.
curl 'http://localhost:3000/api/relations?sourceId=<uuid>'
[
  {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "sourceId": "uuid-of-hegel",
    "targetId": "uuid-of-marx",
    "type": "influyo_a",
    "weight": 1.0,
    "createdAt": "2024-01-15T10:30:00.000Z"
  }
]

POST /api/relations

Create a new directed relation between two existing nodes.

Request body

sourceId
string
required
ID of the source node. Must be an existing node UUID.
targetId
string
required
ID of the target node. Must be an existing node UUID and must differ from sourceId.
type
RelationType
required
Semantic type of the relation. Must be one of the nine valid values:
ValueMeaning
es_autor_deThe source authored the target
dirigioThe source directed the target
trata_sobreThe source content is about the target concept
pertenece_aThe source belongs to the target school or category
influyo_aThe source influenced the target
critica_aThe source critiques the target
inspiroThe source was inspired by the target
ocurre_enThe source takes place during the target event or era
similar_aThe source is thematically similar to the target
weight
number
Float between 0.0 and 1.0 representing the strength of the relation. Defaults to 1.0. Edges with weight below 0.7 are stored but not displayed in the graph view.

Validation

  • sourceId and targetId must be provided and must be different.
  • Both referenced nodes must already exist — a missing node returns 404.
  • type must be one of the nine valid RelationType values.
  • weight must be a number in the range [0.0, 1.0].

Response

Returns 201 Created with the created Relation object.
curl -X POST http://localhost:3000/api/relations \
  -H "Content-Type: application/json" \
  -d '{
    "sourceId": "uuid-of-hegel",
    "targetId": "uuid-of-marx",
    "type": "influyo_a",
    "weight": 1.0
  }'
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "sourceId": "uuid-of-hegel",
  "targetId": "uuid-of-marx",
  "type": "influyo_a",
  "weight": 1.0,
  "createdAt": "2024-01-15T10:30:00.000Z"
}

DELETE /api/relations/:id

Delete a relation by its ID. This removes only the edge — neither the source nor target node is affected.

Path parameters

id
string
required
The UUID of the relation to delete.

Response

Returns { "success": true } on deletion.
curl -X DELETE http://localhost:3000/api/relations/a1b2c3d4-e5f6-7890-abcd-ef1234567890
{ "success": true }

TypeScript interface

The Relation type returned by all endpoints is defined in @babel-plus/shared:
export interface Relation {
  id: string
  sourceId: string
  targetId: string
  type: RelationType
  weight: number
  createdAt: string
}

export type RelationType =
  | 'es_autor_de'
  | 'dirigio'
  | 'trata_sobre'
  | 'pertenece_a'
  | 'influyo_a'
  | 'critica_a'
  | 'inspiro'
  | 'ocurre_en'
  | 'similar_a'

Build docs developers (and LLMs) love