threads

Query Threads

Alpha: The request and response contract may change; Query threads within a project (session), with cursor-based pagination. Returns threads matching the given time range and optional filter.

post/v2/threads/query

Request body

cursorstring

cursor is the opaque string from a previous response's next_cursor. Omit on the first request; pass the returned cursor to fetch the next page.

filterstring

filter narrows which threads are returned, using a LangSmith filter expression evaluated against each thread's root run. For example: has(tags, "production") or eq(status, "error"). See https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language for syntax.

max_start_timestring date-time

max_start_time is the inclusive upper bound on thread activity (RFC3339 date-time).

min_start_timestring date-time

min_start_time is the inclusive lower bound on thread activity (RFC3339 date-time).

page_sizeinteger

page_size is the maximum number of threads to return in this response. Defaults to 20 when omitted; must be between 1 and 100 inclusive when set. The response may contain fewer threads than page_size even when next_cursor is present.

project_idstring uuid

project_id is the tracing project UUID.

Example request

{
  "page_size": 20,
  "project_id": "0190a1b2-c3d4-7ef0-a5b6-6ea3a82e9328"
}

Response

items and pagination

next_cursorstring

next_cursor is the opaque cursor to pass as cursor on the next request. Omitted on the final page.

Example response

{
  "items": [
    {
      "count": 3,
      "first_trace_id": "018e4c7e-a9fb-7ef0-a5b6-6ea3a82e9327",
      "last_trace_id": "0190a1b2-c3d4-7ef0-a5b6-6ea3a82e9328",
      "latency_p50": 0.15,
      "latency_p99": 0.42,
      "max_start_time": "2025-01-15T12:05:00.000Z",
      "min_start_time": "2025-01-15T12:00:00.000Z",
      "num_errored_turns": 1,
      "start_time": "2025-01-15T12:00:00.000Z",
      "thread_id": "018e4c7e-a9fb-7ef0-a5b6-6ea3a82e9327",
      "total_cost": 0.045,
      "total_tokens": 450,
      "trace_id": "018e4c7e-a9fb-7ef0-a5b6-6ea3a82e9328"
    }
  ],
  "next_cursor": "eyJydW5zX2N1cnNvciI6Imx0KGN1cnNvciwiLi4uIikifQ=="
}

Changes

Changed in 2 of the 48 revisions of this API.2334

  • a0acb3a6a101129See the full diff
    • removed the optional property has_more from the response with the 200 status

      response-optional-property-removed

    • the endpoint scheme security API Key AND Tenant ID was added to the API

      api-security-added

    • the endpoint scheme security Bearer Auth AND Tenant ID was added to the API

      api-security-added

    • the endpoint scheme security API Key was removed from the API

      api-security-removed

    • the endpoint scheme security Bearer Auth was removed from the API

      api-security-removed

    • the endpoint scheme security Tenant ID was removed from the API

      api-security-removed

    • added the non-success response with the status 401

      response-non-success-status-added

    • added the non-success response with the status 404

      response-non-success-status-added

    • added the non-success response with the status 500

      response-non-success-status-added

    • added the non-success response with the status 503

      response-non-success-status-added

    • added the non-success response with the status 504

      response-non-success-status-added

    • added the optional property detail to the response with the 400 status

      response-optional-property-added

    • added the optional property detail to the response with the 403 status

      response-optional-property-added

    • added the optional property detail to the response with the 422 status

      response-optional-property-added

    • added the optional property instance to the response with the 400 status

      response-optional-property-added

    • added the optional property instance to the response with the 403 status

      response-optional-property-added

    • added the optional property instance to the response with the 422 status

      response-optional-property-added

    • added the optional property items/items/num_errored_turns to the response with the 200 status

      response-optional-property-added

    • added the optional property remedy to the response with the 400 status

      response-optional-property-added

    • added the optional property remedy to the response with the 403 status

      response-optional-property-added

    • added the optional property remedy to the response with the 422 status

      response-optional-property-added

    • added the optional property status to the response with the 400 status

      response-optional-property-added

    • added the optional property status to the response with the 403 status

      response-optional-property-added

    • added the optional property status to the response with the 422 status

      response-optional-property-added

    • added the optional property title to the response with the 400 status

      response-optional-property-added

    • added the optional property title to the response with the 403 status

      response-optional-property-added

    • added the optional property title to the response with the 422 status

      response-optional-property-added

    • added the optional property type to the response with the 400 status

      response-optional-property-added

    • added the optional property type to the response with the 403 status

      response-optional-property-added

    • added the optional property type to the response with the 422 status

      response-optional-property-added

    This revision also has 6 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • 99490d1e837e225See the full diff
    • the max_start_time request property type/format changed from string/ to string/date-time

      request-property-type-changed

    • the min_start_time request property type/format changed from string/ to string/date-time

      request-property-type-changed

    • removed the request property limit

      request-property-removed

    • removed the request property session_id

      request-property-removed

    • added the new optional request property page_size

      new-optional-request-property

    • added the new optional request property project_id

      new-optional-request-property

    • added the optional property has_more to the response with the 200 status

      response-optional-property-added

    • added the optional property items to the response with the 200 status

      response-optional-property-added

    • added the optional property next_cursor to the response with the 200 status

      response-optional-property-added

    This revision also has 15 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog