Skip to main content
POST
Run a LangWatchQL query

Authorizations

X-Auth-Token
string
header
required

Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.

Body

application/json
sql
string
required
Required string length: 1 - 50000
parameters
object
timeWindow
object
granularitySeconds
projectId
string

Reads this one project, which the key must hold analytics:view on. Send projectId or projects, not both.

Minimum string length: 1
projects

The projects to read, each one the key holds analytics:view on, or the string "all" for every project the key can read. A key that reaches several projects must name them or send "all"; a key that reads one project defaults to it. When the statement declares {dashboard_context_projects:Array(String)}, params.dashboard_context_projects lists what was read.

Pattern: ^\s*[aA][lL][lL]\s*$
sources
enum<string>[]

The trace origins {dashboard_context_sources:Array(String)} is bound to; application when absent. The placeholder does not filter by itself: the statement keeps its rows with a predicate such as WHERE Source IN {dashboard_context_sources:Array(String)}. A statement that never uses the placeholder counts every origin.

Maximum array length: 11
Available options:
application,
simulation,
evaluation,
sample,
coding_agent,
ai_tool,
gateway,
workflow,
playground,
langy,
other

Response

The query ran. Columns, rows, execution statistics and diagnostics, scoped to the projects the key can read, or to the one project projectId names.

columns
object[]
required
read-only
rows
object[]
required
read-only
statistics
object
required
diagnostics
object[]
required
read-only
followsTimeWindow
boolean
required
followsGranularity
boolean
required
granularitySeconds
number
coarsenedFromSeconds
number
completeness
object
params
object
Last modified on August 31, 2026