Skip to content
GET/api/v1/traces/stream

Real-time trace stream

Server-Sent Events stream of new traces for a project as they arrive; backs the dashboard's live trace explorer. `?projectId` is REQUIRED (400 otherwise). The handler polls root spans (`parent_span_id IS NULL`) in `trace_spans` every 3 seconds and emits `event: trace` with {id, name, model, latency_ms, status, created_at}, `event: ping` heartbeats to keep the connection open, and `event: error` when a poll fails. Close the stream by aborting the request. Authentication: the dashboard's Supabase browser session cookie (the DashboardSession scheme) and nothing else — this handler has no bearer branch, so an `eg_` API key answers 401 and no API-key scope is evaluated. It backs the dashboard's own EventSource rather than a programmatic client.

Authentication

Dashboard browser session. Requires the Supabase Auth session cookie the EvalGuard dashboard sets (sb-<project-ref>-auth-token).

This is a browser-only credential you cannot mint or reconstruct from an API client — @supabase/ssr may chunk it across ...auth-token.0 / .1. It is published because the operation accepts NOTHING else: the handler has no bearer branch, so an eg_ API key answers 401 here.

Response

All status codes

200SSE stream.
400(no description)
401(no description)
429(no description)

Code samples

cURL

curl -X GET \
  https://evalguard.ai/api/v1/traces/stream \
  -H "Authorization: Bearer $EVALGUARD_API_KEY"

TypeScript

// The TypeScript SDK (@evalguard/sdk) exposes TYPED methods — runEval,
// getEval, runSecurityScan, checkFirewall, … — not a generic request().
// For an arbitrary endpoint, call it directly:

const res = await fetch("https://evalguard.ai/api/v1/traces/stream", {
  method: "GET",
  headers: { Authorization: `Bearer ${process.env.EVALGUARD_API_KEY}` },
});
console.log(res.status, await res.json());

Python

# The Python SDK (pip install evalguardai) exposes TYPED methods on
# EvalGuardClient — run_eval, get_eval, … — not a generic request().
# For an arbitrary endpoint, call it directly:

import os
import requests

headers = {"Authorization": f"Bearer {os.environ['EVALGUARD_API_KEY']}"}

response = requests.request("GET", "https://evalguard.ai/api/v1/traces/stream", headers=headers)
print(response.status_code, response.json())

Go

package main

import (
	"context"
	"fmt"
	"net/http"
	"os"
)

func main() {
	req, _ := http.NewRequestWithContext(context.Background(), "GET", "https://evalguard.ai/api/v1/traces/stream", nil)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("EVALGUARD_API_KEY"))
	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	fmt.Println(resp.Status)
}

Errors

400401429

Other Traces endpoints