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>
PUThttps://lucidace.com/v1/projects/{project_id}/metric-trees/{id}Scope insight:write

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json
descriptionstring
namestringrequired
nodesNode[]required
Show child parameters
idstringrequired
Unique within the tree, 1 to 64 characters.
labelstring
mean_of_ratiosboolean
Ratio metrics: the mean of the daily ratios instead of total over total.
metric_idstringrequired
A saved proportion, mean or ratio metric.
parent_idstring
Null for the single root.
relationstring
How this node combines into its parent (ignored for the root).
sum | product | driver
north_starboolean
Make 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_atstringrequired
created_bystring
descriptionstringrequired
idstringrequired
namestringrequired
nodesobject[]required
[{id, metric_id, label?, parent_id?, relation}], one root.
north_starbooleanrequired
The project's north-star tree (at most one).
updated_atstringrequired
400
403
404
DELETEhttps://lucidace.com/v1/projects/{project_id}/metric-trees/{id}Scope insight:write

Parameters

project_idstringpathrequired
idstringpathrequired

Code 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
GEThttps://lucidace.com/v1/projects/{project_id}/metric-trees/{id}/evaluateScope insight:read

Parameters

project_idstringpathrequired
idstringpathrequired
fromstringquery
tostringquery
compare_fromstringquery
compare_tostringquery

Code 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_rangeobjectrequired
Show child parameters
fromstringrequired
tostringrequired
namestringrequired
nodesNodeEvaluation[]required
Root first, then breadth first.
Show child parameters
compare_valuenumber
contributionnumber
Share 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.
deltanumber
value - compare_value.
delta_pctnumber
delta / compare_value; null when the comparison value is zero.
errorstring
Why the value is missing.
idstringrequired
labelstring
metric_idstringrequired
metric_namestringrequired
parent_idstring
relationstringrequired
How a child node combines into its parent.
sum | product | driver
valuenumber
north_starbooleanrequired
rangeobjectrequired
Show child parameters
fromstringrequired
tostringrequired
tree_idstringrequired
400
404
503
GEThttps://lucidace.com/v1/projects/{project_id}/metrics

Parameters

project_idstringpathrequired
limitintegerquery
qstringquery
statusstringquery
created_sourcestringquery
driftedbooleanquery
source_insight_idstringquery
cursorstringquery

Code 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[]required
Show child parameters
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
next_cursorstring
404
POSThttps://lucidace.com/v1/projects/{project_id}/metrics

Parameters

project_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 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_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
400
403
404
409 metric_name_taken
GEThttps://lucidace.com/v1/projects/{project_id}/metrics/warehouse-modelsScope insight:read

Parameters

project_idstringpathrequired
connector_idstringqueryrequired

Code 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_idstringrequired
modelsobject[]required
warehouse.EventModel objects (name, sql, cursor_column, id_column, event, ...).
404

Updated