Skip to main content

createEdge

client.knowledgeGraph.createEdge(id: string, data: CreateKGEdgeRequest): Promise<KGEdge>

Creates a new edge (relationship) in a knowledge graph instance.

Edges connect two records with a typed relationship, forming the graph structure. Each edge has a source record, target record, and relationship type.

Parameters

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the graph instance
dataCreateKGEdgeRequestYesEdge creation payload including source, target, and relationship type

Returns

Promise<KGEdge> — A promise that resolves to the newly created

Example

import { CodeBoltClient } from '@codebolt/clientsdk';

const client = new CodeBoltClient();

const result = await client.knowledgeGraph.createEdge('id', /* CreateKGEdgeRequest */);
console.log(result);