Skip to main content
GET
/
api
/
thread
/
{id}
Python
import requests

url = "https://app.langwatch.ai/api/thread/{id}"

headers = {"X-Auth-Token": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.json())
[
  {
    "trace_id": "trace_BKZL_X0TKSD4oa1aBJTc_",
    "project_id": "KAXYxPR8MUgTcP8CF193y",
    "metadata": {
      "sdk_version": "0.1.11",
      "sdk_language": "python"
    },
    "timestamps": {
      "started_at": 1721382486868,
      "inserted_at": 1721382492894,
      "updated_at": 1721382492894
    },
    "input": {
      "value": "hi"
    },
    "output": {
      "value": "Hey there! 👋😊"
    },
    "metrics": {
      "first_token_ms": 1449,
      "total_time_ms": 1543,
      "prompt_tokens": 20,
      "completion_tokens": 7,
      "tokens_estimated": true
    },
    "error": null,
    "indexing_md5s": [
      "cccd21e0b70c706034dfd9f7772816a3"
    ],
    "spans": [
      {
        "trace_id": "trace_BKZL_X0TKSD4oa1aBJTc_",
        "span_id": "span_h1xUkcUJilhudDrLeQbR_",
        "timestamps": {
          "finished_at": 1721382488392,
          "updated_at": 1721382492027,
          "started_at": 1721382486895,
          "first_token_at": 1721382488317,
          "inserted_at": 1721382492027
        },
        "type": "llm",
        "error": null,
        "params": {
          "stream": true,
          "temperature": 1
        },
        "project_id": "KAXYxPR8MUgTcP8CF193y",
        "parent_id": "span_ijZNjUMTz3ys0Z0YKwF_T",
        "name": null,
        "model": "openai/gpt-5",
        "metrics": {
          "tokens_estimated": true,
          "completion_tokens": 7,
          "prompt_tokens": 20
        },
        "input": {
          "type": "chat_messages",
          "value": [
            {
              "role": "system",
              "content": "You are a helpful assistant that only reply in short tweet-like responses, using lots of emojis."
            },
            {
              "role": "user",
              "content": "hi"
            }
          ]
        },
        "output": {
          "type": "chat_messages",
          "value": [
            {
              "role": "assistant",
              "content": "Hey there! 👋😊"
            }
          ]
        }
      }
    ],
    "evaluations": [
      {
        "evaluation_id": "check_VCagriZHNWICSOM09dXjM",
        "name": "Ragas Answer Relevancy",
        "type": "ragas/answer_relevancy",
        "trace_id": "trace_BKZL_X0TKSD4oa1aBJTc_",
        "project_id": "KAXYxPR8MUgTcP8CF193y",
        "status": "error",
        "timestamps": {
          "updated_at": 1721383657788,
          "inserted_at": 1721382493358
        },
        "error": {
          "stacktrace": [
            "TypeError: fetch failed"
          ],
          "message": "fetch failed",
          "has_error": true
        }
      }
    ]
  }
]

Authorizations

X-Auth-Token
string
header
required

Path Parameters

id
string
required

ID of thread to fetch

Response

Array of traces for a thread

trace_id
string
Example:

"trace_BKZL_X0TKSD4oa1aBJTc_"

project_id
string
Example:

"KAXYxPR8MUgTcP8CF193y"

metadata
object
timestamps
object
input
object
output
object
metrics
object
error
object | null
Example:

null

indexing_md5s
string[]
Example:
["cccd21e0b70c706034dfd9f7772816a3"]
spans
object[]
evaluations
object[]