Create extract
Reads the relations a source states and returns them, recording nothing.
POST /v1/graph/extract
| Address | https://api.hanzo.ai/v1/graph/extract |
| Method | POST |
| Operation | graphExtract |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Reads the relations a source states and returns them, recording nothing.
What filing would refuse is returned apart, in refused: a declaration from a caller who is not an admin of the organization, and what the declared schema refuses, checked against the store and against the types and declarations the document itself states that the caller may file.
Time: it records nothing and takes no as_of or as_known; the schema is checked as of now.
Request
4 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
at | body | string | — | At is when what the source says was so, RFC 3339. Required by ingest — which records — and read by nothing in extract, which records nothing. |
source | body | string | yes | Source names where the text came from — a URL, a document id, a page title. |
subject | body | string | — | Subject is the entity the text is about before any heading names one. |
text | body | string | yes | Text is the document. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | graph.graphExtractOut | ok |
default | problem-details | refused |
200 body — 14 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
refused | body | graph.graphTriple[] | — | Refused are the relations found that filing would refuse — a subject or object whose type is not the relation's declared domain or range, or a declaration from… |
refused[].names | body | boolean | — | Names is the author's declaration that Object is an entity and the assertion is an EDGE, written [[key]]. Absent, the relation is a property of Subject. |
refused[].object | body | string | — | Object is what the relation points at. |
refused[].predicate | body | string | — | Predicate is the relation, exactly as the line spells it before the ::. |
refused[].reason | body | string | — | Reason is why filing it would be refused: the declared schema, or a declaration from a caller who is not an admin of the organization. |
refused[].section | body | integer (int64) | — | Section is which section of the source stated it, counting from zero. |
refused[].subject | body | string | — | Subject is the entity the statement is about: the nearest heading above the line, or the request's own subject where no heading has appeared yet. |
triples | body | graph.graphTriple[] | — | Triples are the relations found that the caller may file, in the order the document states them. |
triples[].names | body | boolean | — | Names is the author's declaration that Object is an entity and the assertion is an EDGE, written [[key]]. Absent, the relation is a property of Subject. |
triples[].object | body | string | — | Object is what the relation points at. |
triples[].predicate | body | string | — | Predicate is the relation, exactly as the line spells it before the ::. |
triples[].reason | body | string | — | Reason is why filing it would be refused: the declared schema, or a declaration from a caller who is not an admin of the organization. |
triples[].section | body | integer (int64) | — | Section is which section of the source stated it, counting from zero. |
triples[].subject | body | string | — | Subject is the entity the statement is about: the nearest heading above the line, or the request's own subject where no heading has appeared yet. |
Failure carries the platform error shape — see Errors.
Examples
hanzo graph extractimport { Configuration, GraphApi } from 'hanzoai';
const api = new GraphApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.graphExtract({ source: "<source>", text: "<text>" });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_extract(source="<source>", text="<text>")cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.GraphAPI.GraphExtract(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_extract(&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).graphExtract();The method above is the one at the current release of the document. [email protected] (npm) was generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl -X POST https://api.hanzo.ai/v1/graph/extract \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": "<source>",
"text": "<text>"
}'MCP declares no tool for graph — tools/list on https://api.hanzo.ai/v1/mcp names the products it does reach. Use HTTP or an SDK.
How is this guide?