---
title: "Query Single Thread Stats"
method: GET
path: "/api/v2/threads/{thread_id}/stats"
tags: ["threads"]
---

# Query Single Thread Stats

`GET /api/v2/threads/{thread_id}/stats`

## Request

- Base URL: `https://api.smith.langchain.com`
- URL: `https://api.smith.langchain.com/api/v2/threads/{thread_id}/stats`
- Auth: one of:
  - API key in header `X-API-Key` and API key in header `X-Tenant-Id`
  - HTTP bearer and API key in header `X-Tenant-Id`

Compute aggregate stats for a single thread (turn count, latency percentiles, token/cost sums, and detail breakdowns) within a project.

Self-hosted deployments require LangSmith `v0.16` or later.

## Path parameters

- `thread_id` string, required

## Query parameters

- `filter` string
- `selects` string[], required
- `session_id` string, uuid, required

## Response `200`

aggregate stats for the thread

- ThreadsQuerySingleThreadStatsResponseBody
  - `completion_cost` number: `completion_cost` is the sum of per-trace completion costs across the thread, in USD. Populated when `COMPLETION_COST` is selected.
  - `completion_cost_details` QueryRunCompletionCostDetails
    - `raw` object: `raw` maps each category name to its estimated USD cost.
  - `completion_token_details` QueryRunCompletionTokenDetails
    - `raw` object: `raw` maps each category name to its completion-token count.
  - `completion_tokens` integer: `completion_tokens` is the sum of per-trace completion token counts across the thread. Populated when `COMPLETION_TOKENS` is selected.
  - `feedback_stats` QueryRunFeedbackStats
  - `first_start_time` string, date-time: `first_start_time` is the earliest trace start time in the thread (RFC3339). Populated when `FIRST_START_TIME` is selected.
  - `last_end_time` string, date-time: `last_end_time` is the latest trace end time in the thread (RFC3339). Populated when `LAST_END_TIME` is selected.
  - `last_start_time` string, date-time: `last_start_time` is the latest trace start time in the thread (RFC3339). Populated when `LAST_START_TIME` is selected.
  - `latency_p50_seconds` number: `latency_p50_seconds` is the approximate p50 of trace latency across the thread, in seconds. Populated when `LATENCY_P50` is selected.
  - `latency_p99_seconds` number: `latency_p99_seconds` is the approximate p99 of trace latency across the thread, in seconds. Populated when `LATENCY_P99` is selected.
  - `prompt_cost` number: `prompt_cost` is the sum of per-trace prompt costs across the thread, in USD. Populated when `PROMPT_COST` is selected.
  - `prompt_cost_details` QueryRunPromptCostDetails
    - `raw` object: `raw` maps each category name to its estimated USD cost.
  - `prompt_token_details` QueryRunPromptTokenDetails
    - `raw` object: `raw` maps each category name to its prompt-token count.
  - `prompt_tokens` integer: `prompt_tokens` is the sum of per-trace prompt token counts across the thread. Populated when `PROMPT_TOKENS` is selected.
  - `total_cost` number: `total_cost` is the sum of per-trace total costs across the thread, in USD. Populated when `TOTAL_COST` is selected.
  - `total_tokens` integer: `total_tokens` is the sum of per-trace total token counts across the thread. Populated when `TOTAL_TOKENS` is selected.
  - `turns` integer: `turns` is the number of distinct traces (turns) in the thread. Populated when `TURNS` is selected.

## Other responses

- `400`: bad request (missing or invalid query parameters)
- `401`: missing or invalid authentication
- `403`: forbidden (insufficient permission)
- `404`: session not found
- `422`: unprocessable entity (e.g. invalid project UUID)
- `500`: internal server error
- `503`: service unavailable
- `504`: gateway timeout or deadline exceeded

## Changes

- **2026-10-16** `1a8ee9358d81`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/langchain-ai/apis/langsmith/changes/api/v2/threads/:thread_id/stats/get.md)

---

[API](https://skmtc.dev/langchain-ai/apis/langsmith.md) - [All operations](https://skmtc.dev/langchain-ai/apis/langsmith/llms.txt) - [OpenAPI document](https://skmtc.dev/langchain-ai/apis/langsmith/revisions/7a01c01f75e8?raw)
