Manually create relationships between entities in the knowledge graph.

POST /v1/link

Create a manual relationship between two entities in the knowledge graph. Manual links have full confidence and supplement the automatically extracted relationships.

Request

POST /v1/link
Content-Type: application/json
Authorization: Bearer <api-key>

Body

{
  "source_entity_id": "ent_002",
  "target_entity_id": "ent_001",
  "relationship": "uses",
  "fact": "Migration completed in PR #456",
  "confidence": 0.9,
  "tenant_id": "my-app"
}

Parameters

| Field | Type | Required | Description | |---|---|---|---| | source_entity_id | string | Yes | Source entity ID | | target_entity_id | string | Yes | Target entity ID | | relationship | string | Yes | Relationship type (e.g., uses, owns, depends_on) | | fact | string | No | Human-readable description of the relationship | | confidence | float | No | Confidence score 0.0–1.0 (default: 0.9) | | tenant_id | string | Yes | Tenant identifier |

Response

Status: 201 Created

{
  "id": "lnk_x1y2z3",
  "created_at": "2026-03-15T12:00:00Z"
}

Example

curl -X POST https://api.cortexdb.ai/v1/link \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "source_entity_id": "ent_002",
    "target_entity_id": "ent_001",
    "relationship": "uses",
    "tenant_id": "my-app"
  }'

Common Relationship Types

| Type | Example | |---|---| | uses | service uses technology | | owns | person owns service | | depends_on | service depends_on service | | created | person created feature | | decided | person decided decision | | replaced | technology replaced technology | | part_of | component part_of system | | caused | event caused event | | blocked_by | task blocked_by task | | related_to | general association |