Custom Metrics
Define your own SQL-based metrics inside a private namespace, query them via REST or MCP, and export them as schema-v1 YAML.
Workspace setup
Before creating metrics, name your workspace at /dashboard. Your workspace name becomes your metric namespace: custom.<name>.*
For example, a workspace named acmebank means all your custom metrics live under custom.acmebank.*. Workspace names must be lowercase, alphanumeric, and unique across the registry.
Create a metric
Navigate to Dashboard → Custom Metrics → New metric and fill in the form:
- Display name — human-readable title shown in search results
- Description — what the metric measures and why it matters
- Industry — free text (e.g.
banking,insurance) - Category — optional grouping within the industry
- SQL formula — use
${dataset}and${column}template variables - Input table + columns — declare all datasets and columns consumed
- Output column / type / unit — the result column the formula produces
- Frequency — how often the metric is expected to be recalculated
Click Save to create the metric as a draft in your namespace.
Query via REST API
Use your API key to retrieve your own metrics. Draft metrics are only visible to your organisation.
# Your own metrics (draft or published) — use your API key curl https://api.metricregistry.co.uk/metrics/custom.acmebank.capital.my_metric \ -H "Authorization: Bearer mrk_..."
Query via MCP
Custom metrics are accessible through the MCP get_metric tool the same way as any registry metric. Your API key is your identity — draft metrics are visible only to your org.
{
"tool": "get_metric",
"input": { "id": "custom.acmebank.capital.my_metric" }
}Export as YAML
Go to Dashboard → Custom Metrics and click the YAML ↓ button on any metric. This downloads a schema-v1 compatible YAML file ready to commit to Git. The file structure matches the MetricRegistry schema for consistency with the main registry.
Publishing
Metrics start as draft— private to your organisation. Set status to published to make a metric visible to anyone with a valid API key.
Update the status via the dashboard toggle or the PUT /custom-metrics/{id} endpoint with "status": "published".
API reference
All custom metrics endpoints are authenticated with your API key.
| Method | Route | Description |
|---|---|---|
POST | /custom-metrics | Create a new custom metric |
GET | /custom-metrics | List your custom metrics |
GET | /custom-metrics/{id} | Get a single custom metric |
PUT | /custom-metrics/{id} | Update display name, description, SQL, or status |
DELETE | /custom-metrics/{id} | Delete a custom metric |
PUT | /org | Set workspace name |
Next Steps
- dbt Integration — Run metrics directly in your warehouse with the dbt package
- API Reference — Full endpoint documentation with request/response schemas
- Dashboard — Create and manage your custom metrics