Skip to main content

Edges API

Manage knowledge graph edges (relationships between nodes).

Base URL: /api/v1/edges


List Edges

GET /api/v1/edges

Returns a paginated list of edges. Supports filtering by source node, source documents, and a minimal mode for large graphs.

Query Parameters

ParameterTypeRequiredDefaultDescription
source_node_idstringNoFilter edges originating from this node
source_idslist[string]NoFilter by source document IDs (repeat param for multiple)
pageintNo1Page number (starts at 1)
page_sizeintNo50Items per page (max 1000)
minimalboolNofalseReturn only essential fields for better performance
Minimal mode

When minimal=true, only id, source_node_id, target_node_id, label, and template_id are loaded. Properties are excluded for better performance with large graphs.

Example Request

curl "http://localhost:8080/api/v1/edges?source_node_id=node-abc-123"

Filtering by multiple source documents:

curl -X GET "http://localhost:8080/api/v1/edges?source_ids=src-001&source_ids=src-002"

Response — 200 OK

{
"data": [
{
"id": "edge-550e8400-e29b-41d4-a716-446655440000",
"template_id": "rel-works-at",
"source_node_id": "node-abc-123",
"target_node_id": "node-def-456",
"label": "works at",
"properties": {
"start_date": "2020-01",
"role": "Senior Researcher"
},
"created_at": "2026-03-01T10:30:00",
"updated_at": "2026-03-01T10:30:00"
}
],
"pagination": {
"page": 1,
"page_size": 20,
"total": 1,
"total_pages": 1,
"has_next": false,
"has_prev": false
}
}

Create Edge

POST /api/v1/edges

Creates a new edge (relationship) between two existing nodes.

Request Body

FieldTypeRequiredDefaultDescription
template_idstringYesRelationship type template ID
source_node_idstringYesSource node ID (from)
target_node_idstringYesTarget node ID (to)
labelstringYesHuman-readable relationship label
propertiesobjectNo{}Relationship properties
source_idstringNonullSource document ID for filtering

Example Request

curl -X POST http://localhost:8080/api/v1/edges \
-H "Content-Type: application/json" \
-d '{
"template_id": "rel-works-at",
"source_node_id": "node-abc-123",
"target_node_id": "node-def-456",
"label": "works at",
"properties": {
"start_date": "2020-01",
"role": "Senior Researcher"
}
}'

Response — 201 Created

{
"id": "edge-550e8400-e29b-41d4-a716-446655440000",
"template_id": "rel-works-at",
"source_node_id": "node-abc-123",
"target_node_id": "node-def-456",
"label": "works at",
"properties": {
"start_date": "2020-01",
"role": "Senior Researcher"
},
"created_at": "2026-03-01T10:30:00",
"updated_at": "2026-03-01T10:30:00"
}

Get Edge

GET /api/v1/edges/{edge_id}

Returns full details for a single edge.

Path Parameters

ParameterTypeRequiredDescription
edge_idstringYesEdge ID

Example Request

curl -X GET http://localhost:8080/api/v1/edges/edge-550e8400-e29b-41d4-a716-446655440000

Response — 200 OK

{
"id": "edge-550e8400-e29b-41d4-a716-446655440000",
"template_id": "rel-works-at",
"source_node_id": "node-abc-123",
"target_node_id": "node-def-456",
"label": "works at",
"properties": {
"start_date": "2020-01",
"role": "Senior Researcher"
},
"created_at": "2026-03-01T10:30:00",
"updated_at": "2026-03-01T10:30:00"
}

Errors

StatusDescription
404Edge not found

Update Edge

PATCH /api/v1/edges/{edge_id}

Partially updates an existing edge. Only provided fields are modified.

Path Parameters

ParameterTypeRequiredDescription
edge_idstringYesEdge ID

Request Body

FieldTypeRequiredDescription
labelstringNoNew relationship label
propertiesobjectNoNew properties (full replacement, not merge)
Properties are replaced, not merged

Providing properties replaces the entire properties object. Include all desired properties in the update, not just the changed ones.

Example Request

curl -X PATCH http://localhost:8080/api/v1/edges/edge-550e8400-e29b-41d4-a716-446655440000 \
-H "Content-Type: application/json" \
-d '{
"label": "employed by",
"properties": {
"role": "Director",
"start_date": "2020-01"
}
}'

Response — 200 OK

Returns the full updated edge. Same schema as Get Edge.

Errors

StatusDescription
404Edge not found

Delete Edge

DELETE /api/v1/edges/{edge_id}

Permanently deletes an edge.

Path Parameters

ParameterTypeRequiredDescription
edge_idstringYesEdge ID

Example Request

curl -X DELETE http://localhost:8080/api/v1/edges/edge-550e8400-e29b-41d4-a716-446655440000

Response — 204 No Content

No response body.

Errors

StatusDescription
404Edge not found

Batch Operations

POST /api/v1/edges/batch

Queues a batch of create, update, and delete operations for background processing on the Operations queue.

Request Body

FieldTypeRequiredDescription
operationslistYesList of operation objects
operations[].operationstringYes"create", "update", or "delete"
operations[].dataobjectYesOperation-specific data (see below)

Operation data by type:

  • create — Provide template_id, source_node_id, target_node_id, label, and optionally properties.
  • update — Provide id of the edge to update, plus label and/or properties.
  • delete — Provide id of the edge to delete.

Example Request

curl -X POST http://localhost:8080/api/v1/edges/batch \
-H "Content-Type: application/json" \
-d '{
"operations": [
{
"operation": "create",
"data": {
"template_id": "rel-works-at",
"source_node_id": "node-123",
"target_node_id": "node-456",
"label": "relates_to",
"properties": {"strength": 0.8}
}
},
{
"operation": "update",
"data": {
"id": "edge-789",
"label": "depends_on"
}
},
{
"operation": "delete",
"data": {"id": "edge-012"}
}
]
}'

Response — 202 Accepted

{
"task_id": "task-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "queued",
"message": "Bulk edges operation queued with 3 operations"
}
Tracking batch results

Use the returned task_id to monitor progress:

Operations execute in order. If one operation fails, subsequent operations may still execute. Check the task result for individual operation outcomes.


Response Models

EdgeResponse

Returned by create, get, and update endpoints.

FieldTypeDescription
idstringUnique edge identifier
template_idstringRelationship type template ID
source_node_idstringSource node ID
target_node_idstringTarget node ID
labelstringHuman-readable relationship label
propertiesobjectKey-value properties
created_atdatetimeCreation timestamp
updated_atdatetimeLast update timestamp

PaginatedEdgesResponse

Returned by the list endpoint.

FieldTypeDescription
datalist[EdgeResponse]Array of edge objects
paginationobjectPagination metadata
pagination.pageintCurrent page number
pagination.page_sizeintItems per page
pagination.totalintTotal number of matching edges
pagination.total_pagesintTotal number of pages
pagination.has_nextboolTrue if a next page exists
pagination.has_prevboolTrue if a previous page exists

BulkResponse

Returned by the batch endpoint.

FieldTypeDescription
task_idstringTask ID for tracking the background operation
statusstringAlways "queued" on acceptance
messagestringSummary with operation count