Auditing endpoints
This skill produces a project-wide audit of the Endpoints product. Use it when the user wants to find what to clean up — unused endpoints, failing materialisations, materialised versions that nobody calls any more. It does not modify anything; it reports.
The deeper investigation per endpoint is diagnosing-endpoint-performance. The audit's job is to
find candidates and hand off.
When to use this skill
- "Audit my endpoints" / "What endpoints can I clean up?"
- The user is taking over a project and wants to know what they've inherited
- A periodic review (monthly / quarterly) of endpoint sprawl
- The user is over a materialisation cost budget and wants to know what to disable
The dedicated tools give a fast endpoint-level view. For call frequency, recency, and cost over
time, query the query_log table with execute-sql (endpoint-level). Per-version recency comes
from endpoint-versions — each version carries its own last_executed_at.
Available tools
Prefer reading from the system tables over the endpoints-get-all / endpoint-get tools — one
SQL query returns the whole inventory and lets you join metadata to usage in query_log.
What counts as an issue
Usage counts only personal-API-key calls — an endpoint exercised solely from the Playground
tab or the app will look unused. Per-version last_executed_at is recorded only for runs since
that tracking was added, so a version can read null while still being used; always confirm before
removing.
Workflow
1. List endpoints and their metadata
One execute-sql query gets the whole inventory from system.data_modeling_endpoints:
No rows → the project has no endpoints; say so and stop. Don't invent issues. (The
last_executed_at column here is a convenience endpoint-level timestamp; for call frequency and
cost, use query_log in the next step.)
2. Pull usage from query_log
query_log records every personal-API-key call, tagged with the endpoint name. One query gives
recency and call counts across all endpoints:
Cross-reference with step 1:
- In metadata, absent from
query_log→ never called via API key - Last call more than 30 days ago → stale
query_log also exposes query_duration_ms, read_rows, and read_bytes per call — useful to
flag expensive endpoints in the same pass. This is endpoint-level; per-version recency comes from
endpoint-versions (step 3).
3. Check materialisation health and unused versions
For each materialised endpoint, call endpoint-materialization-status (this isn't in the system
tables). Surface any with status: "Failed" separately — these are active failures, not staleness.
Then call endpoint-versions and read each version's last_executed_at: a materialised
version that's null or long stale is an unused-materialised-version candidate. Treat this as a
lead, not proof — per-version recency only counts API-key runs since tracking was added, so confirm
with the user before unmaterialising.
4. Present the audit
Render a prioritised report grouped by category. Don't dump raw JSON; use a readable table per section:
The exact format is less important than: prioritised, grouped, actionable, and hand-off clear.
5. Offer the next step
End with a clear question, not a decision:
- "Want me to unmaterialise the unused versions?" — needs
endpoint-updatewithis_materialized: falseper version - "Want me to disable the never-called endpoints?" — needs
endpoint-updatewithis_active: false - "Want me to dig into the failing materialisation?" — hands off to
diagnosing-endpoint-performance
Never act from the audit alone. Disabling or unmaterialising affects external API consumers; always confirm before modifying.
Example interaction
Important notes
- The audit is read-only. Never call destructive tools from this flow. Hand off or confirm before any modification.
- Empty = healthy. Don't pad an empty report with theoretical issues. "Nothing to clean up" is a good answer.
- Read with SQL, drill in with the version tool.
system.data_modeling_endpoints(metadata) andquery_log(endpoint-level call counts, recency, cost) viaexecute-sqlanswer most of the audit. Per-version recency comes fromendpoint-versions(each version'slast_executed_at). - API-key-only scope. Usage only counts personal-API-key calls. An endpoint exercised only from the Playground tab or the app will look unused. Always confirm before acting.
- Materialisation costs storage and compute. When an endpoint no longer needs materialisation,
the cheapest fix is
endpoint-updatewithis_materialized: false— not deleting the endpoint. - Inactive ≠ stale. An endpoint with
is_active: falsewas deliberately turned off. Don't recommend deletion unless the user confirms it's truly abandoned.
