Concepts
Ontology stores your organization’s structure as one graph: nodes are entities, relations are the facts connecting them. Read the types before you write, and read by point in time to recover history.
Types
A type is registered structure up front: it says which entities and which facts the graph accepts. Types are not created at runtime — the service that owns the record registers them when it deploys — so a name that is not in the type list cannot be written. Which types you can write is whatever GET /ontology/v1/types returns.
GET /ontology/v1/types lists every registration in force for your organization; GET /ontology/v1/types/{name} reads one type’s full definition. A type is either a node type or a relation type (kind is node or edge), returned with the owner and version it came from.
| Field | Meaning |
|---|---|
name | The type name you use as type when creating a node or relation; a dotted name marks a namespaced subtype |
ref_prefix | Optional, node types only. A node carrying a ref must have an external record id starting with this prefix; pure concept types have none |
weight | 0–1, how much reaching this type matters when ranking |
passable | False makes it a stopping point: reached, never expanded |
source / target | Node type names a relation type admits at each end; a single * admits every type |
direction | forward reads from source to target only; both holds equally in both directions |
functional | True means a source may hold at most one valid relation of this type at a time; a new one supersedes the old |
persistence | Optional, 0–1: how strongly the relation holds while valid; 1 never fades, and omitting it uses the default decay |
origins | Which origins a relation of this type may carry |
weight, passable, persistence and origins are set by the service that registers the type and used by the platform when it reads and expands neighborhoods; you normally do not set them.
A relation’s origin is one of four values, seen when you read a relation. A changeset’s relate operation may set it, and it must then stay inside the set the type declares. On POST /ontology/v1/relations the platform writes platform — a registered service mirroring a record it owns — and does not read it from the request body.
| Value | Meaning |
|---|---|
platform | A registered service mirrored a record it owns, so the fact is as authoritative as that record |
stated | A person said it: believable, and equally possible to be mistaken |
observed | The platform watched it happen, so it is evidence rather than testimony |
inferred | Derived by reasoning over other facts: the weakest, and the first to be revised |
Nodes
A node is one entity. Its id looks like ond_ plus 32 lowercase letters or digits — treat it as opaque and don’t parse it.
| Field | Meaning |
|---|---|
id | Node id, used by relations, merges and later reads |
type | The registered node type it was created as; it never changes afterwards |
ref | Id of the mirrored record in the service that owns it, matching the type’s ref_prefix; null for a concept with no external record |
name | Display name, at most 200 characters |
aliases | Other names it is known by; search matches them alongside the name |
description | Profile of the entity, at most 500 characters, null when none was recorded |
owner | Member id whose content this is; null means readable organization-wide |
merged_into | The survivor’s id when this node was merged into another |
created_at / updated_at | When it was first recorded, and when its content last changed |
deleted_at | When the mirrored record is known to have been deleted, kept so history stays answerable |
PATCH /ontology/v1/nodes/{node_id} changes the name, aliases or description. Send only what changes: omitted fields keep their values, and only an explicit null clears description. Type and identity are not changed here.
Permission: a node you may reach but not read comes back with only id, type, name and restricted: true. The name confirms you reached the entity you meant, while the content stays withheld.
Relations
A relation is one fact. Its id looks like oed_ plus 32 lowercase letters or digits — also opaque.
| Field | Meaning |
|---|---|
id | Relation id, used by invalidation and later reads |
type | The registered relation type it was recorded as; it must admit both endpoints |
source / target | Node ids the fact runs between |
fact | The relationship in one sentence, at most 280 characters, written to read back on its own |
origin | Where the fact came from; must be among the type’s origins |
confidence | 0–1, how strongly the fact is held |
owner | Member id whose content this fact is; null means readable organization-wide. Another member’s relation reads as not found |
valid_at / invalid_at | When it became true in the world, and when it stopped being true |
created_at / expired_at | When it was recorded, and when it was judged no longer true |
superseded_by | The relation that replaced this one, when the invalidation named a successor |
archived_at | When it was archived out of spreading; reads by time still reach it |
The two clocks
Every fact carries two clocks, and they are not the same thing:
- World time,
valid_at/invalid_at: when the fact became true in the world, and when it stopped being true. Anullvalid_atmeans it was never dated, so treat it as true since it was recorded. - System time,
created_at/expired_at: when the platform recorded it, and when the platform judged it no longer true.expired_atalways trailsinvalid_at.
The read endpoints’ as_of (an ISO 8601 timestamp) reads by world time: a node recorded later is absent, and a relation invalidated later still counts.
Invalidate, never delete
There is no delete. When a fact stops being true, POST /ontology/v1/relations/{relation_id}/invalidate moves its invalid_at to that world time. The relation stays in the graph and still reads at an earlier as_of, so history stays answerable.
Only invalid_at is required. Use superseded_by to name the relation that replaced it, and reason to say why — reason is not enforced, but whoever reads the history later will be grateful.
GET /ontology/v1/relations returns only currently valid relations by default; pass include_invalid=true to see the invalidated ones too.
Merge
When two records turn out to be the same entity, POST /ontology/v1/nodes/{node_id}/merge folds the duplicate into the node that should survive, with a body of {"into": "<survivor node id>"}. The merged node’s relations and aliases move to the survivor, and later reads of the duplicate id resolve to it.
Merge is idempotent: resending the same idempotency key replays the first result. Splitting it apart again is a staff operation and is not offered here.
Changesets
When a batch of records has to be written together and a partial write would leave the graph inconsistent, POST /ontology/v1/changesets applies the batch as one transaction: every operation succeeds, or none is applied.
The body carries at (the world time the batch describes) and ops (at most 500 operations, applied in order). Each operation names its kind in op:
op | What it does |
|---|---|
upsert_node | Create or match a node by its key, with type, name and optional ref, aliases, owner |
relate | Record a fact with type, source, target, fact and origin; either end may be a key from this batch or an existing node id |
invalidate | Move a relation’s invalid_at to the given world time, naming it with edge |
merge | Fold the from node into the into node, with a reason kept for readers of the history |
alias | Add one alias to an existing node, naming it with node and alias |
A key is a caller-local name for the node or relation this operation creates, reused by later operations in the same batch — it is not an id.
In the response, applied counts the operations that actually changed the graph; ids maps each key used in the batch to the id it produced or matched; refreshed lists relations that already held the same meaning and were refreshed rather than duplicated; and rejected lists refused operations with their index, code and reason. replayed true means the idempotency key had been seen before, nothing changed, and the first result came back.
Idempotency keys
Five writes require an Idempotency-Key header (at most 255 characters): create node, merge node, create relation, invalidate relation and apply changeset. The same key with the same content replays the first result instead of writing twice; the same key with different content answers ONTOLOGY_CONFLICT with 409 — reuse the original request for that key, or send a new key. A missing or blank key is refused.
Reading a neighborhood
GET /ontology/v1/nodes/{node_id}/neighborhood is the read to use when a screen or an agent needs one entity’s context. It returns the start node, every node within depth hops, the relations whose both ends are in that set, and a truncated flag.
| Parameter | Values | Default |
|---|---|---|
depth | 1–3, how many hops to walk | 1 |
limit | 1–500, maximum nodes returned | 200 |
direction | out follows facts this node states, in follows facts others state about it, both follows either | both |
as_of | read by world time instead of now | current state |
include_invalid | true counts relations whose invalid_at has passed | valid relations only |
When the walk reaches limit nodes it stops and reports truncated: true, so nodes is a sample of the neighborhood rather than all of it — raise limit or lower depth. A neighborhood is not a page: there is no cursor to resume from. A depth or limit outside its range is refused rather than clamped to a smaller answer.
Search
POST /ontology/v1/search resolves text to the nodes it most likely names — the call to use when you hold a name and need the node id behind it. What comes back is ranked candidates, not an answer: each gives a node id, a 0–1 score, and where the match came from — name, alias, description, or the fact of a relation around the node.
Compare scores within one response, never across queries. Narrow with types, and cap the count with limit (1–50, default 20). Confirm a candidate with GET /ontology/v1/nodes/{node_id} before writing with it.
Pagination
The list endpoints (nodes, relations) order by id and return data with next_cursor. Omit cursor for the first page, then pass next_cursor back unchanged until it is null.
Walk through it with curl and the SDK → · Range limits and error codes →