Skip to main content
Opik Documentation
current

Search documentation

Type to search this documentation.

Execute free-form analytics SQL

POST/v1/internal/analytics-queriesExecute free-form analytics SQL

Runs read-only SQL bounded to the caller's workspace. Supply project_id to restrict traces, spans, feedback scores and trace threads to one project, or omit it to cover the whole workspace. Experiments, experiment items and dataset items always cover the whole workspace.

Request body

application/json
objectScopedAnalyticsQueryRequest
project_idstring · uuid

Restrict query to this project. Omit to query the whole workspace.

querystringrequired

Read-only ClickHouse SQL. Must return exactly one column named `result` produced via toJSONString(...)

minLength 1

Example request
{
  "project_id": "00000000-0000-0000-0000-000000000000",
  "query": "string"
}

Responses

200Query resultsapplication/json
objectAnalyticsQueryResponse
resultsarray of object
Show child attributes
Example response
{
  "results": [
    {}
  ]
}
400Bad Requestapplication/json
objectErrorMessage
codeinteger · int32
detailsstring
messagestring
Example response
{
  "code": 0,
  "details": "string",
  "message": "string"
}
422Unprocessable Contentapplication/json
objectErrorMessage
codeinteger · int32
detailsstring
messagestring
Example response
{
  "code": 0,
  "details": "string",
  "message": "string"
}
501Agent Insights is disabled, or Custom Charts is not enabled for this workspace
Documentation menu