BrowserStack AI Evals

Sessions API

List and retrieve trace sessions.

Sessions API

Sessions group related traces from a single user interaction or conversation. A session is automatically created when a trace is ingested with a sessionId.

List Sessions

GET /api/public/sessions

Query Parameters

ParameterTypeDescription
pageintegerPage number (default: 1)
limitintegerItems per page (default: 50)
fromTimestampISO 8601Filter sessions created at or after
toTimestampISO 8601Filter sessions created at or before
environmentstring | string[]Filter by environment

Response

{
  "data": [
    {
      "id": "session-abc",
      "createdAt": "2026-04-03T10:00:00.000Z",
      "projectId": "proj-xyz",
      "environment": "production"
    }
  ],
  "meta": {
    "page": 1,
    "limit": 50,
    "totalItems": 12,
    "totalPages": 1
  }
}

cURL Example

curl "https://evals-api.browserstack.com/api/public/sessions?page=1&limit=10" \
  -u "pk-lf-...:sk-lf-..."

Get Session

GET /api/public/sessions/{sessionId}

Returns a session along with all traces belonging to it.

Path Parameters

ParameterTypeDescription
sessionIdstringSession ID

Response

{
  "id": "session-abc",
  "createdAt": "2026-04-03T10:00:00.000Z",
  "projectId": "proj-xyz",
  "environment": "production",
  "traces": [
    {
      "id": "trace-uuid-1",
      "timestamp": "2026-04-03T10:00:00.000Z",
      "name": "rag-pipeline",
      "userId": "user-123",
      "sessionId": "session-abc",
      "metadata": null,
      "tags": [],
      "release": null,
      "version": null,
      "projectId": "proj-xyz",
      "environment": "production",
      "public": false,
      "bookmarked": false,
      "input": { "query": "What is quantum computing?" },
      "output": null,
      "createdAt": "2026-04-03T10:00:00.000Z",
      "updatedAt": "2026-04-03T10:00:01.000Z"
    }
  ]
}

cURL Example

curl "https://evals-api.browserstack.com/api/public/sessions/session-abc" \
  -u "pk-lf-...:sk-lf-..."

Session Fields

FieldTypeDescription
idstringSession ID (set by you when creating traces)
createdAtISO 8601When the session was first seen
projectIdstringProject this session belongs to
environmentstringEnvironment name

Creating Sessions

Sessions are implicitly created when you ingest a trace with a sessionId. There is no separate "create session" endpoint — pass sessionId in your trace body:

curl -X POST https://evals-api.browserstack.com/api/public/ingestion \
  -u "pk-lf-...:sk-lf-..." \
  -H "Content-Type: application/json" \
  -d '{
    "batch": [
      {
        "id": "evt-001",
        "type": "trace-create",
        "timestamp": "2026-04-03T10:00:00.000Z",
        "body": {
          "id": "trace-uuid-1",
          "name": "chat-turn-1",
          "sessionId": "session-abc",
          "userId": "user-123"
        }
      }
    ]
  }'