Automation & API#
TrinoHub is fully drivable by API, so scripts, BI tools, and AI assistants can do anything the UI does. Three surfaces matter: API tokens, the MCP server, and the Prometheus metrics endpoint.
API tokens#
Every /api/* endpoint accepts a bearer token in place of a browser
session:
Authorization: Bearer tht_xxxxxxxx…
Create tokens from the API tokens panel in Settings. A token:
- Acts as its user and inherits that user's roles, grants, and data policies — so scope access by choosing whose token it is.
- Is shown once at creation and stored only as a hash; copy it then.
- Can have an optional expiry, and can be revoked at any time.
Any user can create tokens for themselves; users with MANAGE_USERS can mint
tokens for other users, including service accounts (token-only identities —
see Users & roles). Use a service account as the identity for unattended
automation.
MCP server#
TrinoHub exposes a Model Context Protocol endpoint at /mcp so AI clients
(Claude, Copilot, and other MCP hosts) can explore and query your data under the
connecting user's own grants, read-only. It has its own topic — see
MCP server.
Prometheus metrics#
The control plane exports metrics in Prometheus format at /metrics, scraped
with an API token:
Authorization: Bearer tht_xxxxxxxx…
It publishes cluster lifecycle state, per-cluster utilization gauges (workers, running/queued queries, CPU, and cache hit rate on accelerated clusters), and counters for queries, autoscaling actions, and scheduled-job runs. Point your Prometheus/Grafana or Datadog agent at it to dashboard and alert on TrinoHub itself.
OpenAPI#
The full control-plane API has an interactive reference at /docs (Swagger UI)
and a machine-readable spec at /openapi.json, both linked from Settings.