---
title: "Create a knowledge graph edge"
method: POST
path: "/knowledgeGraph/edges"
tags: ["KnowledgeGraph"]
---

# Create a knowledge graph edge

`POST /knowledgeGraph/edges`

Creates a new directed edge between two nodes in the knowledge graph. Server generates the edge_id with suffix -kge. Validates that source and destination nodes exist in the same workspace. On duplicate (source, label, destination) returns 409 with the existing edge.

## Request body

- CreateKnowledgeGraphEdgeRequest — Request body for creating a new knowledge graph edge
  - `workspace_id` string, required — The workspace to create the edge in
  - `application_id` string — The application this edge is associated with (used for auth scope)
  - `source_node_id` string, required — The source node ID (must exist in same workspace)
  - `destination_node_id` string, required — The destination node ID (must exist in same workspace)
  - `label` 'CONTAINS' | 'HAS_KNOWLEDGE' | 'DEPENDS_ON' | 'RELATED_TO' | 'COVERS', required — Label for a knowledge graph edge indicating its relationship type
  - `ordinal` integer — Ordering hint for sibling edges
  - `weight` number, double — Edge weight (0.0-1.0)
  - `description` string — Human-readable description of this relationship
  - `properties` object — Additional structured properties
  - `agent_type` string — Agent type creating this edge
  - `agent_version` string — Agent version creating this edge

## Response `201`

The created edge

- KnowledgeGraphEdge — A directed edge in the knowledge graph connecting two nodes
  - `edge_id` string — Unique identifier for the edge (server-generated, suffix -kge)
  - `workspace_id` string — The workspace this edge belongs to
  - `source_node_id` string — The source node ID
  - `destination_node_id` string — The destination node ID
  - `label` 'CONTAINS' | 'HAS_KNOWLEDGE' | 'DEPENDS_ON' | 'RELATED_TO' | 'COVERS' — Label for a knowledge graph edge indicating its relationship type
  - `ordinal` integer — Ordering hint for sibling edges
  - `weight` number, double — Edge weight (0.0-1.0)
  - `description` string — Human-readable description of this relationship
  - `properties` object — Additional structured properties for this edge
  - `version` integer — Monotonic edit counter (server-managed, readOnly)
  - `u_version_` string — ETag for optimistic locking (server-managed, readOnly)
  - `last_updated_by` string — Principal who last updated this edge (server-managed, readOnly)
  - `created_by` string — Principal who created this edge (server-managed, readOnly)
  - `agent_type` string — Agent type that wrote this edge
  - `agent_version` string — Agent version that wrote this edge
  - `created_at` string, date-time — Creation timestamp
  - `updated_at` string, date-time — Last update timestamp

## Other responses

- `400` — Invalid or missing parameter
- `401` — User not authenticated
- `403` — User not authorized
- `409` — Unknown error
- `422` — Unknown error
- `default` — Unknown error

---

[API](https://skmtc.net/mabl/apis/mabl-api.md) · [All operations](https://skmtc.net/mabl/apis/mabl-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mabl/mabl-api/revisions/d0fc0114da66/schema)
