Models API

List semantic projects and the models within them under /api/projects.

The models endpoints expose your semantic layer — the projects and models that define dimensions and measures. They require the read scope.

#List projects

GET /api/projects — return the semantic projects the service account can read.

curl https://flax-analytics.com/api/projects \
  -H "Authorization: Bearer flax_pat_..."

#List models in a project

GET /api/projects/{projectId}/models — return the models in a project, each with its dimensions and measures. Use these names when constructing a query.

[
  { "name": "orders", "dimensions": ["orders.status"], "measures": ["orders.revenue"] }
]

#Bootstrap a semantic layer from a warehouse

These endpoints let you go from a raw warehouse to a modeled, queryable layer without the UI. They require the write scope and an org-admin service account.

  • POST /api/projects — create a semantic project (a layer) on a connection. Leave the git fields empty for a git-less layer built by introspection or declared joins.
  • GET /api/projects/{projectId}/schemas — list the warehouse schemas available on the project's connection, so you can pick one to model.
  • POST /api/projects/{projectId}/introspect/preview — auto-generate a candidate graph (models, dimensions, measures) without saving, plus notes (e.g. text/integer columns detected as dates). Review it, then confirm.
  • POST /api/projects/{projectId}/introspect — apply the reviewed graph so its models become queryable.
  • POST /api/projects/{projectId}/joins — declare a join on a git-less layer so a target model's fields become reachable from a base model (as target.field).
# preview the auto-generated graph, inferring joins from FK constraints
curl -X POST https://flax-analytics.com/api/projects/{projectId}/introspect/preview \
  -H "Authorization: Bearer flax_pat_..." \
  -H "Content-Type: application/json" \
  -d '{"inferJoins": true}'

A typical bootstrap: POST /api/connectionsPOST /api/projectsGET /api/projects/{projectId}/schemas → introspect preview → introspect → optional POST /api/projects/{projectId}/joins → query and chart.