Skip to main content
POST
/
v1
/
graph
/
edges
Add dependency
curl --request POST \
  --url https://api.example.com/v1/graph/edges \
  --header 'Content-Type: application/json' \
  --data '
{
  "sourceServiceId": "<string>",
  "targetServiceId": "<string>",
  "type": "<string>"
}
'

Overview

Adds a directed dependency edge between two existing service nodes in your topology graph. Edges represent the direction of dependency: sourceServiceId depends on targetServiceId. This directional information is used when calculating blast radius — a failure in targetServiceId propagates to all services that depend on it. Required role: admin or member

Request body

sourceServiceId
string
required
The identifier of the service that has the dependency (the caller or consumer). This service depends on targetServiceId.
targetServiceId
string
required
The identifier of the service being depended upon (the provider or upstream). A failure in this service may affect sourceServiceId.
type
string
required
The communication protocol used for this dependency. One of: http, grpc, tcp, queue.
ValueDescription
httpSynchronous HTTP/HTTPS call
grpcgRPC call
tcpRaw TCP connection (database drivers, custom protocols)
queueAsynchronous message queue or event stream

Response

Returns 201 Created with the newly created dependency edge.
{
  "edgeId": "edg_01HX9VTPQR3KF8MZWBYD5N6JCE",
  "sourceServiceId": "svc_01HX9VTPQR3KF8MZWBYD5N6JCE",
  "targetServiceId": "svc_01HX9VTPQR3KF8MZWBYD5N6JCF",
  "type": "http",
  "createdAt": "2024-04-01T10:05:00Z"
}
FieldTypeDescription
edgeIdstringUnique identifier for the dependency edge
sourceServiceIdstringThe dependent service (the one that calls the target)
targetServiceIdstringThe upstream service (the one being called)
typestringCommunication protocol for this dependency
createdAtstringISO 8601 timestamp when the edge was created

Error responses

StatusError codeDescription
400validation_errorA required field is missing or type is not a valid value
404not_foundsourceServiceId or targetServiceId does not exist in your topology
409conflictAn edge between these two services with this type already exists
Edge direction matters for blast radius calculations. checkout-service → payment-processor means checkout depends on payment-processor. A failure in payment-processor will appear in checkout-service’s blast radius, not the other way around.

Examples

# checkout-service depends on payment-processor via HTTP
curl https://api.causeflow.ai/v1/graph/edges \
  -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "sourceServiceId": "svc_01HX9VTPQR3KF8MZWBYD5N6JCE",
    "targetServiceId": "svc_01HX9VTPQR3KF8MZWBYD5N6JCF",
    "type": "http"
  }'