graph

Create Graph Edge

Create a user-declared edge between two memories in a context (#1416).

REST twin of the MCP create_edge tool: both call the shared services.edge_service.create_declared_edge so the deterministic declared-duplicate contract (#1321) and the #1403 supersede accept/self-heal behave identically. The web UI's confirm→create flow for a supersede suggestion posts here with edge_type="supersedes"; accepting a stored suggestion clears the supersede_candidate in the same transaction.

Authorization: mirrors the MCP create_edge tool and the REST remember / patch writers — workspace membership at member level or higher (viewers are read-only). Resolution goes through resolve_context_for_workspace_read, which returns a uniform 404 on every deny path (context not found, caller not a workspace member, viewer, private-context non-creator, whitelist/agent-binding miss) so context existence never leaks across workspace/privacy boundaries (CWE-639 / OWASP A01). Both endpoints must be live memories in the resolved (workspace, context) — a missing/out-of-scope/deleted endpoint is a 404, which also closes the edge write-time invariant the /graph read paths defend against.

Status: 201 when a new edge is created; 200 for updated / unchanged; 409 when a differing declared edge already exists (unless overwrite=true).

post/api/v1/graph/edges

Request

  • Base URL: https://memory.kagura-ai.com (the document declares no server; this is the origin it was published from)
  • URL: https://memory.kagura-ai.com/api/v1/graph/edges
  • Auth: none declared

Headers

authorizationstring nullable

Request body

context_idstring uuid required
source_idstring uuid required
target_idstring uuid required
edge_typestring
weightnumber
confidencenumber
overwriteboolean

Response

Successful Response

operationstring required
edgeobject nullable required
previousobject nullable

Changes

No recorded changes to this operation across all 1 revision of this API.