---
title: "Threads Query Stream"
method: POST
path: "/threads/stream_query"
tags: ["Threads"]
---

# Threads Query Stream

`POST /threads/stream_query`

## Request body

- ThreadsQueryReq — Query threads with aggregated statistics based on turn calls only. Turn calls are the immediate children of thread contexts (where call.id == turn_id). This provides meaningful conversation-level statistics rather than including all nested implementation details.
  - `project_id` string, required — The ID of the project
  - `filter` ThreadsQueryFilter
    - `after_datetime` string, date-time, nullable — Only include threads with start_time after this timestamp
    - `before_datetime` string, date-time, nullable — Only include threads with last_updated before this timestamp
    - `thread_ids` string[], nullable — Only include threads with thread_ids in this list
  - `limit` integer, nullable — Maximum number of threads to return
  - `offset` integer, nullable — Number of threads to skip
  - `sort_by` SortBy[], nullable — Sorting criteria for the threads. Supported fields: 'thread_id', 'turn_count', 'start_time', 'last_updated', 'p50_turn_duration_ms', 'p99_turn_duration_ms'.
    - `field` string, required
    - `direction` 'asc' | 'desc', required

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/wandb/apis/fastapi.md) · [All operations](https://skmtc.net/wandb/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/wandb/fastapi/revisions/56745769989b/schema)
