---
title: "Get a pruned trace by ID"
method: GET
path: "/api/v2/pruned_trace/{trace_id}"
tags: ["APM Trace"]
---

# Get a pruned trace by ID

`GET /api/v2/pruned_trace/{trace_id}`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/pruned_trace/{trace_id}`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token` scopes: `apm_read`

Retrieve a pruned, hierarchical view of an APM trace by its trace ID.
The trace is summarized as a tree of spans rooted at the trace root and reduced in size
to keep rendering large traces in the UI practical.
This endpoint is rate limited to `60` requests per minute per organization.

## Path parameters

- `trace_id` string, required

## Query parameters

- `expand_span_id` integer
- `time_hint` integer
- `force_source` string
- `include_path` string[]
- `tag_include` string[]
- `tag_exclude` string[]
- `only_service_entry_spans` boolean

## Response `200`

OK

- PrunedTraceResponse: Response containing a single pruned trace.
  - `data` PrunedTraceData, required: A pruned trace resource document.
    - `attributes` PrunedTraceAttributes, required: The attributes of a pruned trace returned by the Get pruned trace by ID endpoint.
      - `is_truncated` boolean, required: Indicates whether the underlying trace was truncated because its size exceeded the maximum that can be retrieved from storage.
      - `size_bytes` integer, required: The size, in bytes, of the original (non-pruned) trace before summarization.
      - `summarized_trace` SummarizedTrace, required: A summarized, hierarchical view of a trace.
        - `root` SummarizedSpan, required: A node in the pruned trace tree.
          - `children` SummarizedSpan[], required: The child spans of this node in the pruned tree.
          - `durationSeconds` number, double, required: The duration of the span, in seconds.
          - `endTime` string, date-time, required: The end time of the span, in RFC3339 format.
          - `error` 0 | 1, required: Error flag for a span. `1` when the span is in error, `0` otherwise.
          - `hidden_child_spans_count` integer, required: The number of child spans that were pruned from this node when summarizing the trace.
          - `meta` object, required: String-valued tags attached to the span.
          - `metrics` object, required: Numeric metrics attached to the span.
          - `name` string, required: The operation name of the span.
          - `parentID` integer, required: The ID of the parent span, or `0` when the span is the trace root.
          - `resource` string, required: The resource that the span describes.
          - `service` string, required: The name of the service that emitted the span.
          - `spanID` integer, required: The span ID, as an unsigned 64-bit integer.
          - `span_kind` string, required: The OpenTelemetry span kind, for example `INTERNAL`, `SERVER`, `CLIENT`, `PRODUCER`, or `CONSUMER`.
          - `startTime` string, date-time, required: The start time of the span, in RFC3339 format.
        - `traceId` string, required: The full 128-bit trace ID, encoded as a 32-character hexadecimal string.
    - `id` string, required: The full 128-bit trace ID, encoded as a 32-character hexadecimal string.
    - `type` 'pruned_trace', required: The type of the pruned trace resource. The value is always `pruned_trace`.

## Other responses

- `403`: Forbidden
- `404`: Not Found
- `429`: Too many requests
- `504`: Gateway Timeout

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
