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

# Threads Query Stream

`POST /threads/stream_query`

## Request

- Base URL: `https://trace.wandb.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://trace.wandb.ai/threads/stream_query`
- Auth: none declared

## 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`

Stream of data in JSONL format

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-16** `dd89fadfe4e4`: 1 breaking, 4 info
  - removed the media type `application/json` for the response with the status `200`
  - the endpoint scheme security `HTTPBasic` was removed from the API
  - added the media type `application/x-ndjson` for the response with the status `200`
  - added the optional property `detail/items/ctx` to the response with the `422` status
  - …1 more
- **2026-01-07** `d6e39f7c717d`: 1 breaking, 1 info
  - removed the media type `application/jsonl` for the response with the status `200`
  - added the media type `application/json` for the response with the status `200`
- **2025-11-05** `f4a10b6a2e6d`: 1 info
  - added the media type `application/jsonl` for the response with the status `200`
- **2025-09-23** `4745726593c5`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/wandb/apis/weights-biases-weave-stainless-api/changes/threads/stream_query/post.md)

---

[API](https://skmtc.dev/wandb/apis/weights-biases-weave-stainless-api.md) - [All operations](https://skmtc.dev/wandb/apis/weights-biases-weave-stainless-api/llms.txt) - [OpenAPI document](https://skmtc.dev/wandb/apis/weights-biases-weave-stainless-api/revisions/f7643c49bf2e?raw)
