query

Embed
Preview of the card
<a href="https://lucidace.com/docs/ref-query"><img src="https://lucidace.com/docs/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/da916cd3-c0fc-4b63-b971-b3c13623daf3/pages/6b9f02b1-3d03-4964-99f8-d70e34c6b457/social-card.svg?v=3e7ae33eec8b" alt="query" width="600" height="315"></a>
POSThttps://lucidace.com/v1/projects/{project_id}/queryScope insight:read

Parameters

project_idstringpathrequired

Request body

application/json
client_query_idstring
Your id for this run ([A-Za-z0-9_-], at most 64): poll and cancel by it. A second call with the same id while the run is in progress attaches to it (202, same query_id).
filters_overrideobject
{date_range?: {from, to}, filters?: group}: replaces the date range and ANDs the filters, as dashboard overrides do. Insight kinds with a date range only.
namestring
Label for the server log (at most 128 characters).
offsetinteger
Not supported: results are not paged by offset (400); use limit in the query.
queryobjectrequired
A Query IR document ({"kind": "trends" | "funnel" | "retention", ...}); JSON Schema: GET /v1/query.schema.json; examples: help page query-api.
refreshRefreshMode
validate_onlyboolean
Parse and compile only (the insight source editor): 200 {valid, kind, columns}.
variables_overrideobject
{name: value} replacing the variables of a sql query (dashboard variable overrides).
{
  "client_query_id": "string",
  "filters_override": {},
  "name": "string",
  "offset": 0,
  "query": {},
  "refresh": "blocking",
  "validate_only": true,
  "variables_override": {}
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/query" \
  -H "Content-Type: application/json" \
  -d '{"client_query_id":"string","filters_override":{},"name":"string","offset":0,"query":{},"refresh":"blocking","validate_only":true,"variables_override":{}}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Result, or Validated with validate_only
Example
{
  "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": [
    [
      {}
    ]
  ]
}
Schema
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
202 Still running after 5 s; poll GET /query/{query_id}
Example
{
  "query_id": "string",
  "status": "string"
}
Schema
query_idstringrequired
statusstringrequired
400
404 Project absent, or force_cache with no cached result
422
429
503
GEThttps://lucidace.com/v1/projects/{project_id}/query-logScope insight:read

Parameters

project_idstringpathrequired
statusstringquery
ok | cached | error
limitintegerquery
cursorstringquery

Code samples

cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/query-log"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Page of QueryLogEntry, newest first
Example
{
  "data": [
    {
      "api_key_id": "string",
      "created_at": "2024-01-01T00:00:00Z",
      "duration_ms": 0,
      "error": "string",
      "id": "string",
      "kind": "string",
      "name": "string",
      "row_count": 0,
      "status": "string",
      "user_id": "string"
    }
  ],
  "next_cursor": "string"
}
Schema
dataQueryLogEntry[]required
Show child parameters
api_key_idstring
created_atstringrequired
duration_msinteger
ClickHouse wall time; absent for cache hits and errors.
errorstringrequired
idstringrequired
kindstringrequired
Query IR kind (trends, funnel, ...).
namestringrequired
The caller's name, "" when unnamed.
row_countintegerrequired
statusstringrequired
ok | cached | error
user_idstring
next_cursorstring
400
404
POSThttps://lucidace.com/v1/projects/{project_id}/query/forecastScope insight:read

Project a trends query forward. Past 5 s the call answers 202 like `POST /query`; repeat it once the query finished (the result is cached).

Parameters

project_idstringpathrequired

Request body

application/json
confidencenumber
Interval level in (0, 1), default 0.8.
horizoninteger
Buckets to project (1 to 90, default 7).
queryobjectrequired
A trends Query IR document.
refreshboolean
seasoninteger
Season length in buckets; default 7 for day, 24 for hour, none for week and month. 0 = none.
{
  "confidence": 0,
  "horizon": 0,
  "query": {},
  "refresh": true,
  "season": 0
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/query/forecast" \
  -H "Content-Type: application/json" \
  -d '{"confidence":0,"horizon":0,"query":{},"refresh":true,"season":0}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "confidence": 0,
  "interval": "string",
  "season": 0,
  "series": [
    {
      "breakdown": "string",
      "forecast": [
        {
          "bucket": "string",
          "lower": 0,
          "point": 0,
          "upper": 0
        }
      ],
      "history": [
        {
          "bucket": "string",
          "value": 0
        }
      ],
      "series": 0
    }
  ]
}
Schema
confidencenumberrequired
intervalstringrequired
seasonintegerrequired
seriesSeriesForecast[]required
Series too short to fit are left out.
Show child parameters
breakdownstring
The breakdown value of the series, when the query has a breakdown.
forecastForecastPoint[]required
Show child parameters
bucketstringrequired
lowernumberrequired
pointnumberrequired
uppernumberrequired
historyPoint[]required
Show child parameters
bucketstringrequired
valuenumberrequired
seriesintegerrequired
202
400
404
422
429
503
POSThttps://lucidace.com/v1/projects/{project_id}/query/impactScope insight:read

Which early behaviours go with reaching a goal. Past 5 s the call answers 202 like `POST /query`; repeat it once the query finished (the result is cached).

Parameters

project_idstringpathrequired

Request body

application/json
alphanumber
Significance level in (0, 1), default 0.05.
queryobjectrequired
An impact Query IR document.
refreshboolean
{
  "alpha": 0,
  "query": {},
  "refresh": true
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/query/impact" \
  -H "Content-Type: application/json" \
  -d '{"alpha":0,"query":{},"refresh":true}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "alpha": 0,
  "behaviour_days": 0,
  "candidates": [
    {
      "adjusted_p_value": 0,
      "ci_high": 0,
      "ci_low": 0,
      "conversion_with": 0,
      "conversion_without": 0,
      "converted_with": 0,
      "converted_without": 0,
      "correlation": 0,
      "difference": 0,
      "event": "string",
      "lift": 0,
      "p_value": 0,
      "people_with": 0,
      "people_without": 0,
      "significant": true
    }
  ],
  "converted": 0,
  "goal_days": 0,
  "note": "string",
  "people": 0
}
Schema
alphanumberrequired
behaviour_daysintegerrequired
candidatesImpactCandidate[]required
Largest absolute correlation first.
Show child parameters
adjusted_p_valuenumber
Benjamini-Hochberg adjusted across the listed candidates.
ci_highnumber
ci_lownumber
conversion_withnumberrequired
Goal rate among people who did the event.
conversion_withoutnumberrequired
converted_withintegerrequired
converted_withoutintegerrequired
correlationnumber
Phi coefficient of event x goal, -1 to 1.
differencenumber
conversion_with - conversion_without.
eventstringrequired
liftnumber
conversion_with / conversion_without - 1; null when nobody without it converted.
p_valuenumber
Two-sided two-proportion z-test; null when the groups cannot be compared.
people_withintegerrequired
people_withoutintegerrequired
significantbooleanrequired
Adjusted p-value below alpha.
convertedintegerrequired
goal_daysintegerrequired
notestringrequired
Always states the limit of the method.
peopleintegerrequired
People who started in the range and were observed for the whole window.
202
400
404
422
429
503
POSThttps://lucidace.com/v1/projects/{project_id}/query/personasScope insight:read

Cluster the people of a `persona_features` query into personas. Past 5 s the call answers 202 like `POST /query`; repeat it once the query finished (the result is cached).

Parameters

project_idstringpathrequired

Request body

application/json
kinteger
Number of personas (2 to 8, default 4).
queryobjectrequired
A persona_features Query IR document.
refreshboolean
{
  "k": 0,
  "query": {},
  "refresh": true
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/query/personas" \
  -H "Content-Type: application/json" \
  -d '{"k":0,"query":{},"refresh":true}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "features": [
    "string"
  ],
  "k": 0,
  "people": 0,
  "personas": [
    {
      "centre": {},
      "example_person_ids": [
        "string"
      ],
      "index": 0,
      "label": "string",
      "people": 0,
      "share": 0,
      "traits": [
        {
          "feature": "string",
          "z": 0
        }
      ]
    }
  ]
}
Schema
featuresstring[]required
kintegerrequired
peopleintegerrequired
People clustered (the query returns at most the project row cap).
personasPersona[]required
Show child parameters
centreobjectrequired
Cluster centre per feature, in the feature's own unit.
example_person_idsstring[]required
indexintegerrequired
labelstringrequired
peopleintegerrequired
sharenumberrequired
traitsPersonaTrait[]required
Features that set the persona apart, strongest first.
Show child parameters
featurestringrequired
znumberrequired
Standard deviations from the all-people mean.
202
400
404
422
429
503

Updated