Create graph
Records a batch of assertions and counts what became of each.
POST /v1/graph
| Address | https://api.hanzo.ai/v1/graph |
| Method | POST |
| Operation | graphAssert |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Records a batch of assertions and counts what became of each.
Each member is judged alone: one refusal does not discard the rest, and a member this plane already holds is a duplicate, not a refusal. A batch with nothing admitted answers 400.
Time: at and until are when the statement was so, which an as_of read is bounded by; the server stamps knowable, the later of seen and its own clock, which an as_known read is bounded by. Nothing is overwritten: a correction is the statement filed again, and the version known latest speaks for it.
Request
11 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
assertions | body | graph.graphFact[] | yes | Assertions is the batch. |
assertions[].at | body | string | yes | At is when the thing was so, RFC 3339. |
assertions[].confidence | body | number (double) | — | Confidence in [0,1]. |
assertions[].entity | body | string | yes | Entity is the thing being described, in the organization's own namespace. |
assertions[].evidence | body | string | — | Evidence points at the record this claim came from, 512 bytes at most. |
assertions[].names | body | boolean | — | Names says the value is an entity. |
assertions[].relation | body | string | yes | Relation is what is being asserted — depends, owner, same, title — and a key, folded as Entity is. |
assertions[].seen | body | string | — | Seen is when this assertion became knowable, RFC 3339. |
assertions[].source | body | string | yes | Source names who asserted. |
assertions[].until | body | string | — | Until is when the thing stopped being so, RFC 3339, and must follow At. |
assertions[].value | body | string | — | Value is what the relation points at. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | graph.graphAssertOut | ok |
default | problem-details | refused |
200 body — 4 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
duplicate | body | integer (int64) | — | Duplicate is how many members this plane already held. |
reasons | body | string[] | — | Reasons names why each refused member was refused, in the order sent. |
recorded | body | integer (int64) | — | Recorded is how many members became new rows. |
refused | body | integer (int64) | — | Refused is how many members were turned away — a missing entity, a timestamp that is not RFC 3339, a confidence outside [0,1], a relation whose declared domain or range the entity's type does not meet, or a declaration from a caller who is not an admin of the organization. |
Failure carries the platform error shape — see Errors.
Examples
hanzo graph createimport { Configuration, GraphApi } from 'hanzoai';
const api = new GraphApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.graphAssert({ assertions: [{"entity":"<entity>","relation":"<relation>","at":"<at>","source":"<source>"}] });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_assert(assertions=[{"entity":"<entity>","relation":"<relation>","at":"<at>","source":"<source>"}])cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.GraphAPI.GraphAssert(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_assert(&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).graphAssert();curl -X POST https://api.hanzo.ai/v1/graph \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"assertions": [
{
"entity": "<entity>",
"relation": "<relation>",
"at": "<at>",
"source": "<source>"
}
]
}'Tool graph, op graphAssert — 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": "graphAssert",
"input": {
"assertions": [
{
"entity": "<entity>",
"relation": "<relation>",
"at": "<at>",
"source": "<source>"
}
]
}
}
}
}'