Create apple
Ingests an Apple Personal Knowledge Graph snapshot — live stable_graph triples, withdrawn expired_stable_graph rows and entityTagging kinship scorecards — into the organization's assertion plane.
POST /v1/graph/apple
| Address | https://api.hanzo.ai/v1/graph/apple |
| Method | POST |
| Operation | graphApple |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Ingests an Apple Personal Knowledge Graph snapshot — live stable_graph triples, withdrawn expired_stable_graph rows and entityTagging kinship scorecards — into the organization's assertion plane.
Two-row reified edges sharing a relationship_id (one naming a CS*/nm_* relationship type under PS1, the other pointing at the target entity) are collapsed into edges under their canonical relation names while preserving the raw Apple predicate and relationship class in evidence. Withdrawn rows in expired are recorded with until stamped so they remain inspectable in history without holding as live facts.
Time: at is the snapshot's valid instant, which an as_of read is bounded by; the server stamps knowable at the write, which an as_known read is bounded by.
Request
30 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
at | body | string | yes | At is the valid instant of the snapshot, RFC 3339. |
expired | body | graph.graphAppleTriple[] | — | Expired is the withdrawn rows from expired_stable_graph. |
expired[].confidence | body | number (double) | — | Confidence is the daemon's certainty in [0,1]. |
expired[].object | body | string | yes | Object is the target entity identifier, class code or scalar literal. |
expired[].predicate | body | string | yes | Predicate is the predicate code, such as PS1, PS33, PS500 or PS598. |
expired[].relationship_id | body | string | — | RelationshipID groups the two rows of a reified edge in stable_graph: one row with RelationshipPredicate PS1 naming the CS*/nm_* relationship class, and a companion row naming the target entity or value. |
expired[].relationship_predicate | body | string | — | RelationshipPredicate is the sub-predicate on a reified edge row, such as PS1 for the relationship class or PS45 for the target entity. |
expired[].source_duplicates | body | integer (int64) | — | SourceDuplicates is how many duplicate source records backed the row. |
expired[].sources | body | string | — | Sources names the OS stores that contributed the row, such as Contacts, Calendar, Photos or Family Sharing. |
expired[].subject | body | string | yes | Subject is the source entity identifier in graph.db, such as 9100000000007919. |
expired[].timestamp | body | string | — | Timestamp is when the daemon recorded the row, RFC 3339. |
expired[].until | body | string | — | Until is when a withdrawn row in expired_stable_graph stopped holding, RFC 3339. |
owner | body | string | — | Owner is the entity key for the device owner ("(Me)"). |
scorecards | body | graph.graphAppleScorecard[] | — | Scorecards is the per-person kinship probability rows from entityTagging.db. |
scorecards[].entity | body | string | yes | Entity is the person's identifier in the graph. |
scorecards[].features | body | number (double)[] | — | Features is the optional 144-element numeric input vector in metadata.json order (0..19 identity, 20..59 communication, 60..143 photos). |
scorecards[].scores | body | object | yes | Scores maps each relationship column (mother, father, parent, sister, brother, sibling, daughter, son, child, partner, coworker, friend, family, familyAndFriends, alumni, unknown) to its probability in [0,1]. |
scorecards[].scores.* | body | number (double) | — | |
source | body | string | — | Source names the device or store this snapshot came from. |
triples | body | graph.graphAppleTriple[] | — | Triples is the live rows from stable_graph. |
triples[].confidence | body | number (double) | — | Confidence is the daemon's certainty in [0,1]. |
triples[].object | body | string | yes | Object is the target entity identifier, class code or scalar literal. |
triples[].predicate | body | string | yes | Predicate is the predicate code, such as PS1, PS33, PS500 or PS598. |
triples[].relationship_id | body | string | — | RelationshipID groups the two rows of a reified edge in stable_graph: one row with RelationshipPredicate PS1 naming the CS*/nm_* relationship class, and a companion row naming the target entity or value. |
triples[].relationship_predicate | body | string | — | RelationshipPredicate is the sub-predicate on a reified edge row, such as PS1 for the relationship class or PS45 for the target entity. |
triples[].source_duplicates | body | integer (int64) | — | SourceDuplicates is how many duplicate source records backed the row. |
triples[].sources | body | string | — | Sources names the OS stores that contributed the row, such as Contacts, Calendar, Photos or Family Sharing. |
triples[].subject | body | string | yes | Subject is the source entity identifier in graph.db, such as 9100000000007919. |
triples[].timestamp | body | string | — | Timestamp is when the daemon recorded the row, RFC 3339. |
triples[].until | body | string | — | Until is when a withdrawn row in expired_stable_graph stopped holding, RFC 3339. |
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 apple --at <at>import { Configuration, GraphApi } from 'hanzoai';
const api = new GraphApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.graphApple({ at: "<at>" });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_apple(at="<at>")cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.GraphAPI.GraphApple(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_apple(&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).graphApple();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were 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/apple \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"at": "<at>"
}'Tool graph, op graphApple — 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": "graphApple",
"input": {
"at": "<at>"
}
}
}
}'