A compact HTTP surface for causal data.
The /db/v1 API covers typed graphs, evidence, deterministic views, provenance, and read-only counterfactuals. JSON is used for requests and responses.
Base URL
https://api.your-domain.com/db/v1For a local instance, the default base URL is http://localhost:9876/db/v1.
Authentication
Reachable instances use a Bearer credential. Organization keys begin with cok_; personal tokens begin with cut_. The development override also accepts an organization identifier header.
Authorization: Bearer cok_…
Content-Type: application/jsonX-Org-Id: 8f78…
Content-Type: application/jsonEndpoints
Graphs
/db/v1Service descriptor and enabled capabilities
/db/v1/graphsList graphs in the caller’s organization
/db/v1/graphsCreate a graph
/db/v1/graphs/{graphId}Read one graph
/db/v1/graphs/{graphId}Delete a graph and its data
Topology
/db/v1/graphs/{graphId}/topologyRead the typed topology
/db/v1/graphs/{graphId}/topologyReplace topology atomically
/db/v1/graphs/{graphId}/nodesAdd an event or gate
/db/v1/graphs/{graphId}/nodes/{nodeId}Update a node
/db/v1/graphs/{graphId}/edgesAdd a parent-to-child edge
Evidence & views
/db/v1/graphs/{graphId}/evidenceList evidence records
/db/v1/graphs/{graphId}/evidenceAppend evidence
/db/v1/graphs/{graphId}/views/analysisCompute or serve cached analysis
/db/v1/graphs/{graphId}/views/analysisRead with the freshness contract
/db/v1/graphs/{graphId}/views/what-ifCompute a read-only counterfactual
/db/v1/graphs/{graphId}/compileCompile a tree from mechanism facts
Provenance
/db/v1/graphs/{graphId}/revisionRead the current input revision
/db/v1/graphs/{graphId}/deltasRead changes over a revision range
/db/v1/graphs/{graphId}/snapshotsList computed-view history
/db/v1/chainsTraverse mechanism propagation
Create a graph
Request
{
"name": "packaging-line",
"description": "Causal model for line availability"
}Response · 200
{
"id": "gr_7f31c2",
"name": "packaging-line",
"stage": "active",
"created_at": "2026-08-14T04:00:00Z"
}Read analysis freshness
analysis is non-null only while the stored result revision equals the graph revision. A stale read carries the revision pair and the deltas that explain invalidation.
{
"project_id": "gr_7f31c2",
"analysis": null,
"stale": true,
"computed_at_revision": 41,
"current_revision": 42,
"changes_since": [
{"kind":"node_edit","revision":42,"changed":[{"id":"E_SEAL","field":"probability"}]}
]
}Errors
| Status | Meaning | Action |
|---|---|---|
400 | Validation failed | Check required fields, node types, and graph structure. |
401 | Unauthenticated | Supply a valid Bearer credential. |
403 | Permission denied | Use a role with permission for the requested operation. |
404 | Not found | Confirm the identifier belongs to the authenticated organization. |
Errors use a stable JSON envelope: {"error":"message"}.
Versioning
The /db/v1 surface evolves additively. Clients should ignore unknown response fields and inspect GET /db/v1 for capability packs enabled on an instance.