Quickstart
Call this from your server, with the API key in a PRAXIS_API_KEY environment variable. The examples below run against https://api.deepraxis.com and cover: read the types → find a node → read a neighborhood → write a node and a relation → invalidate a relation.
1. Read the types
Start by listing the node and relation types registered for this organization: only names that appear here can be written.
curl "https://api.deepraxis.com/ontology/v1/types" \ -H "Authorization: Bearer $PRAXIS_API_KEY"{ "data": [ { "owner": "crm", "version": 1, "nodes": [ { "name": "customer", "ref_prefix": "cus_", "weight": 0.6, "passable": true, "description": "A buying customer of the organization." } ], "edges": [ { "name": "references", "source": ["customer"], "target": ["file"], "direction": "forward", "passable": true, "weight": 0.5, "functional": false, "origins": ["platform", "observed"], "description": "A record points at another record it depends on." } ] } ], "next_cursor": null}A type is either a node type or a relation type. GET /ontology/v1/types/{name} reads one type’s full definition — the call to make when you need to confirm that a relation type admits the endpoints and the origin you are about to write.
2. Find a node by name
When you hold a name and need the node id behind it, search. What comes back is ranked candidates, not an answer.
curl -X POST "https://api.deepraxis.com/ontology/v1/search" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"text":"李总","types":["customer"],"limit":5}'{ "hits": [ { "node": "ond_0123456789abcdef0123456789abcdef", "score": 0.82, "matched": "name" } ]}matched says where the match came from: name, alias, description, or the fact of a relation around the node. Compare scores within one response only, and confirm a candidate with GET /ontology/v1/nodes/{node_id} before writing with it.
3. Read one node’s neighborhood
Use the neighborhood read when you need one entity’s context, rather than pulling the whole graph. depth is how many hops to walk (1–3) and limit the most nodes to return (1–500).
curl "https://api.deepraxis.com/ontology/v1/nodes/ond_0123456789abcdef0123456789abcdef/neighborhood?depth=2&limit=50" \ -H "Authorization: Bearer $PRAXIS_API_KEY"{ "nodes": [ { "id": "ond_0123456789abcdef0123456789abcdef", "type": "customer", "name": "李总" } ], "relations": [], "truncated": false}truncated true means the node count reached limit and the walk stopped early, so nodes is a sample of the neighborhood rather than all of it. A neighborhood is not a page — there is no cursor to resume from.
4. Write a node and a relation
Writes carry an Idempotency-Key header: resending the same key with the same content replays the first result instead of writing twice.
curl -X POST "https://api.deepraxis.com/ontology/v1/nodes" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: node-cus_li-1" \ -d '{"type":"customer","ref":"cus_li","name":"李总","aliases":["李总(华东)"],"description":"华东区的采购负责人。"}'{ "id": "ond_0123456789abcdef0123456789abcdef", "type": "customer", "ref": "cus_li", "name": "李总", "aliases": ["李总(华东)"], "description": "华东区的采购负责人。", "owner": null, "merged_into": null, "created_at": "2026-11-01T00:00:00.000Z", "updated_at": "2026-11-01T00:00:00.000Z", "deleted_at": null}ref must match the type’s ref_prefix (cus_ here). Then record a fact between two node ids; the fact has to read back on its own:
curl -X POST "https://api.deepraxis.com/ontology/v1/relations" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: relation-cus_li-file_x-1" \ -d '{"type":"references","source":"ond_0123456789abcdef0123456789abcdef","target":"ond_fedcba9876543210fedcba9876543210","fact":"李总的报价单","valid_at":"2026-11-01T00:00:00.000Z"}'{ "id": "oed_0123456789abcdef0123456789abcdef", "type": "references", "source": "ond_0123456789abcdef0123456789abcdef", "target": "ond_fedcba9876543210fedcba9876543210", "fact": "李总的报价单", "origin": "platform", "confidence": 1, "owner": null, "valid_at": "2026-11-01T00:00:00.000Z", "invalid_at": null, "created_at": "2026-11-01T00:00:00.000Z", "expired_at": null, "superseded_by": null, "archived_at": null}When several records have to be written together and a partial write would leave the graph inconsistent, POST /ontology/v1/changesets applies the whole batch as one transaction.
5. Invalidate a relation
When a fact stops being true, don’t reach for a delete — there isn’t one. Move invalid_at to that world time: the relation stays in the graph and still reads at an earlier as_of.
curl -X POST "https://api.deepraxis.com/ontology/v1/relations/oed_0123456789abcdef0123456789abcdef/invalidate" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: invalidate-oed_0123456789abcdef-1" \ -d '{"invalid_at":"2026-11-01T12:00:00.000Z","reason":"李总已换供应商"}'In the response invalid_at is the time you gave, and expired_at is when the platform judged the fact no longer true — always later than invalid_at.
The TypeScript SDK
The same sequence through the official @deepraxis/sdk, whose methods live under praxis.ontology.*.
import { Praxis } from '@deepraxis/sdk';
const praxis = new Praxis({ apiKey: process.env.PRAXIS_API_KEY! });
// 1. Read the types: confirm the names before writingconst types = await praxis.ontology.types.list();for (const item of types.data) console.log(item.owner, item.version);
// 2. Find a node by nameconst found = await praxis.ontology.search.create({ body: { text: '李总', types: ['customer'], limit: 5 },});const first = found.hits[0];if (!first) throw new Error('no candidate for 李总');
// 3. Read two hops around that nodeconst neighborhood = await praxis.ontology.nodes.retrieveNeighborhood({ path: { node_id: first.node }, query: { depth: 2, limit: 50 },});console.log(neighborhood.nodes.length, neighborhood.truncated);
// 4. Idempotent writes: the same key never writes twiceconst node = await praxis.ontology.nodes.create({ body: { type: 'customer', ref: 'cus_li', name: '李总' }, headers: { 'Idempotency-Key': 'node-cus_li-1' },});const relation = await praxis.ontology.relations.create({ body: { type: 'references', source: node.id, target: 'ond_fedcba9876543210fedcba9876543210', fact: '李总的报价单', }, headers: { 'Idempotency-Key': 'relation-cus_li-file_x-1' },});
// 5. Invalidate rather than deleteawait praxis.ontology.relations.invalidate.create({ path: { relation_id: relation.id }, body: { invalid_at: '2026-11-01T12:00:00.000Z', reason: '李总已换供应商' }, headers: { 'Idempotency-Key': 'invalidate-oed_0123456789abcdef-1' },});The list methods (praxis.ontology.nodes.list, praxis.ontology.relations.list) return a Page: iterate it to fetch pages as you go, or pass next_cursor into the next request yourself.
Full field and value definitions → · Why the two clocks and invalidation work this way →