metrics

Embed
Preview of the card
<a href="https://lucidace.com/docs/ref-metrics"><img src="https://lucidace.com/docs/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/da916cd3-c0fc-4b63-b971-b3c13623daf3/pages/e94eda8e-0d17-42e8-ae7c-d1f7273e38b9/social-card.svg?v=3e7ae33eec8b" alt="metrics" width="600" height="315"></a>
POSThttps://lucidace.com/v1/projects/{project_id}/metrics/warehouse-models/syncScope insight:write

Replace the connector's models with those of its warehouse metrics.

Parameters

project_idstringpathrequired
connector_idstringqueryrequired

Code 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_idstringrequired
modelsintegerrequired
400
404
422
GEThttps://lucidace.com/v1/projects/{project_id}/metrics/{id}

Parameters

project_idstringpathrequired
idstringpathrequired

Code 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_modelstring
certifiedbooleanrequired
Compatibility mirror of status == approved.
certified_atstring
certified_bystring
confidencenumber
0..1, set by agents that propose a definition.
created_atstringrequired
created_bystring
created_sourcestringrequired
user | ai_generated
definitionobjectrequired
descriptionstringrequired
display_namestringrequired
idstringrequired
is_driftedbooleanrequired
Computed at read: the linked insight changed (or vanished) since the snapshot.
kindstringrequired
mean | proportion | ratio | funnel | retention | quantile | warehouse_sql | markdown | stub | query | lql
last_run_atstring
namestringrequired
owner_idstring
Accountable user; defaults to the creator.
reasoningstringrequired
source_insight_idstring
statusstringrequired
proposed | approved. Editing name, description, unit or definition resets it to proposed.
tagsstring[]required
unitstringrequired
updated_atstringrequired
404
PUThttps://lucidace.com/v1/projects/{project_id}/metrics/{id}

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json
ai_modelstring
confidencenumber
0..1
created_sourcestring
user (default) or ai_generated.
definitionobject
descriptionstring
display_namestring
kindstring
Omitted with no definition = stub; on replace, omitted keeps the current definition.
namestringrequired
Identifier-safe (^[a-z][a-z0-9_]{0,62}$) for governed kinds and agent-created metrics.
overwriteboolean
Replace a live metric that already has this name (it is deleted, freeing the name).
owner_idstring
Replace the owner (user id); omitted keeps the current owner.
reasoningstring
source_insight_idstring
Create 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

400
403
404
409 metric_name_taken
DELETEhttps://lucidace.com/v1/projects/{project_id}/metrics/{id}

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X DELETE "https://lucidace.com/v1/projects/{project_id}/metrics/{id}"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

204
403
404
POSThttps://lucidace.com/v1/projects/{project_id}/metrics/{id}/approveScope data_catalog_approval

Approve a metric (same as `PUT .../certification {"certified": true}`; body-less so MCP confirmation tokens can drive it).

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/metrics/{id}/approve"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

403
404
409 metric_drifted
PUThttps://lucidace.com/v1/projects/{project_id}/metrics/{id}/certificationScope data_catalog_approval

Approve (`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_idstringpathrequired
idstringpathrequired

Request 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

Responses

403
404
409 metric_drifted
POSThttps://lucidace.com/v1/projects/{project_id}/metrics/{id}/duplicate

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json
namestring
Default <name>_copy (then _copy_2, ...).
= null
{
  "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 definition

Same as 200 · GET /v1/projects/{project_id}/metrics/{id}

404
POSThttps://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_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/metrics/{id}/refresh-from-insight"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

404
409 the metric has no source insight
POSThttps://lucidace.com/v1/projects/{project_id}/metrics/{id}/run

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json

optional

date_fromstring
Override the stored date range (Query IR metrics only).
date_tostring
intervalstring
Override the bucket size, e.g. day (Query IR metrics only).
refreshstring
cache (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_querystring
The ClickHouse SQL that was run.
instructionsstring
Calculation steps of a markdown metric.
is_driftedbooleanrequired
kindstringrequired
metric_statusstringrequired
Lifecycle of the metric: approved (canonical when not drifted) or proposed.
query_idstring
Poll GET /query/{query_id} when status is pending.
resultsQueryResult
Show child parameters
columnsstring[]required
metaobjectrequired
Show child parameters
bytes_readinteger
Bytes ClickHouse read, like rows_read.
cache_hitbooleanrequired
cache_keystringrequired
Stable hash of the cache key (project, SQL, timezone, canonical query).
clamped_rangebooleanrequired
computed_atstringrequired
When the result was computed (last_refresh).
execution_msinteger
Wall time of the ClickHouse call; None on a cache hit.
next_allowed_client_refreshstringrequired
Before this, refresh: "force_*" recomputes but the dashboards' auto refresh serves the cache.
rows_readinteger
Rows ClickHouse read (its X-ClickHouse-Summary header); None when not reported.
sampledbooleanrequired
sql_hashstringrequired
rowsobject[][]required
statusstringrequired
ok | pending | instructions
unitstringrequired
urlstringrequired
Deep link to the metric in the web app.
400
404
422 stub or experiment-only kind
429
503

Updated