Create path

Finds the shortest chain of in-force edges from one entity to another.

POST /v1/graph/path

Addresshttps://api.hanzo.ai/v1/graph/path
MethodPOST
OperationgraphPath
AuthAuthorization: Bearer $HANZO_API_KEY

Finds the shortest chain of in-force edges from one entity to another.

It is the walk behind neighbors stopped at a goal: the same bound and the same rule for which edge is in force. A causal chain is this op with relations naming the relations that mean cause, such as caused_by and influenced.

Time: as_of and as_known place the graph the path is found in; either absent is now.

Request

6 fields, body application/json (required).

FieldInTypeRequiredDescription
as_knownbodystring—AsKnown is how much this plane had heard, RFC 3339: the answer as it would have been given then, which is what makes a past answer reproducible.
as_ofbodystring—AsOf finds the path through the graph as it stood at an instant of the world, RFC 3339: an edge that did not hold then is not crossed.
directionbodystring—Direction is out, in or both.
frombodystringyesFrom is the entity the path starts at.
relationsbodystring[]—Relations is the edge relations a path may cross.
tobodystringyesTo is the entity the path ends at.

Response

StatusBodyMeaning
200graph.graphPathOutok
defaultproblem-detailsrefused

200 body — 35 fields.

FieldInTypeAlwaysDescription
as_knownbodystring—AsKnown is the knowledge instant it was taken at, RFC 3339, the same way.
as_ofbodystring—AsOf is the instant the path was taken at, RFC 3339: the one asked for, or the server's clock when none was.
boundbodyinteger (int64)—Bound is the ceiling the search was held to, the same one a walk is.
decaybodynumber (double)—Decay is the product of the edges' confidences: how much certainty survives the whole chain.
edgesbodygraph.wireFact[]—Edges is the path from From to To, one assertion per hop, each with its source, evidence and filer.
edges[].atbodystring—At is when the thing was so, RFC 3339, as the asserter gave it.
edges[].bybodystring—By is the identity that filed it — owner or owner/user — stamped from the validated principal at the write, never from the body.
edges[].confidencebodynumber (double)—Confidence in [0,1] as the asserter gave it; absent is 0.
edges[].entitybodystring—Entity is the thing described, in the organization's own namespace.
edges[].evidencebodystring—Evidence points at the record the claim came from.
edges[].idbodystring—ID is the assertion's content address, minted by the server from what was asserted.
edges[].knowablebodystring—Knowable is the first instant this plane could have answered with the assertion, RFC 3339: the later of Seen and the server's clock at the write.
edges[].namesbodyboolean—Names true means the assertion is an edge and Value is an entity.
edges[].relationbodystring—Relation is what was asserted of it.
edges[].seenbodystring—Seen is when the asserter says it became knowable, RFC 3339.
edges[].sourcebodystring—Source names who asserted, as the caller gave it.
edges[].untilbodystring—Until is when the thing stopped being so, RFC 3339, as the asserter gave it.
edges[].valuebodystring—Value is what the relation points at: another entity's key when Names is true, otherwise a scalar.
foundbodyboolean—Found is false when no path of in-force edges joins the two within the bound.
hopsbodyinteger (int64)—Hops is how many edges the path crosses: zero when From is To, and zero when nothing was found.
truncatedbodyboolean—Truncated says the bound stopped the search before a path was found, so Found false means none within the bound rather than none at all.
weakestbodygraph.wireFact—
weakest.atbodystring—At is when the thing was so, RFC 3339, as the asserter gave it.
weakest.bybodystring—By is the identity that filed it — owner or owner/user — stamped from the validated principal at the write, never from the body.
weakest.confidencebodynumber (double)—Confidence in [0,1] as the asserter gave it; absent is 0.
weakest.entitybodystring—Entity is the thing described, in the organization's own namespace.
weakest.evidencebodystring—Evidence points at the record the claim came from.
weakest.idbodystring—ID is the assertion's content address, minted by the server from what was asserted.
weakest.knowablebodystring—Knowable is the first instant this plane could have answered with the assertion, RFC 3339: the later of Seen and the server's clock at the write.
weakest.namesbodyboolean—Names true means the assertion is an edge and Value is an entity.
weakest.relationbodystring—Relation is what was asserted of it.
weakest.seenbodystring—Seen is when the asserter says it became knowable, RFC 3339.
weakest.sourcebodystring—Source names who asserted, as the caller gave it.
weakest.untilbodystring—Until is when the thing stopped being so, RFC 3339, as the asserter gave it.
weakest.valuebodystring—Value is what the relation points at: another entity's key when Names is true, otherwise a scalar.

Failure carries the platform error shape — see Errors.

Examples

hanzo graph path
import { Configuration, GraphApi } from 'hanzoai';

const api = new GraphApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.graphPath({ from: "<from>", to: "<to>" });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import GraphApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = GraphApi(client).graph_path(from="<from>", to="<to>")
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.GraphAPI.GraphPath(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, graph_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = graph_api::graph_path(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.GraphApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new GraphApi(client).graphPath();
curl -X POST https://api.hanzo.ai/v1/graph/path \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "from": "<from>",
       "to": "<to>"
     }'

Tool graph, op graphPath — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "graph",
         "arguments": {
           "op": "graphPath",
           "input": {
             "from": "<from>",
             "to": "<to>"
           }
         }
       }
     }'

Graph API · All Hanzo APIs · Interactive reference

Was this page useful?