Traces
GET /v1/traces, /v1/traces/stats, /v1/traces/{id}, /v1/traces/runs/{kind}/{runId} — read execution traces, statistics and run traces with an API key.
Read-only access to execution traces via API key. This is the same data and the same filters as the dashboard's Trace Explorer and GET /dashboard/traces, served by the same handlers, so a filter or field that works in one works in the other.
Secret keys only
A trace holds prompts and responses, so public embed tokens are refused with 403 EMBED_TOKEN_NOT_ALLOWED. A key with the full or read scope reads with full trace content. A runtime key cannot read traces. Comments, bookmarks and replay belong to a signed-in user, and a replay is a metered model call, so they stay on the Dashboard API.
Traces are retained for the period your plan includes, and a workspace set to minimal capture stores no content. Requests are rate-limited per tenant like the rest of the API, and a raised limit applies here too.
List traces
GET https://api.liyaengine.ai/v1/traces?domain=support&flagged=true&limit=25
Authorization: Bearer liya_xxxxxxxxxxxx| Parameter | Description |
|---|---|
limit, offset | Page size (1 to 100, default 25) and offset. |
domain, intent | Only requests to this domain or intent. |
flagged | true for calls a guardrail flagged, false for the rest. |
issue | Only calls with a guardrail issue of this kind: safety, validation, grounding or other. |
from, to | A time window, as ISO 8601 timestamps. |
userId, sessionId | Only calls by this end user or in this session. |
model | Only calls served by this model. |
minLatencyMs | Only calls at least this slow. |
fromCache | true for calls answered from cache. |
capture | full or minimal, by how the call was captured. |
q | Free-text search. |
sort, order | Sort by time (default), latency, ttft or cost, and asc or desc (default). |
scope=traces | One row per trace: a request made directly, an agent run or a workflow run. Narrow with kind=request, agent or workflow, and add nested=true to list what each run started. |
{
"success": true,
"data": { "traces": [ { "kind": "request", "traceId": "msg_xyz", "intent": "custom_support_resolve_ticket", "flagged": false } ] },
"pagination": { "total": 412, "limit": 25, "offset": 0 },
"sort": { "key": "time", "dir": "desc" }
}Get one trace
GET https://api.liyaengine.ai/v1/traces/msg_xyz
Authorization: Bearer liya_xxxxxxxxxxxxReturns the full trace for the request: model, input and output tokens, cost, latency, the guardrail issues found and whether the call was flagged, every retrieved chunk with its source and similarity score, the retrieval settings applied, and each agent step. The message_id returned by POST /v1/run is the trace id.
{
"success": true,
"data": {
"trace": {
"traceId": "msg_xyz",
"sessionId": "ses_abc",
"intent": "custom_support_resolve_ticket",
"modelUsed": "claude-sonnet-5",
"totalTokens": 1240,
"costUsd": "0.002100",
"latencyMs": 340,
"flagged": false,
"retrievedContext": [
{ "sourceId": "src_01", "sourceType": "policy", "score": 0.94, "snippet": "Refunds are processed within..." }
],
"agenticSteps": []
}
}
}Get an agent or workflow run trace
GET https://api.liyaengine.ai/v1/traces/runs/agent/{runId}
GET https://api.liyaengine.ai/v1/traces/runs/workflow/{runId}Returns the run's steps as nested observations, with the model calls and tool calls each step made. 404 TRACE_NOT_FOUND if the run isn't in your workspace.
Trace statistics
GET https://api.liyaengine.ai/v1/traces/stats?from=2026-10-01T00:00:00Z&domain=supportTakes the same filters as the list. Returns totals for the window: request, agent and workflow counts, input and output tokens, cost, latency average and p50, p95 and p99, time to first token, quality score, calls with PII detected, cache hits, issues by category, and a breakdown by intent. GET /v1/traces/intent-stats returns request statistics per intent.
SDKs
Both official SDKs wrap these endpoints as client.traces (JavaScript / TypeScript 0.20.0 and Python 0.20.0).
const { traces, pagination } = await client.traces.list({ domain: 'support', flagged: true, sort: 'latency' });
const trace = await client.traces.get(traces[0].traceId);
const stats = await client.traces.stats({ domain: 'support' });page = client.traces.list(domain="support", flagged=True, sort="latency")
trace = client.traces.get(page.traces[0].trace_id)
stats = client.traces.stats(domain="support")Errors
| Code | HTTP | Meaning |
|---|---|---|
EMBED_TOKEN_NOT_ALLOWED | 403 | A public embed token was used. Use a secret API key. |
TRACE_NOT_FOUND | 404 | No such trace or run in your workspace. |
RATE_LIMIT_EXCEEDED | 429 | Over the tenant's rate limit. See Retry-After. |
Evaluations
Full Datasets/Cases/Suites/Runs/Reviews CRUD, real suite execution, cancel/resume, statistical + LLM-judge pairwise comparison, and standalone scoring — all via API key.
Corrections
POST /v1/corrections — tell LiyaEngine an answer was wrong and what it should have said, so the passages behind it can be flagged for review.