---
title: "Get trace tree"
method: GET
path: "/v1/projects/{project_id}/traces/{trace_id}/tree"
tags: ["Traces"]
---

# Get trace tree

`GET /v1/projects/{project_id}/traces/{trace_id}/tree`

## Request

- Base URL: `https://api.naturali.ai`
- URL: `https://api.naturali.ai/v1/projects/{project_id}/traces/{trace_id}/tree`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://api.naturali.ai/authorize`, token URL `https://api.naturali.ai/token`, scopes: `mcp:access`)

Returns the full execution tree rooted at the given trace (or its root if the given trace is a child). Each node represents one agent's execution session. The `children` array contains traces triggered by sub-agent tool calls from that trace. A node's generations are listed by `GET /v1/projects/{project_id}/generations?trace_id=`, and a node's direct children page by `GET /v1/projects/{project_id}/traces?parent_trace_id=`.

## Path parameters

- `trace_id` string, required

## Response `200`

Trace tree rooted at the resolved root trace

- TraceTreeNode: A trace node in the execution tree, with nested children.
  - `id` string: Public ID of the trace
  - `project_id` string
  - `agent_id` string
  - `file_id` string, nullable
  - `step_count` integer
  - `parent_trace_id` string, nullable
  - `root_trace_id` string, nullable
  - `error` StoredError: Why a resource's work failed, in the shape of an error response's `error` without `hint` and `docs_url`. Every `error` field a resource records carries it, so `code` can be read without first checking the type of `error`.
    - `code` string, required: A key from the server's ERROR_CODES registry, documented on the Error Codes page. `INTERNAL_ERROR`, with the message `Internal Server Error`, records an unexpected failure whose detail reaches the server log only.
    - `message` string, required
    - `meta` object: The failure's own structured context, when it names any.
  - `created_at` string, date-time
  - `content_redacted_at` string, date-time, nullable: When the trace's content was purged. Non-null means the steps object has been deleted from storage and the content columns cleared, while this row survives as an auditable skeleton (ids, timestamps, step count). A purged trace still reads back as a skeleton with this marker set rather than as a 404, so the erasure is provable.
  - `content_redacted_by_principal_type` 'user' | 'api_key' | 'agent' | 'automation' | 'approval' | 'system': What kind of principal acted. `user` and `api_key` are authenticated callers, and the id is the user's (`user_…`) or the key's own (`key_…`), so a record names which key acted rather than its owner. `agent` is an agent writing under its own identity (`agent_…`). `automation` is the task engine acting on a dispatch outcome and `approval` an approval resolution; neither carries an id. `system` is the platform itself, with an id naming the mechanism (`retention_sweep`, `zero_retention`).
  - `content_redacted_by_principal_id` string, nullable: Public id of that principal — the API key's own id for key auth, so the record names which key acted. `retention_sweep` or `zero_retention` for `system`.
  - `children` TraceTreeNode[]: Child traces triggered by sub-agent calls from this trace

## Other responses

- `401`: Unauthorized
- `403`: Forbidden
- `404`: Trace not found

---

[API](https://skmtc.dev/naturali/apis/naturali-ai-api.md) · [All operations](https://skmtc.dev/naturali/apis/naturali-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/naturali/apis/naturali-ai-api/revisions/e4905b78f422?raw)
