An ontology is the top-level container in Prometheux — it groups concepts, data sources, a schema, and compute configuration into a single workspace. The Ontologies API lets you create and load ontologies, copy or template them, move them between workspaces via export/import, and capture point-in-time snapshots. All paths are relative to the base URL and require authentication. All responses use the standard envelope.
On the wire the request/response payloads still use project-prefixed keys (project, project_id) for backward compatibility. These name the ontology container.

Save an ontology

Create or update an ontology. Sending an existing id updates the ontology in place; a new id (or a client-generated one) creates a new ontology.

Example

List ontologies

Return all ontologies visible to the authenticated user, deduplicated by ontology ID. No parameters required.
data is an array of ontology objects (id, name, description, and associated metadata).

Load an ontology

Fetch full details for a single ontology by ID.

Copy an ontology

Duplicate an existing ontology. All concepts, data source binds, and the schema are copied; a new ontology ID is assigned.

Templates

Templates are pre-built ontologies available to all users from a shared marketplace. Use list-templates to browse them, then import-template to instantiate one as a new ontology in your workspace.

List templates

Return all available templates from the marketplace. No parameters required.
data is an array of template objects (id, name, description, and metadata).

Import a template

Create a new ontology from a marketplace template. Data source connections are validated after import; any that cannot be resolved are reported in failed_datasources.
If any data sources declared in the template cannot be resolved in your workspace, the response includes a failed_datasources array listing which connectors need to be reconfigured before running concepts.

Export an ontology

Serialize a single ontology — its concepts (structure only, not cached output rows), data source binds, schema, and metadata — into a JSON payload.
To move an ontology to another account or workspace, export it as a file tree with export-tree instead. The app no longer imports this JSON payload, and import-ontology is deprecated.
Concept execution output (cached predicate rows) and embedding tables are excluded from the export. All concepts are marked as not-populated so they must be re-run after import.

Import an ontology

Deprecated, and will be removed in a future release. Import an ontology as a file tree with plan-tree and apply-tree instead.
Restore an ontology from a payload previously produced by export-ontology. A new ontology ID is assigned; data source connections are validated after import and any that fail are reported in failed_datasources.

Ontology as files

export-ontology and import-ontology above move an ontology as one opaque payload. The three endpoints here move it as a file tree instead — a manifest, one file per concept, the data source specs, the schema graph and the apps — which is what you want when the ontology lives in version control. This is the API behind the CLI’s px pull, px plan and px apply; if you are working from a terminal, use the CLI rather than these endpoints directly.

Export a tree

With format=zip the response is the raw archive rather than the envelope.
A tree never carries credentials. Data sources are exported as specs — type, host, database, table — so a tree is safe to commit, and applying one to an account that lacks a named data source reports it rather than inventing it.

Plan a tree

Diffs a tree against what is live and writes nothing. Run this before applying, and show a user the result: it is the only point at which the consequences of an apply are visible in advance.
Accepts either JSON — {"files": [{"path": "...", "content": "..."}, …]} — or a multipart/form-data upload with a file field holding the tree as a zip.
For each ontology in the tree, data classifies every concept as create, update, delete or unchanged, lists the data source, app and schema changes, and — importantly — names the downstream concepts a changed definition forces to re-run. A one-line edit near the top of a chain can mean rebuilding most of the project, and this is where you find that out.

Apply a tree

Reconciles live state to the tree. Concepts are written dependencies-first, and an ontology the tree names but your account does not have is created.
Takes the same two encodings as /plan-tree, plus:
prune: true makes the tree authoritative — anything not in it is deleted, including concepts a colleague added through the UI since you pulled. Leave snapshot on: it is what makes a bad apply recoverable, via Restore a snapshot.

Export workspace

Deprecated, and will be removed in a future release. Export each ontology as a file tree with export-tree instead.
Export every ontology in the workspace — and all workspace-level tables — in a single payload. Equivalent to calling export-ontology for each ontology plus the workspace-level tables in one request. No parameters required.

Import workspace

Deprecated, and will be removed in a future release. Import each ontology as a file tree with plan-tree and apply-tree instead.
Restore a full workspace from a payload produced by export-workspace. Each ontology is imported in turn; partial failures are tracked per-ontology in the summary.

Create from context

Create a brand-new ontology from free-text context and/or file attachments. The platform analyzes the input with the LLM to extract entities and relationships, generates an ontology name and description, and uses Vadalingo to translate the domain knowledge into Vadalog concepts. This endpoint is sent as multipart/form-data (form fields, not JSON) because it accepts file uploads.
Provide at least one of context or files; supplying neither returns a 400.

Snapshots

Snapshots are point-in-time captures of an ontology’s full state — concepts, data source binds, and schema. They enable lightweight versioning without a full export/import cycle.
Restoring a snapshot overwrites the current ontology state. By default, a safety snapshot of the current state is automatically created before the restore proceeds. Set create_safety_snapshot: false to skip this.

Create a snapshot

List snapshots

Return snapshot metadata for an ontology. The heavy snapshot payload is omitted — use restore with a snapshot_id to apply one.
data is an array of snapshot metadata objects (snapshot_id, description, created_at).

Restore a snapshot

Delete a snapshot

Read a snapshot’s concepts

Return the concept definitions held by one snapshot, or by the live ontology. This is what a diff view reads on both sides — pass a snapshot ID for one side and current for the other.
Read-only, and available whether or not versioning is enabled for the ontology.

Other operations