metrics
PUT
https://lucidace.com /v1/projects/{project_id}/metric-trees/{id} Scope insight:writeParameters
project_idstringpathrequiredidstringpathrequiredRequest body
application/json
descriptionstringnamestringrequirednodesNode[]requiredShow child parameters
idstringrequiredUnique within the tree, 1 to 64 characters.
labelstringmean_of_ratiosbooleanRatio metrics: the mean of the daily ratios instead of total over total.
metric_idstringrequiredA saved
proportion, mean or ratio metric.parent_idstringNull for the single root.
relationstringHow this node combines into its parent (ignored for the root).
north_starbooleanMake this the project's north-star tree (clears the flag on any other).
{
"description": "string",
"name": "string",
"nodes": [
{
"id": "string",
"label": "string",
"mean_of_ratios": true,
"metric_id": "string",
"parent_id": "string",
"relation": "sum"
}
],
"north_star": true
}Code samples
cURL
curl -X PUT "https://lucidace.com/v1/projects/{project_id}/metric-trees/{id}" \
-H "Content-Type: application/json" \
-d '{"description":"string","name":"string","nodes":[{"id":"string","label":"string","mean_of_ratios":true,"metric_id":"string","parent_id":"string","relation":"sum"}],"north_star":true}'TypeScript
Python
Go
PHP
Ruby
Java
Responses
200
Example
{
"created_at": "2024-01-01T00:00:00Z",
"created_by": "string",
"description": "string",
"id": "string",
"name": "string",
"nodes": [
{}
],
"north_star": true,
"updated_at": "2024-01-01T00:00:00Z"
}Schema
created_atstringrequiredcreated_bystringdescriptionstringrequiredidstringrequirednamestringrequirednodesobject[]required[{id, metric_id, label?, parent_id?, relation}], one root.north_starbooleanrequiredThe project's north-star tree (at most one).
updated_atstringrequired400
403
404
DELETE
https://lucidace.com /v1/projects/{project_id}/metric-trees/{id} Scope insight:writeParameters
project_idstringpathrequiredidstringpathrequiredCode samples
cURL
curl -X DELETE "https://lucidace.com/v1/projects/{project_id}/metric-trees/{id}"TypeScript
Python
Go
PHP
Ruby
Java
Responses
204
403
404
GET
https://lucidace.com /v1/projects/{project_id}/metric-trees/{id}/evaluate Scope insight:readParameters
project_idstringpathrequiredidstringpathrequiredfromstringquerytostringquerycompare_fromstringquerycompare_tostringqueryCode samples
cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/metric-trees/{id}/evaluate"TypeScript
Python
Go
PHP
Ruby
Java
Responses
200
Example
{
"compare_range": {
"from": "2024-01-01T00:00:00Z",
"to": "2024-01-01T00:00:00Z"
},
"name": "string",
"nodes": [
{
"compare_value": 0,
"contribution": 0,
"delta": 0,
"delta_pct": 0,
"error": "string",
"id": "string",
"label": "string",
"metric_id": "string",
"metric_name": "string",
"parent_id": "string",
"relation": "sum",
"value": 0
}
],
"north_star": true,
"range": {
"from": "2024-01-01T00:00:00Z",
"to": "2024-01-01T00:00:00Z"
},
"tree_id": "string"
}Schema
compare_rangeobjectrequiredShow child parameters
fromstringrequiredtostringrequirednamestringrequirednodesNodeEvaluation[]requiredRoot first, then breadth first.
Show child parameters
compare_valuenumbercontributionnumberShare of the parent's change explained by this node (1.0 = all of it); null for the root,
driver nodes and parents that did not change.deltanumbervalue - compare_value.delta_pctnumberdelta / compare_value; null when the comparison value is zero.errorstringWhy the value is missing.
idstringrequiredlabelstringmetric_idstringrequiredmetric_namestringrequiredparent_idstringrelationstringrequiredHow a child node combines into its parent.
valuenumbernorth_starbooleanrequiredrangeobjectrequiredShow child parameters
fromstringrequiredtostringrequiredtree_idstringrequired400
404
503
GET
https://lucidace.com /v1/projects/{project_id}/metrics Parameters
project_idstringpathrequiredlimitintegerqueryqstringquerystatusstringquerycreated_sourcestringquerydriftedbooleanquerysource_insight_idstringquerycursorstringqueryCode samples
cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/metrics"TypeScript
Python
Go
PHP
Ruby
Java
Responses
200
Example
{
"data": [
{
"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"
}
],
"next_cursor": "string"
}Schema
dataobject[]requiredShow child parameters
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_atstringrequirednext_cursorstring404
POST
https://lucidace.com /v1/projects/{project_id}/metrics Parameters
project_idstringpathrequiredRequest 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 POST "https://lucidace.com/v1/projects/{project_id}/metrics" \
-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
201
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_atstringrequired400
403
404
409 metric_name_taken
GET
https://lucidace.com /v1/projects/{project_id}/metrics/warehouse-models Scope insight:readParameters
project_idstringpathrequiredconnector_idstringqueryrequiredCode samples
cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/metrics/warehouse-models?connector_id=<connector_id>"TypeScript
Python
Go
PHP
Ruby
Java
Responses
200
Example
{
"connector_id": "string",
"models": [
{}
]
}Schema
connector_idstringrequiredmodelsobject[]requiredwarehouse.EventModel objects (name, sql, cursor_column, id_column, event, ...).404
Updated