metrics
POST
https://lucidace.com /v1/projects/{project_id}/metrics/warehouse-models/sync Scope insight:writeReplace the connector's models with those of its warehouse metrics.
Parameters
project_idstringpathrequiredconnector_idstringqueryrequiredCode samples
cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/metrics/warehouse-models/sync?connector_id=<connector_id>"TypeScript
Python
Go
PHP
Ruby
Java
Responses
200
Example
{
"connector_id": "string",
"models": 0
}Schema
connector_idstringrequiredmodelsintegerrequired400
404
422
GET
https://lucidace.com /v1/projects/{project_id}/metrics/{id} Parameters
project_idstringpathrequiredidstringpathrequiredCode samples
cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/metrics/{id}"TypeScript
Python
Go
PHP
Ruby
Java
Responses
200
Example
{
"ai_model": "string",
"certified": true,
"certified_at": "2024-01-01T00:00:00Z",
"certified_by": "string",
"confidence": 0,
"created_at": "2024-01-01T00:00:00Z",
"created_by": "string",
"created_source": "string",
"definition": {},
"description": "string",
"display_name": "string",
"id": "string",
"is_drifted": true,
"kind": "string",
"last_run_at": "2024-01-01T00:00:00Z",
"name": "string",
"owner_id": "string",
"reasoning": "string",
"source_insight_id": "string",
"status": "string",
"tags": [
"string"
],
"unit": "string",
"updated_at": "2024-01-01T00:00:00Z"
}Schema
ai_modelstringcertifiedbooleanrequiredCompatibility mirror of
status == approved.certified_atstringcertified_bystringconfidencenumber0..1, set by agents that propose a definition.
created_atstringrequiredcreated_bystringcreated_sourcestringrequireduser | ai_generateddefinitionobjectrequireddescriptionstringrequireddisplay_namestringrequiredidstringrequiredis_driftedbooleanrequiredComputed at read: the linked insight changed (or vanished) since the snapshot.
kindstringrequiredmean | proportion | ratio | funnel | retention | quantile | warehouse_sql | markdown | stub | query | lqllast_run_atstringnamestringrequiredowner_idstringAccountable user; defaults to the creator.
reasoningstringrequiredsource_insight_idstringstatusstringrequiredproposed | approved. Editing name, description, unit or definition resets it to proposed.tagsstring[]requiredunitstringrequiredupdated_atstringrequired404
PUT
https://lucidace.com /v1/projects/{project_id}/metrics/{id} Parameters
project_idstringpathrequiredidstringpathrequiredRequest body
application/json
ai_modelstringconfidencenumber0..1
created_sourcestringuser (default) or ai_generated.definitionobjectdescriptionstringdisplay_namestringkindstringOmitted with no
definition = stub; on replace, omitted keeps the current definition.namestringrequiredIdentifier-safe (
^[a-z][a-z0-9_]{0,62}$) for governed kinds and agent-created metrics.overwritebooleanReplace a live metric that already has this name (it is deleted, freeing the name).
owner_idstringReplace the owner (user id); omitted keeps the current owner.
reasoningstringsource_insight_idstringCreate from an insight: mutually exclusive with
definition; the insight query becomes the baseline for drift.tagsstring[]unitstring{
"ai_model": "string",
"confidence": 0,
"created_source": "string",
"definition": {},
"description": "string",
"display_name": "string",
"kind": "string",
"name": "string",
"overwrite": true,
"owner_id": "string",
"reasoning": "string",
"source_insight_id": "string",
"tags": [
"string"
],
"unit": "string"
}Code samples
cURL
curl -X PUT "https://lucidace.com/v1/projects/{project_id}/metrics/{id}" \
-H "Content-Type: application/json" \
-d '{"ai_model":"string","confidence":0,"created_source":"string","definition":{},"description":"string","display_name":"string","kind":"string","name":"string","overwrite":true,"owner_id":"string","reasoning":"string","source_insight_id":"string","tags":["string"],"unit":"string"}'TypeScript
Python
Go
PHP
Ruby
Java
Responses
200
400
403
404
409 metric_name_taken
DELETE
https://lucidace.com /v1/projects/{project_id}/metrics/{id} Parameters
project_idstringpathrequiredidstringpathrequiredCode samples
cURL
curl -X DELETE "https://lucidace.com/v1/projects/{project_id}/metrics/{id}"TypeScript
Python
Go
PHP
Ruby
Java
Responses
204
403
404
POST
https://lucidace.com /v1/projects/{project_id}/metrics/{id}/approve Scope data_catalog_approvalApprove a metric (same as `PUT .../certification {"certified": true}`; body-less so MCP confirmation tokens can drive it).
Parameters
project_idstringpathrequiredidstringpathrequiredCode samples
cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/metrics/{id}/approve"TypeScript
Python
Go
PHP
Ruby
Java
PUT
https://lucidace.com /v1/projects/{project_id}/metrics/{id}/certification Scope data_catalog_approvalApprove (`certified: true`) or send back to proposed. Needs admin rights or the `data_catalog_approval` scope; a drifted metric cannot be approved (409 `metric_drifted`).
Parameters
project_idstringpathrequiredidstringpathrequiredRequest body
application/json
certifiedbooleanrequired{
"certified": true
}Code samples
cURL
curl -X PUT "https://lucidace.com/v1/projects/{project_id}/metrics/{id}/certification" \
-H "Content-Type: application/json" \
-d '{"certified":true}'TypeScript
Python
Go
PHP
Ruby
Java
POST
https://lucidace.com /v1/projects/{project_id}/metrics/{id}/duplicate Parameters
project_idstringpathrequiredidstringpathrequiredRequest body
application/json
namestringDefault
<name>_copy (then _copy_2, ...).{
"name": null
}Code samples
cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/metrics/{id}/duplicate" \
-H "Content-Type: application/json" \
-d '{"name":null}'TypeScript
Python
Go
PHP
Ruby
Java
Responses
201 a
proposed copy with the same kind and definition404
POST
https://lucidace.com /v1/projects/{project_id}/metrics/{id}/refresh-from-insight Re-baseline the metric on its source insight's current query. Resets to proposed.
Parameters
project_idstringpathrequiredidstringpathrequiredCode samples
cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/metrics/{id}/refresh-from-insight"TypeScript
Python
Go
PHP
Ruby
Java
Responses
200
404
409 the metric has no source insight
POST
https://lucidace.com /v1/projects/{project_id}/metrics/{id}/run Parameters
project_idstringpathrequiredidstringpathrequiredRequest body
application/json
optional
date_fromstringOverride the stored date range (Query IR metrics only).
date_tostringintervalstringOverride the bucket size, e.g.
day (Query IR metrics only).refreshstringcache (default) or force (recompute).{
"date_from": "2024-01-01T00:00:00Z",
"date_to": "2024-01-01T00:00:00Z",
"interval": "string",
"refresh": "string"
}Code samples
cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/metrics/{id}/run" \
-H "Content-Type: application/json" \
-d '{"date_from":"2024-01-01T00:00:00Z","date_to":"2024-01-01T00:00:00Z","interval":"string","refresh":"string"}'TypeScript
Python
Go
PHP
Ruby
Java
Responses
200
Example
{
"compiled_query": "string",
"instructions": "string",
"is_drifted": true,
"kind": "string",
"metric_status": "string",
"query_id": "string",
"results": {
"columns": [
"string"
],
"meta": {
"bytes_read": 0,
"cache_hit": true,
"cache_key": "string",
"clamped_range": true,
"computed_at": "2024-01-01T00:00:00Z",
"execution_ms": 0,
"next_allowed_client_refresh": "2024-01-01T00:00:00Z",
"rows_read": 0,
"sampled": true,
"sql_hash": "string"
},
"rows": [
[
{}
]
]
},
"status": "string",
"unit": "string",
"url": "string"
}Schema
compiled_querystringThe ClickHouse SQL that was run.
instructionsstringCalculation steps of a markdown metric.
is_driftedbooleanrequiredkindstringrequiredmetric_statusstringrequiredLifecycle of the metric:
approved (canonical when not drifted) or proposed.query_idstringPoll
GET /query/{query_id} when status is pending.resultsQueryResultShow child parameters
columnsstring[]requiredmetaobjectrequiredShow child parameters
bytes_readintegerBytes
ClickHouse read, like rows_read.cache_hitbooleanrequiredcache_keystringrequiredStable hash of the cache key (project, SQL, timezone, canonical query).
clamped_rangebooleanrequiredcomputed_atstringrequiredWhen the result was computed (
last_refresh).execution_msintegerWall time of the
ClickHouse call; None on a cache hit.next_allowed_client_refreshstringrequiredBefore this,
refresh: "force_*" recomputes but the dashboards' auto refresh serves the cache.rows_readintegerRows
ClickHouse read (its X-ClickHouse-Summary header); None when not reported.sampledbooleanrequiredsql_hashstringrequiredrowsobject[][]requiredstatusstringrequiredok | pending | instructionsunitstringrequiredurlstringrequiredDeep link to the metric in the web app.
400
404
422 stub or experiment-only kind
429
503
Updated