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}/query/survivalScope insight:read

Kaplan-Meier curve and time-between-events histogram for a `survival` query. 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.95.
queryobjectrequired
A survival Query IR document.
refreshboolean
{
  "confidence": 0,
  "query": {},
  "refresh": true
}

Code samples

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

Responses

200
Example
{
  "censored": 0,
  "confidence": 0,
  "converted": 0,
  "curve": [
    {
      "at_risk": 0,
      "censored": 0,
      "events": 0,
      "lower": 0,
      "survival": 0,
      "time_s": 0,
      "upper": 0
    }
  ],
  "histogram": [
    {
      "count": 0,
      "from_s": 0,
      "to_s": 0
    }
  ],
  "median_s": 0,
  "total": 0,
  "unit_s": 0,
  "window_days": 0
}
Schema
censoredintegerrequired
confidencenumberrequired
convertedintegerrequired
curveSurvivalCurvePoint[]required
Show child parameters
at_riskintegerrequired
censoredintegerrequired
eventsintegerrequired
lowernumberrequired
survivalnumberrequired
Share of people who have not yet had the end event after this bucket.
time_sintegerrequired
Seconds after the start event at the start of this bucket.
uppernumberrequired
histogramHistogramBin[]required
Show child parameters
countintegerrequired
People whose end event fell into this bucket.
from_sintegerrequired
to_sintegerrequired
median_sinteger
Seconds until half the people had the end event (bucket start); null if fewer than half did.
totalintegerrequired
People who started in the range.
unit_sintegerrequired
window_daysintegerrequired
202
400
404
422
429
503
GEThttps://lucidace.com/v1/projects/{project_id}/query/{query_id}Scope insight:read

Parameters

project_idstringpathrequired
query_idstringpathrequired

Code samples

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

Responses

200
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
Example
{
  "query_id": "string",
  "status": "string"
}
Schema
query_idstringrequired
statusstringrequired
404
DELETEhttps://lucidace.com/v1/projects/{project_id}/query/{query_id}Scope insight:read

Parameters

project_idstringpathrequired
query_idstringpathrequired

Code samples

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

Responses

204
404
POSThttps://lucidace.com/v1/projects/{project_id}/sqlScope insight:read

Parameters

project_idstringpathrequired

Request body

application/json
breakdownstring
{filters.breakdown}: an event property key.
date_rangeobject
Value of {filters}: {from, to?, explicit?}; unless explicit, days are snapped.
explainboolean
Add meta.generated_sql (the rewritten ClickHouse text) to the response.
filtersobject
Property group applied by {filters}.
intervalstring
{filters.interval}.
refreshboolean
Skip the result cache and recompute.
sqlstringrequired
One SELECT in the LQL dialect.
validate_onlyboolean
Compile with the caller's access (views, live wh_ tables, masking) and answer {valid, kind, columns} without running.
variablesobject
{variables.name} values.
{
  "breakdown": "string",
  "date_range": {},
  "explain": true,
  "filters": {},
  "interval": "string",
  "refresh": true,
  "sql": "string",
  "validate_only": true,
  "variables": {}
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/sql" \
  -H "Content-Type: application/json" \
  -d '{"breakdown":"string","date_range":{},"explain":true,"filters":{},"interval":"string","refresh":true,"sql":"string","validate_only":true,"variables":{}}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

202 Still running after 5 s; poll GET /query/{query_id}

Same as 202 · GET /v1/projects/{project_id}/query/{query_id}

400 problem+json with message, line, column for compile errors
404
422
429
503
POSThttps://lucidace.com/v1/projects/{project_id}/sql/completeScope insight:read

Parameters

project_idstringpathrequired

Request body

application/json
cursorintegerrequired
Byte offset of the cursor in sql.
sqlstringrequired
{
  "cursor": 0,
  "sql": "string"
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/sql/complete" \
  -H "Content-Type: application/json" \
  -d '{"cursor":0,"sql":"string"}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
[
  {
    "detail": "string",
    "kind": "string",
    "label": "string"
  }
]
Schema
detailstringrequired
kindstringrequired
table | column | function
labelstringrequired
404
GEThttps://lucidace.com/v1/projects/{project_id}/sql/schemaScope insight:read

Parameters

project_idstringpathrequired

Code samples

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

Responses

200
Example
{
  "tables": [
    {
      "columns": [
        {
          "name": "string",
          "type": "string"
        }
      ],
      "name": "string"
    }
  ]
}
Schema
tablesTable[]required
Show child parameters
columnsColumn[]required
Show child parameters
namestringrequired
typestringrequired
namestringrequired
404
Updated