# Create apple

URL: https://docs.hanzo.ai/docs/openapi/graph/graphapple

> 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`

> [Graph →](https://docs.hanzo.ai/docs/openapi/graph) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **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](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo graph apple --at <at>
```

**SDK**

**.ts**

```ts
import { Configuration, GraphApi } from 'hanzoai';

const api = new GraphApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.graphApple({ at: "<at>" });
```

**.py**

```python
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>")
```

**.go**

```go
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
}
```

**.rs**

```rust
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?;
```

**.java**

```java
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. `hanzoai@8.5.914` (npm) and `hanzoai@8.5.914` (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 →](https://docs.hanzo.ai/docs/sdks)

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/graph/apple \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "at": "<at>"
     }'
```

**MCP**

Tool `graph`, op `graphApple` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
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>"
           }
         }
       }
     }'
```

---

[Graph API](https://docs.hanzo.ai/docs/openapi/graph) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
