Skip to content

OSL API reference

This section defines the public contracts of the OSL engine. What it states is what any client can assume, and what any OSL-conformant engine MUST implement exactly.

For the full object semantics (which primitives exist, their fields) see the specification. Here: how it’s called and what it returns.

OSL v1 exposes two shipped surfaces and two planned ones:

Surface Who consumes it Shape
REST BI tools, apps, dashboards, scripts HTTP/JSON (Arrow IPC is planned)
MCP tools AI agents (Claude, GPT, Copilot, custom) tool definitions over the MCP protocol
CLI (planned — not shipped) Developers, CI pipelines the osl binary
OpenLineage events (planned — not shipped) Marquez, DataHub, observability webhook / kafka emitter

Everything you read goes through a single endpoint — /osl/query. Every request is exactly one of the five forms of the OSL-SQL surface:

  1. Structured — SELECT over osl.entities.<model>: entities, dimensions and metrics, lowered to the governed SQL seam.
  2. RETRIEVE — governed vector retrieval as a relation source (FROM RETRIEVE(...)), served at the subject’s required redaction version.
  3. TRAVERSE — bounded, hop-by-hop graph traversal from anchor keys to a target model.
  4. Joint (record) — entity-first hydration: one entity’s structured columns plus its content evidence in a single governed call.
  5. Cross-modal equijoin — the only join across the two planes: structured × RETRIEVE, on a sealed, cleartext authoritative entity key.

The same endpoint also serves document analytics over osl.documents.<facet> (exact, governed counts at document grain), exhaustive jobs (CLASSIFY / SYNTHESISE, answered 202 and read through /osl/jobs), cursor pagination of RETRIEVE with a MATCHES full-text predicate, and — opt-in — a Joint queried as a relation. These come from RFCs 0006–0008, implemented in the reference engine while the RFCs are Draft.

Endpoint Purpose
POST /osl/query The consumption surface — OSL-SQL (osql), raw sql, or the MetricFlow subset
POST /osl/sample Governed content preview — ACL + server-side redaction (not an algebra query)
GET /osl/domain-map The unified domain graph (Entities, metrics, candidates)
GET /osl/schema The compiled semantic view (full view needs an admin role; ?governed=true projects it to the caller’s grants)
GET /osl/schema/resolve Lexicon resolver — business term → canonical FQN (planned, not yet mounted)
POST /osl/suggest · POST /osl/validate · POST /osl/objects Assisted authoring (draft → validate → publish), with publish-time physical validation against catalog metadata
GET /osl/objects · GET/DELETE /osl/objects/{kind}/{name} List, read and delete published objects (admin; conditional with If-Match)
GET /osl/facet-defaults The cell’s embedding contract and a complete UnstructuredFacet template (admin)
GET /osl/jobs/{id} · GET /osl/jobs/{id}/result · POST /osl/jobs/{id}:cancel Read and cancel an exhaustive job (only the submitting subject sees it)
GET /osl/candidates Discovery — candidate (not-yet-adopted) entities
GET /osl/conformance Declared conformance levels (currently [] — no complete profile claimed)
GET /health Unauthenticated health check

The optional MCP server publishes seven semantic tools — thin HTTP wrappers that never fabricate identity (each call carries the caller’s own Bearer token) and accept no roles, chain or subject input:

Tool What it does
semantic_guide The supported OSL-SQL grammar with examples built only from names this caller can see
semantic_schema GET /osl/schema?governed=true — only the semantic projection visible to the caller’s chain
semantic_domain_map GET /osl/domain-map?governed=true — the visible entities and relationships
semantic_explain {osql, explain: true} — validates and lowers the plan without executing (data-free)
semantic_query Runs one {osql} synchronously via POST /osl/query; continues a page with an optional after cursor
semantic_analyze Submits a query that runs as a job (CLASSIFY / SYNTHESISE, or an over-budget document aggregate)
semantic_job Polls one job of this connection and returns its result once it has succeeded

semantic_query never starts a job: a query that would need one answers 413 E0519. Query responses carry an answer trace (the “receipt”: what was read, at which version, what was served and why a page was capped) that a client can render. A non-2xx engine response is surfaced as an MCP error with its status and envelope — a 401/403 never becomes an empty result or a degraded success.

The optional remote gateway (mcp.enabled in the tenant-semantic-api chart, off by default) serves the same tools over Streamable HTTP with OAuth. Each connection is a revocable credential for exactly one subject in one tenant: an administrator registers the subject, publishes its policies and issues a one-use, expiring invitation; the recipient adds the tenant’s MCP URL to their chat client and redeems the invitation on the tenant’s authorization page (authorization code + PKCE S256). A broker inside the tenant verifies the OAuth credential against the live connection registry and mints a short-lived ActorToken with the subject’s live grants — the model never controls the ActorToken, and an OAuth token is never accepted as one. Revoking a connection or disabling the subject cuts access immediately. The remote gateway also adds semantic_open_documents, which turns the documents a RETRIEVE answer listed into a short-lived download of their redacted copies, readable once on the same connection (see Download links and MCP). Setup: docs/osl/subject-mcp-connections.md.

Natural language is deliberately not part of the normative spec: NL → OSL translation is a consumer, not a producer. The seam is an open, documented contract — any agent can plan against GET /osl/schema + GET /osl/domain-map, validate with {osql, explain: true}, and execute with POST /osl/query, getting the same server-side enforcement as every other caller (the LLM never sees data during planning, only schema + question).

OpenDome’s own implementation of that loop, osl-ask, ships in the Enterprise companion — it is not in the OSS tree, and you can replace it with your own translator without touching OSL. The contract is specified in docs/osl/natural-language.md.

/osl/ is the v1 root. A breaking v2 would live at /osl/v2/ while /osl/ keeps serving the v1 contract for at least two consecutive minor versions. Endpoints MAY add optional response fields within v1.x; clients MUST ignore unrecognized fields.