# List ontology

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

> Lists the entity classes, predicates, classifier features and kinship scorecard columns of the personal knowledge graph ontology.

`GET /v1/graph/ontology`

> [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/ontology` |
| **Method**    | `GET`                                    |
| **Operation** | `graphOntology`                          |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`   |

Lists the entity classes, predicates, classifier features and
kinship scorecard columns of the personal knowledge graph ontology.

Every code graph.db and entityTagging.db write on macOS and iOS is here with
its plain-language reading and the canonical relation key graphApple maps it
to. Filter by group or by substring q.

Time: it takes no as\_of or as\_known; the shipped catalog is static.

## Request

2 fields.

| Field   | In    | Type   | Required | Description                                                                                                                                        |
| ------- | ----- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `group` | query | string | —        | Group narrows classes or features to one group, such as core, person, activity, edge, identity, communication or photos.                           |
| `q`     | query | string | —        | Q narrows classes, predicates and features to entries whose code, label, canonical relation or source contains this substring, case-insensitively. |

## Response

| Status    | Body                   | Meaning |
| --------- | ---------------------- | ------- |
| `200`     | graph.graphOntologyOut | ok      |
| `default` | problem-details        | refused |

`200` body — 19 fields.

| Field                    | In   | Type                            | Always | Description                                                                                                                                           |
| ------------------------ | ---- | ------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `classes`                | body | graph.graphOntologyClass\[]     | —      | Classes is the matching entity classes (181 in the unfiltered catalog).                                                                               |
| `classes[].edge`         | body | boolean                         | —      | Edge is true for the relationship-type classes (CS\* and nm\_\*RelationshipType) that reify a two-row edge sharing a relationshipId in stable\_graph. |
| `classes[].group`        | body | string                          | —      | Group is the class family: core, person, attribute, place, event, activity, activity type, transport, media, animal, commerce or edge.                |
| `classes[].id`           | body | string                          | —      | ID is the raw code stored in graph.db, such as SB104, CS165 or nm\_walletOrder.                                                                       |
| `classes[].label`        | body | string                          | —      | Label is the human-readable class name, such as person or employment relationship type.                                                               |
| `classes[].mechanism`    | body | string                          | —      | Mechanism records whether the daemon mechanism populating the class is implemented, unverified or unlocated.                                          |
| `features`               | body | graph.graphOntologyFeature\[]   | —      | Features is the matching EntityTagging classifier features (144 in the unfiltered catalog).                                                           |
| `features[].group`       | body | string                          | —      | Group is the feature block: identity (0..19), communication (20..59) or photos (60..143).                                                             |
| `features[].index`       | body | integer (int64)                 | —      | Index is the feature's 0-based position (0..143) in metadata.json.                                                                                    |
| `features[].name`        | body | string                          | —      | Name is Apple's feature identifier, such as sameLastName or photosPersonPosteriorProbabilityGivenSaturdayNight.                                       |
| `predicates`             | body | graph.graphOntologyPredicate\[] | —      | Predicates is the matching predicates (278 in the unfiltered catalog).                                                                                |
| `predicates[].id`        | body | string                          | —      | ID is the raw predicate code stored in graph.db, such as PS1, PS500 or nm\_isCurrentUser.                                                             |
| `predicates[].label`     | body | string                          | —      | Label is the plain-language reading of what the predicate records.                                                                                    |
| `predicates[].mechanism` | body | string                          | —      | Mechanism records whether the daemon mechanism is implemented, unverified or unlocated.                                                               |
| `predicates[].method`    | body | string                          | —      | Method names how the daemon obtains the value: Copied, Joined, Rule, Apple-shipped, Embedding model, XGBoost, Face clustering or Local LLM.           |
| `predicates[].names`     | body | boolean                         | —      | Names is true when the predicate links its subject to another entity rather than a scalar literal.                                                    |
| `predicates[].relation`  | body | string                          | —      | Relation is the canonical snake\_case relation key this plane files the predicate under when ingesting an Apple graph.                                |
| `predicates[].source`    | body | string                          | —      | Source names the OS store or subsystem the daemon reads the predicate from.                                                                           |
| `score_columns`          | body | string\[]                       | —      | ScoreColumns is the 17 relationship columns of entityTagging.db's kinship scorecard.                                                                  |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo graph ontology
```

**SDK**

**.ts**

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

const api = new GraphApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.graphOntology();
```

**.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_ontology()
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.GraphAPI.GraphOntology(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_ontology(&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).graphOntology();
```

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 https://api.hanzo.ai/v1/graph/ontology \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `graph`, op `graphOntology` — 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": "graphOntology",
           "input": {}
         }
       }
     }'
```

---

[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)
