/api/orgs/{org_id}/trace-sqlRun a read-only SQL query
One read-only SELECT over your own requests, spans, sessions and scores. Joins, subqueries, WITH and UNION work; table functions, system tables, SETTINGS, FORMAT, comments and a second statement are refused. Every table is limited to your organization and to the window (start and end; the last 7 days by default, at most 90). Queries stop after 10 seconds or at the scan and memory limits. SQL has its own limit: about 100 queries a minute per organization, 2 at a time.
Authentication: Bearer API key in the Authorization header
Path parameters
org_idstringrequiredYour organization id (uuid).
GET /api/whoamireturns it.
Request body
querystringrequiredOne
SELECT, at most 16,000 characters.limitintegerRows to return, 1 to 10,000.
startstringWindow start; the last 7 days by default.
endstringWindow end, at most 90 days after start.
Responses
200The rows.
Response
columnsarray<object>columns
namestringtypestringThe JSON type of the values.
rowsarray<array<any>>truncatedbooleanTrue when
limitcut the answer.elapsed_msintegerstartstringendstring
400A construct the SQL subset refuses (
sql_not_allowed); the message names it.Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
401Missing, unknown or revoked API key.
Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
404Unknown organization, or not the key's own organization.
Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
422The query hit a time, scan or memory limit (
query_too_broad), or its result is too large (sql_result_too_large).Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
429Too many reads.
rate_limited: this organization's API-key reads of the request log are over about 10 per second (burst 30) or 4 in flight on one server (sessions are not limited).build_capacity: the shared analytics read slots are busy. Retry afterRetry-After.Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
502The query failed in the store (
sql_failed).Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
503This deployment has no observability store (
observability_unavailable), or the store could not answer (trace_store_error). Retry shortly.Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
Request
curl -X POST 'https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/trace-sql' \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"query": "select model, count() as n from requests group by model order by n desc",
"limit": 100
}'Response
{
"columns": [
{
"name": "model",
"type": "string"
},
{
"name": "n",
"type": "number"
}
],
"rows": [
[
"gpt-6-luna",
1284
]
],
"truncated": false,
"elapsed_ms": 84,
"start": "2026-11-11T14:32:07Z",
"end": "2026-11-18T14:32:07Z"
}https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/trace-sql