Get traces
This page documents read endpoints for traces:
- Paginated list:
GET /traces - One trace by id (with spans):
GET /traces/{trace_id}
Traces are created through Ingest traces. Filing/sharing metadata (name, collection, org, project) can be changed with Update trace. There is no public delete.
Get all traces (paginated)
Endpoint: GET /traces
Description
Returns a paginated list of trace summaries, ordered by start_time descending, then integer id descending. List items are summaries only — no nested spans, no resource_attributes, and no full input / output payloads (those are on the detail response). Each item includes permissions for this caller (can_edit, can_delete, can_share, can_assign_project, can_move_collection) — see Introduction — Permissions. The example is an org-shared trace you own, read with a private API key, so can_share is true (you may unshare it) and project_id is null (a private key does not receive organization project ids). With a project-scoped API key, only traces assigned to that project are returned — see API key scoping.
Parameters
page— integer, default1, minimum1. A page past the last page is clamped to the last page (not an empty page).page_size— integer, default10, between1and10000.shared— optional boolean. The value must be the wordtrueorfalse, any letter case (TRUEandFALSEare valid). Surrounding whitespace is not trimmed.falsereturns only traces you own;truereturns only traces owned by someone else that you can see; omit to return both.shared=trueon a private key, or for a solo account, returns404("You are not a member of an organization, so filtering to only shared resources is not available.").search— optional string (max 255 characters). Case-insensitive substring match on the trace name (namecontains the term). If the value is all digits, it also matches the integer rowidexactly. If the value is hex-only (at least 8 characters, not purely decimal), it also matches the OTLPtrace_idas a partial lowercase hex substring. A whitespace-only value does not filter.data_collection_ids— optional comma-separated list of positive integers. Returns traces whosedata_collection_idis one of the listed ids.project_ids— optional comma-separated list of positive integers. Returns traces with a direct project assignment in that list. A trace that only shows a project through its collection is not included.statuses— optional comma-separated list ofokand/orerror(case-sensitive, lowercase only).okreturns traces with no span errors;errorreturns traces with at least one span error. When bothokanderrorare supplied, no status filter is applied.
Invalid tokens in data_collection_ids / project_ids (non-integers, zero, or negative values) yield 422 ("Invalid IDs (must be positive integers): ['…']"). Invalid statuses tokens yield 422 ("Invalid TraceStatusFilterEnum tokens (allowed: error, ok): ['…']"). Out-of-range page / page_size or an overlong search also yield 422. Any other shared value — including surrounding whitespace and spellings such as yes, y, t, on, 1, no, n, f, off, and 0 — yields 422 ("Value error, Value must be true or false."; detail[0].loc is ["query", "shared"]).
Error responses
401— Authentication failed.404—shared=truewithout organization scope ("You are not a member of an organization, so filtering to only shared resources is not available.").422— Invalidpage/page_size, overlongsearch, invaliddata_collection_ids/project_ids, invalidstatusestokens, or invalidshared.sharedaccepts onlytrueorfalse(any letter case).500—"An error occurred while retrieving traces."
Responses
200— JSON withitemsandmeta. Each item is a trace summary (no spans).
Example response (200)
{
"items": [
{
"id": 42,
"user": { "id": 7, "email": "ingest@example.com" },
"author_email": "ingest@example.com",
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"name": "Agent workflow",
"start_time": "2026-09-07T10:00:00Z",
"duration_ms": 123.4,
"span_count": 7,
"error_count": 0,
"total_tokens": 120,
"cost_usd": "0.0012",
"estimated_cost_usd": null,
"data_collection_id": null,
"org_id": 3,
"project_id": null,
"permissions": {
"can_edit": true,
"can_delete": true,
"can_share": true,
"can_assign_project": false,
"can_move_collection": true
},
"created_at": "2026-09-07T10:00:01Z",
"updated_at": "2026-09-07T10:00:01Z"
}
],
"meta": {
"current_page": 1,
"page_size": 10,
"total_items": 1,
"items_on_page": 1,
"total_pages": 1,
"has_next": false,
"has_previous": false,
"next_page": null,
"previous_page": null
}
}
{
"items": [
{
"id": 0,
"user": { "id": 0, "email": "string" },
"author_email": "string",
"trace_id": "string (32-char lowercase hex OTLP trace id)",
"name": "string",
"start_time": "date",
"duration_ms": "number",
"span_count": 0,
"error_count": 0,
"total_tokens": "integer | null",
"cost_usd": "string | null",
"estimated_cost_usd": "string | null",
"data_collection_id": "integer | null",
"org_id": "integer | null",
"project_id": "integer | null",
"permissions": {
"can_edit": "boolean",
"can_delete": "boolean",
"can_share": "boolean",
"can_assign_project": "boolean",
"can_move_collection": "boolean"
},
"created_at": "date",
"updated_at": "date"
}
],
"meta": {
"current_page": 1,
"page_size": 10,
"total_items": 1,
"items_on_page": 1,
"total_pages": 1,
"has_next": false,
"has_previous": false,
"next_page": "integer | null",
"previous_page": "integer | null"
}
}
Field notes:
idis the integer row id used byGET /traces/{trace_id}— not the hextrace_id.trace_idis the 32-char lowercase hex OTLP id.root_span_id,end_time, per-direction token counts, and fullinput/outputare on the detail response only.useris the owning account, ornullfor org-only traces.author_emailis a snapshot of the API key holder's email at ingest time and is not kept in sync if the account email changes later.- Token and cost fields are
nullwhen no LLM spans reported them.cost_usd/estimated_cost_usdroll up LLM spend from the traced workflow (reported or estimated from tokens) — not the cost of evaluations you run on Aegis (see runtotal_costfor that). Observed and estimated spend do not double-count. org_idpresent ⇒ org-shared;null⇒ personal.project_idis the trace's direct project assignment when this key can see it. A project-scoped key also receives the collection's project when the trace has no direct assignment. A private key always receivesproject_id: null. Theproject_idsquery filters on a direct assignment only, so a trace that only shows a project through its collection is not included.
Sharing rules
- Private key (including an org member's private key) and solo accounts: only traces you own. That includes an org-shared trace you own. Other members' org-shared traces are hidden.
- Project-scoped key: only traces assigned to that project. Unassigned traces are hidden.
curl
curl "https://api.aegisevals.ai/api/v1/traces?page=1&page_size=20" \
-H "Authorization: Bearer sk_00000000000000000000000000000000"
With filters:
curl "https://api.aegisevals.ai/api/v1/traces?search=agent&statuses=ok&project_ids=5&data_collection_ids=14" \
-H "Authorization: Bearer sk_00000000000000000000000000000000"
Get trace by id
Endpoint: GET /traces/{trace_id}
Description
Returns one trace with its spans. The response includes every field from the paginated list, plus:
root_span_id— 16-char lowercase hex OTLP root span id.end_time— capture end timestamp.prompt_tokens/completion_tokens— per-direction token counts when reported.input/output— JSON values (stored JSON object/array promoted to structure; plain text stays a string).resource_attributes— object of OTLP resource attributes (JSON-string object/array values promoted to structure), ornull.spans— array of span objects, ordered bystart_timethen span rowid. Each span uses the full Get span field set. The example below shortens each span to identity and timing.
Parameters
- Path:
trace_id— the integer rowid(from the listidfield), not the OTLP hextrace_id.
Error responses
401— Authentication failed.404—"Trace with id {trace_id} not found."— missing, or the caller cannot see it (including a project-scoped key whose project does not contain the trace). The same404is returned in both cases; there is no403on read.422—trace_idis not an integer.500—"An error occurred while retrieving the trace."
Responses
200— JSON with the full trace object, includingresource_attributesandspans.
Example response (200)
{
"id": 42,
"user": { "id": 7, "email": "ingest@example.com" },
"author_email": "ingest@example.com",
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"root_span_id": "00f067aa0ba902b7",
"name": "Agent workflow",
"start_time": "2026-09-07T10:00:00Z",
"end_time": "2026-09-07T10:00:00.123Z",
"duration_ms": 123.4,
"span_count": 7,
"error_count": 0,
"prompt_tokens": 100,
"completion_tokens": 20,
"total_tokens": 120,
"cost_usd": "0.0012",
"estimated_cost_usd": null,
"input": {},
"output": {},
"data_collection_id": null,
"org_id": 3,
"project_id": null,
"permissions": {
"can_edit": true,
"can_delete": true,
"can_share": true,
"can_assign_project": false,
"can_move_collection": true
},
"created_at": "2026-09-07T10:00:01Z",
"updated_at": "2026-09-07T10:00:01Z",
"resource_attributes": {
"service.name": "my-service"
},
"spans": [
{
"id": 1,
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"span_id": "00f067aa0ba902b7",
"parent_span_id": null,
"name": "Agent workflow",
"otel_kind": "INTERNAL",
"span_kind": "AGENT",
"start_time": "2026-09-07T10:00:00Z",
"end_time": "2026-09-07T10:00:00.123Z",
"duration_ms": 123.4,
"status_code": "OK",
"status_message": null
}
]
}
resource_attributes is null when the trace has no stored resource attributes. See Get span for every field on a span.
Sharing rules
Same visibility as GET /traces, including permissions. This example is the same private-key owner of an org-shared trace, so can_share is true and project_id is null. A project-scoped key receives the direct project assignment, or the collection's project when the trace has none. Spans on the detail payload are visible together with the trace. Spans do not include permissions.
curl
curl "https://api.aegisevals.ai/api/v1/traces/42" \
-H "Authorization: Bearer sk_00000000000000000000000000000000"