Request a demo
Home › Data APIs
Data APIs

Data APIs with a contract, not just an endpoint

A data API answers one business question by key. Parameterised SQL with typed inputs, typed outputs with labels and units, scope from the caller, masking, freshness, a row cap and an audit row on every call.

The call path

What happens on every call

What happens on every context callNo model runs on the call path. Values are bound, the caller's scope is wrapped around the SQL, and every call is written to the ledger.Requestkey + paramsValidatetypes, bounds, enumsScopefrom the caller, not the requestPolicyone read-only statementWarehouseREAD ONLY, timeoutRow capat most max_rowsMaskby clearance roleResultcolumns, rows, as_ofAuditvalues hashed
No model runs on the call path. Values are bound, the caller's scope is wrapped around the SQL, and every call is written to the ledger.
The contract

Everything a consumer needs to trust the answer

  • key and version. A dotted address like uw.book.open_submissions; versions bump when meaning or shape changes.
  • sql and params. One read-only statement with :name placeholders. Values are bound, never spliced. Types, defaults, bounds and enums are declared.
  • columns. The output schema as published, with labels, units (money, pct, count, date) and which columns are personal data.
  • row_scope. Owner column, organization column, or an explicit public.
  • freshness and cache. Cadence, SLA minutes, cache TTL and stale window.
  • pii, masking, roles. none, internal, personal or sensitive; masking rules; roles allowed to call and roles cleared to see unmasked.
  • max_rows and timeout_s. Hard limits the executor enforces.
  • questions. Example phrasings for matching a question to the right contract.
A contract
{
  "key": "sales.book.renewals_due",
  "version": 3,
  "title": "Renewals due in my book",
  "source": "snowflake_sales",
  "sql": "SELECT account_id, account_name, owner_id, org_id, renewal_date, arr_usd, health
          FROM gold.renewals
          WHERE renewal_date <= CURRENT_DATE + :days_ahead
            AND region IN (:regions)",
  "params": [
    {"name": "days_ahead", "type": "integer", "default": 90, "min": 1, "max": 365},
    {"name": "regions", "type": "string", "multi": true, "values": ["NA", "EMEA", "APAC"]}
  ],
  "columns": [
    {"name": "arr_usd", "label": "Annual value", "unit": "money"},
    {"name": "account_name", "label": "Account", "pii": false}
  ],
  "row_scope": {"owner_column": "owner_id", "org_column": "org_id"},
  "freshness": {"cadence": "live", "sla_minutes": 15},
  "cache_ttl_s": 300,
  "pii": "internal",
  "masking": {"contact_email": "hash"},
  "max_rows": 500,
  "timeout_s": 15,
  "questions": ["which renewals are due in my book", "accounts renewing next quarter"]
}
REST

Call it from anything that speaks HTTP

List contracts at GET /api/dataapi/contracts, read one at GET /api/dataapi/contracts/<key>, run it at POST /api/dataapi/<key>/query. The response carries labelled columns, rows, whether it was truncated or masked, as_of, freshness and the scope applied. Cache headers say whether it was a hit.

Published insights, dashboards and collections are served under /api/v1 with OpenAPI and a curl example on every one.

Run a contract
curl -X POST https://compose.your-company.com/api/dataapi/sales.book.renewals_due/query \
  -H "Authorization: Bearer $INSIGHTCOMPOSE_KEY" -H "Content-Type: application/json" \
  -d '{"params": {"days_ahead": 60, "regions": ["NA"]}}'

# 200 OK   X-DataAPI-Cache: HIT   Age: 42
{ "status": "SUCCESS",
  "data": { "key": "sales.book.renewals_due", "version": 3,
            "columns": [{"name": "arr_usd", "label": "Annual value", "unit": "money"}, ...],
            "rows": [...], "row_count": 37, "truncated": false, "masked": true,
            "as_of": "2026-11-23T09:14:05+00:00",
            "freshness": {"cadence": "live", "sla_minutes": 15},
            "scope": {"book": 1, "org": true, "public": false} } }
Build them your way

Write SQL, build visually, or convert what you have

Write SQL or Jinja

Bring the report queries you already trust; parameters are declared and checked against the SQL.

Build visually

Pick tables and fields; the builder works out the joins and writes each source's own dialect.

Rollups after scope

Totals over the caller's rows, computed after scope, so premium by line is per caller, not per owner.

Enrich in one call

Named steps run over the rows after the query, so a page composes both without a call per row.

Try it

Every contract has a Try it tab

Fill the filters exactly as a consumer would send them, run the published or draft version, and see rows, timing, version and the as-of time of the data. Documentation, versions and logs sit beside it.

A P&C context test run as an agent would see itDemo data
A P&C context test run as an agent would see it: typed parameters in, typed columns out (premium and loss ratio as numbers), the insured contact masked, rows scoped to the caller's organization, served live with its as-of time

See your own context layer, on your data

Bring one source and three questions your agents or apps need answered. We will stand up governed contexts over them in your environment and connect an agent to them in a working session.

We reply within one business day. Next comes a 45-minute executive briefing for your CIO or CDO, then, if it fits, a 12-week Innovation POD in your environment.