Create diff

Reports what came into force, was superseded and was retracted between two points.

POST /v1/graph/diff

Addresshttps://api.hanzo.ai/v1/graph/diff
MethodPOST
OperationgraphDiff
AuthAuthorization: Bearer $HANZO_API_KEY

Reports what came into force, was superseded and was retracted between two points.

Each point is resolved as resolve would, never read off the rows in between. A version that loses the order is invisible here as it is there, and one that repeats what held is agreement, not change.

Time: a point is an as_of and an as_known instant, from and from_known against to and to_known. Hold the known instants equal for what happened in the world; hold the valid instants equal for what the record learned. to and to_known default to now, from to to and from_known to to_known, and the two points must differ.

Request

6 fields, body application/json (required).

FieldInTypeRequiredDescription
entitybodystring—Entity narrows the diff to what was asserted about one entity.
frombodystring—From is the earlier instant of the world, RFC 3339.
from_knownbodystring—FromKnown is how much this plane had heard at the baseline, RFC 3339.
limitbodyinteger (int64)—Limit caps how many (entity, relation) pairs are examined, in key order.
tobodystring—To is the later instant of the world, RFC 3339, and may not precede From.
to_knownbodystring—ToKnown is how much it had heard at the later point, RFC 3339, and may not precede FromKnown.

Response

StatusBodyMeaning
200graph.graphDiffOutok
defaultproblem-detailsrefused

200 body — 78 fields.

FieldInTypeAlwaysDescription
assertedbodygraph.wireFact[]—Asserted is each statement holding at To that did not at From.
asserted[].atbodystring—At is when the thing was so, RFC 3339, as the asserter gave it.
asserted[].bybodystring—By is the identity that filed it — owner or owner/user — stamped from the validated principal at the write, never from the body.
asserted[].confidencebodynumber (double)—Confidence in [0,1] as the asserter gave it; absent is 0.
asserted[].entitybodystring—Entity is the thing described, in the organization's own namespace.
asserted[].evidencebodystring—Evidence points at the record the claim came from.
asserted[].idbodystring—ID is the assertion's content address, minted by the server from what was asserted.
asserted[].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.
asserted[].namesbodyboolean—Names true means the assertion is an edge and Value is an entity.
asserted[].relationbodystring—Relation is what was asserted of it.
asserted[].seenbodystring—Seen is when the asserter says it became knowable, RFC 3339.
asserted[].sourcebodystring—Source names who asserted, as the caller gave it.
asserted[].untilbodystring—Until is when the thing stopped being so, RFC 3339, as the asserter gave it.
asserted[].valuebodystring—Value is what the relation points at: another entity's key when Names is true, otherwise a scalar.
boundbodyinteger (int64)—Bound is how many pairs this diff examined at most.
frombodystring—From is the earlier instant, RFC 3339, echoed.
from_knownbodystring—FromKnown is the knowledge instant of the baseline, RFC 3339.
retractedbodygraph.graphChange[]—Retracted is each statement that held at From and no longer does at To, with what ended it as Now: the retraction, the later value, or the statement itself when its own until did.
retracted[].nowbodygraph.wireFact—
retracted[].now.atbodystring—At is when the thing was so, RFC 3339, as the asserter gave it.
retracted[].now.bybodystring—By is the identity that filed it — owner or owner/user — stamped from the validated principal at the write, never from the body.
retracted[].now.confidencebodynumber (double)—Confidence in [0,1] as the asserter gave it; absent is 0.
retracted[].now.entitybodystring—Entity is the thing described, in the organization's own namespace.
retracted[].now.evidencebodystring—Evidence points at the record the claim came from.
retracted[].now.idbodystring—ID is the assertion's content address, minted by the server from what was asserted.
retracted[].now.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.
retracted[].now.namesbodyboolean—Names true means the assertion is an edge and Value is an entity.
retracted[].now.relationbodystring—Relation is what was asserted of it.
retracted[].now.seenbodystring—Seen is when the asserter says it became knowable, RFC 3339.
retracted[].now.sourcebodystring—Source names who asserted, as the caller gave it.
retracted[].now.untilbodystring—Until is when the thing stopped being so, RFC 3339, as the asserter gave it.
retracted[].now.valuebodystring—Value is what the relation points at: another entity's key when Names is true, otherwise a scalar.
retracted[].wasbodygraph.wireFact—
retracted[].was.atbodystring—At is when the thing was so, RFC 3339, as the asserter gave it.
retracted[].was.bybodystring—By is the identity that filed it — owner or owner/user — stamped from the validated principal at the write, never from the body.
retracted[].was.confidencebodynumber (double)—Confidence in [0,1] as the asserter gave it; absent is 0.
retracted[].was.entitybodystring—Entity is the thing described, in the organization's own namespace.
retracted[].was.evidencebodystring—Evidence points at the record the claim came from.
retracted[].was.idbodystring—ID is the assertion's content address, minted by the server from what was asserted.
retracted[].was.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.
retracted[].was.namesbodyboolean—Names true means the assertion is an edge and Value is an entity.
retracted[].was.relationbodystring—Relation is what was asserted of it.
retracted[].was.seenbodystring—Seen is when the asserter says it became knowable, RFC 3339.
retracted[].was.sourcebodystring—Source names who asserted, as the caller gave it.
retracted[].was.untilbodystring—Until is when the thing stopped being so, RFC 3339, as the asserter gave it.
retracted[].was.valuebodystring—Value is what the relation points at: another entity's key when Names is true, otherwise a scalar.
supersededbodygraph.graphChange[]—Superseded is each property whose value at From was replaced by a different one at To, once per pair however many came in between.
superseded[].nowbodygraph.wireFact—
superseded[].now.atbodystring—At is when the thing was so, RFC 3339, as the asserter gave it.
superseded[].now.bybodystring—By is the identity that filed it — owner or owner/user — stamped from the validated principal at the write, never from the body.
superseded[].now.confidencebodynumber (double)—Confidence in [0,1] as the asserter gave it; absent is 0.
superseded[].now.entitybodystring—Entity is the thing described, in the organization's own namespace.
superseded[].now.evidencebodystring—Evidence points at the record the claim came from.
superseded[].now.idbodystring—ID is the assertion's content address, minted by the server from what was asserted.
superseded[].now.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.
superseded[].now.namesbodyboolean—Names true means the assertion is an edge and Value is an entity.
superseded[].now.relationbodystring—Relation is what was asserted of it.
superseded[].now.seenbodystring—Seen is when the asserter says it became knowable, RFC 3339.
superseded[].now.sourcebodystring—Source names who asserted, as the caller gave it.
superseded[].now.untilbodystring—Until is when the thing stopped being so, RFC 3339, as the asserter gave it.
superseded[].now.valuebodystring—Value is what the relation points at: another entity's key when Names is true, otherwise a scalar.
superseded[].wasbodygraph.wireFact—
superseded[].was.atbodystring—At is when the thing was so, RFC 3339, as the asserter gave it.
superseded[].was.bybodystring—By is the identity that filed it — owner or owner/user — stamped from the validated principal at the write, never from the body.
superseded[].was.confidencebodynumber (double)—Confidence in [0,1] as the asserter gave it; absent is 0.
superseded[].was.entitybodystring—Entity is the thing described, in the organization's own namespace.
superseded[].was.evidencebodystring—Evidence points at the record the claim came from.
superseded[].was.idbodystring—ID is the assertion's content address, minted by the server from what was asserted.
superseded[].was.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.
superseded[].was.namesbodyboolean—Names true means the assertion is an edge and Value is an entity.
superseded[].was.relationbodystring—Relation is what was asserted of it.
superseded[].was.seenbodystring—Seen is when the asserter says it became knowable, RFC 3339.
superseded[].was.sourcebodystring—Source names who asserted, as the caller gave it.
superseded[].was.untilbodystring—Until is when the thing stopped being so, RFC 3339, as the asserter gave it.
superseded[].was.valuebodystring—Value is what the relation points at: another entity's key when Names is true, otherwise a scalar.
tobodystring—To is the later instant, RFC 3339: the one asked for, or the server's clock when none was.
to_knownbodystring—ToKnown is the knowledge instant of the later point, RFC 3339.
truncatedbodyboolean—Truncated says more pairs gathered assertions in the interval than Bound, or that one pair holds more than a single read returns.

Failure carries the platform error shape — see Errors.

Examples

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

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

resp, _, err := client.GraphAPI.GraphDiff(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_diff(&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).graphDiff();
curl -X POST https://api.hanzo.ai/v1/graph/diff \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "entity": "<entity>",
       "from": "<from>"
     }'

Tool graph, op graphDiff — 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": "graphDiff",
           "input": {
             "entity": "<entity>",
             "from": "<from>"
           }
         }
       }
     }'

Graph API · All Hanzo APIs · Interactive reference

Was this page useful?