Create neighbors

Walks the in-force edges from a set of seeds and lists every entity reached, bounded.

POST /v1/graph/neighbors

Addresshttps://api.hanzo.ai/v1/graph/neighbors
MethodPOST
OperationgraphNeighbors
AuthAuthorization: Bearer $HANZO_API_KEY

Walks the in-force edges from a set of seeds and lists every entity reached, bounded.

Only the edge that holds at the point is a hop: a superseded or retracted edge is not, and neither is a property.

Time: as_of walks the graph as it stood at that instant and as_known as this plane knew it then; 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 walks the graph as it stood at an instant of the world, RFC 3339: the edges that held then.
depthbodyinteger (int64)—Depth is how many hops.
directionbodystring—Direction is out, in or both.
relationbodystring—Relation narrows the walk to one edge relation.
seedsbodystring[]yesSeeds is where the walk starts.

Response

StatusBodyMeaning
200graph.graphNeighborsOutok
defaultproblem-detailsrefused

200 body — 4 fields.

FieldInTypeAlwaysDescription
boundbodyinteger (int64)—Bound is the ceiling this walk was held to, the same for every caller, so Truncated can be read against a number rather than guessed at.
depthbodyinteger (int64)—Depth is the deepest hop count actually reached.
entitiesbodystring[]—Entities is everything reached, the seeds included, ordered by the fewest hops that reach each one and then by key.
truncatedbodyboolean—Truncated says the bound stopped the walk.

Failure carries the platform error shape — see Errors.

Examples

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

const api = new GraphApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.graphNeighbors({ seeds: ["<seeds>"] });
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_neighbors(seeds=["<seeds>"])
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.GraphAPI.GraphNeighbors(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_neighbors(&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).graphNeighbors();
curl -X POST https://api.hanzo.ai/v1/graph/neighbors \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "seeds": [
         "<seeds>"
       ]
     }'

Tool graph, op graphNeighbors — 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": "graphNeighbors",
           "input": {
             "seeds": [
               "<seeds>"
             ]
           }
         }
       }
     }'

Graph API · All Hanzo APIs · Interactive reference

Was this page useful?