TQL Queries
Execute TQL SELECT queries against your traces, logs, metrics, AI spans, and HTTP requests directly through the Trasys Public API's POST /v1/tql endpoint.
POST /v1/tql
Execute a TQL (Trasys Query Language) SELECT query against your project data. This is the same engine powering the in-app TQL Editor — anything you can run there, you can run here.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
query | string | Yes | TQL SELECT statement (max 50,000 characters) |
Example
curl -X POST \
-H "X-API-Key: sk_prod_..." \
-H "Content-Type: application/json" \
-d '{"query": "SELECT service_name, count() AS reqs FROM traces GROUP BY service_name ORDER BY reqs DESC LIMIT 10"}' \
"http://localhost:3000/v1/tql"Response
{
"columns": [
{ "name": "service_name", "type": "String" },
{ "name": "reqs", "type": "UInt64" }
],
"rows": [
["api-server", 12400],
["worker", 3200]
],
"rowCount": 2,
"durationMs": 38,
"truncated": false
}Available tables
| Table | Description |
|---|---|
traces | Distributed trace spans |
logs | Application log entries |
metrics | Custom metric data points |
ai_spans | LLM/agent spans with token counts |
http_requests | Pre-aggregated HTTP request summary |
error_groups | Grouped error occurrences |
Row limit
TQL API responses are capped at 10,000 rows. If your query would return more, the truncated field will be true. Add LIMIT to your query to stay within bounds.
Only SELECT queries are permitted. INSERT, ALTER, DROP, and other write operations are rejected with 400 Bad Request.
Example queries
Error rate by service in the last hour
SELECT
service_name,
countIf(status = 'error') AS errors,
count() AS total,
round(countIf(status = 'error') / count() * 100, 2) AS error_rate_pct
FROM traces
WHERE timestamp >= now() - INTERVAL 1 HOUR
GROUP BY service_name
ORDER BY error_rate_pct DESCP95 latency by endpoint
SELECT
operation_name,
quantile(0.95)(duration_ms) AS p95_ms,
count() AS requests
FROM traces
WHERE timestamp >= now() - INTERVAL 24 HOUR
GROUP BY operation_name
ORDER BY p95_ms DESC
LIMIT 20Recent errors with messages
SELECT timestamp, service_name, level, message
FROM logs
WHERE level = 'error'
AND timestamp >= now() - INTERVAL 1 HOUR
ORDER BY timestamp DESC
LIMIT 50Sessions & Traffic
Retrieve user session timelines combining traces, logs, and AI spans, plus aggregated device, browser, and traffic analytics from the Trasys Public API.
Pulse
Pulse runs scheduled HTTP checks against your endpoints from outside and alerts you when they fail, covering monitor types, assertions, and multi-step flows.

